You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This will send through experiment data to GTM for reporting.
70
+
71
+
### Optionally setup Google Optimize Server Side tracking
72
+
As an additional extra you can also track your experiment via Google Optimize with their Server Side tracking configuration.
73
+
More information about the required experiment settings can be found in the official [Google Optimize docs](https://developers.google.com/optimize/devguides/experiments).
74
+
75
+
Assuming you have followed the steps and have an experiment setup and ready to run you can now define how the A/B tests you have setup should be grouped and reported.
76
+
77
+
Only 2 buckets are supported at this tim for each a/b test, 0=control, 1=test
78
+
79
+
#### Scenario - A/B test
80
+
81
+
in `config/experiments.php` define a new group with a readable key (this can be the same key that you used for the a/b test itself)
82
+
83
+
```php
84
+
[
85
+
'tests' => [
86
+
'ab_test' => [],
87
+
],
88
+
'groups' => [
89
+
'ab_test_nice_group_name' => [
90
+
'id' => 'GOOGLE_OPTIMIZE_EXPERIMENT_ID',
91
+
'variations' => [
92
+
'ab_test',
93
+
],
94
+
],
95
+
],
96
+
]
97
+
```
98
+
99
+
Assuming the user is in the control group
100
+
The GTM tracking vars created for this will appear as follows (other vars snipped for clarity):
GA needs the value of `ga_optimize_exp` from the dataLayer to be set to the `exp` field.
160
+
Running GA directly it would look a bit like `ga('set', 'exp', 'GOOGLE_OPTIMIZE_EXPERIMENT_ID.0!MULTIVARIANT_GOOGLE_OPTIMIZE_EXPERIMENT_ID.1-0');'`
161
+
Via GTM, in the Google Analytics settings var, under `Fields to Set`, set the field name `exp` to the value of the dataLayer variable `ga_optimize_exp`
162
+
The other vars pushed to the dataLayer are convenience vars that you could use to segment user traffic, call additional GTM scripts, etc
163
+
Access specific experiment values via `experiments.obnoxious_colours` (for example)
0 commit comments