Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Gtag.js optmize server_side implementation not working

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?

like image 962
Lennie Avatar asked Jan 28 '26 19:01

Lennie


1 Answers

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

like image 69
user2779660 Avatar answered Feb 01 '26 01:02

user2779660



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!