Readme.md in optimizely_server_side-0.0.9 vs Readme.md in optimizely_server_side-0.0.10

- old
+ new

@@ -56,19 +56,24 @@ config.event_dispatcher = MyEventDispatcher.new end ``` -Config info +_Config info_ -`config_endpoint` - This is the Datafile endpoint which returns JSON config. `PROJECT_ID` is a id of your server side project at https://app.optimizely.com . -`cache_expiry` - Time we want to keep the config cached in memory. -`event_dispatcher` - Optimizely needs to track every visit. You can pass your own event dispatcher from here. Read [more](https://developers.optimizely.com/server/reference/index#event-dispatcher) +- `config_endpoint` - This is the Datafile endpoint which returns JSON config. `PROJECT_ID` is a id of your server side project at https://app.optimizely.com . +- `cache_expiry` - Time we want to keep the config cached in memory. +- `event_dispatcher` - Optimizely needs to track every visit. You can pass your own event dispatcher from here. Read [more](https://developers.optimizely.com/server/reference/index#event-dispatcher) +- `user_attributes` - Everything related to user is passed from here. The must have key is `visitor_id`. In the same hash you can pass other other custom attributes. eq +``` +config.user_attributes = {'visitor_id' => 1234, 'device_type' => 'iPhone'} +``` + Optimizely needs a `visitor_id` to track the unique user and server a constant experience. In your Application controller ```ruby @@ -82,11 +87,11 @@ cookies.permanent[:visitor_id] = '1234567' #some visitor_id # This links the browser cookie for visitor_id to # OptimizelyServerSide OptimizelyServerSide.configure do |config| - config.visitor_id = cookies[:visitor_id] + config.user_attributes = {'visitor_id' => cookies[:visitor_id]} end end ``` @@ -97,17 +102,17 @@ ```ruby # in any app/view/foo.html.erb <% experiment(EXPERIMENT_KEY) do |config| %> <% config.variation_one(VARIATION_ONE_KEY) do %> - <%= render partial: 'variation_one_experience' %> + <%= render partial: 'variation_one_experience' %> <% end %> <% config.variation_default(VARIATION_DEFAULT_KEY, primary: true) do %> <%= render partial: 'variation_default_experience' %> <% end %> - + <% end %> ``` #### In your model or any PORO @@ -149,10 +154,10 @@ <% end %> <% config.variation_pathetic_experience(VARIATION_DEFAULT_KEY, primary: true) do %> <%= render partial: 'variation_default_experience' %> <% end %> - + <% end %> ``` In the above examples: