I need some help with a server side implementation of optimize with gtag.js (the new global tag from Google).
With analytics.js it was as simple as ga('set', 'exp', 'experimentid.0'); The manual can be found here
With gtag.js set should work like this:gtag('set', {'exp': 'experimentid.0'});, but the values are not picked up by Google Optimize/Analytics. I tried putting it before the config tag and in the config tag as additional config information. gtag('config', '<target_ID>', {<additional_config_info>});
Furthermore i also tried changing exp in expId (like in an example on this page) To no avail.
Does someone have a working server_side optimize code or can help me out?
Google Optimize Team Posted the following:
gtag('config', 'UA-XXXXXX-1', {experiments: [
{ id: 'ExperimentID 1', variant: '1' },
{ id: 'ExperimentID 2', variant: '8' },
]});
https://support.google.com/optimize/thread/36142685?hl=en&msgid=36785067
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With