How can I set Analytics variables with Google Tag Manager from the server?
问题 I'm using Google Optimize for creating A/B tests. I'm using it in server side mode as in this guide: https://developers.google.com/optimize/devguides/experiments That guide shows an easy way of setting which experiment is running with which variant by rendering the JS code on the server which sets the experiment id and variant id: // 2. Create a tracker. ga('create', 'UA-XXXXX-Y', 'auto'); <?php <<<HTML // 3. Set the experiment ID and variation ID. ga('set', 'exp', '$experimentId.$variationId