Commit 35de2d54 authored by Amy Qualls's avatar Amy Qualls

Merge branch '296139-experiment-user-contexts-to-get-merged-rather-than-overridden' into 'master'

Docs update for experiment user contexts

See merge request gitlab-org/gitlab!51193
parents ca20922d accac871
...@@ -281,13 +281,19 @@ Note that this data is completely separate from the [events tracking data](#impl ...@@ -281,13 +281,19 @@ Note that this data is completely separate from the [events tracking data](#impl
#### Add context #### Add context
You can add arbitrary context data in a hash which gets stored as part of the experiment user record. You can add arbitrary context data in a hash which gets stored as part of the experiment user record. New calls to the `record_experiment_user` with newer contexts get merged deeply into the existing context.
This data can then be used by data analytics dashboards. This data can then be used by data analytics dashboards.
```ruby ```ruby
before_action do before_action do
record_experiment_user(:signup_flow, foo: 42) record_experiment_user(:signup_flow, foo: 42, bar: { a: 22})
# context is { "foo" => 42, "bar" => { "a" => 22 }}
end end
# Additional contexts for newer record calls are merged deeply
record_experiment_user(:signup_flow, foo: 40, bar: { b: 2 }, thor: 3)
# context becomes { "foo" => 40, "bar" => { "a" => 22, "b" => 2 }, "thor" => 3}
``` ```
### Record experiment conversion event ### Record experiment conversion event
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment