Sha256: 1b4d1ae8e721bafe6382c82b00f4dfa0ba52986359aa7e25cb24fbb5954b59fc
Contents?: true
Size: 1.18 KB
Versions: 1
Compression:
Stored size: 1.18 KB
Contents
# frozen_string_literal: true module OptimizelyServerSide module Support # Enables for us to wrap experiments # Usage: # experiment('sign_up_test') do |config| # # config.variation_one('variation_one_key') do # # Code related to variation one # end # # config.variation_two('variation_two_key') do # # Code related to variation two # end # # config.variation_default('variation_default_key', primary: true) do # # We still want to keep our default experience # end # # end def experiment(experiment_key, &blk) variation_key = optimizely_sdk_project_instance(experiment_key) OptimizelyServerSide::Experiment.new(experiment_key, variation_key).start(&blk) end def optimizely_sdk_project_instance(experiment_key) OptimizelyServerSide::OptimizelySdk .project_instance(event_dispatcher: OptimizelyServerSide.configuration.event_dispatcher) .activate(experiment_key, OptimizelyServerSide.configuration.user_attributes['visitor_id'], OptimizelyServerSide.configuration.user_attributes.reject { |k,v| k == 'visitor_id'}) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
optimizely_server_side-0.0.12 | lib/optimizely_server_side/helpers/support.rb |