Activate

Generate GTM Code

Bundle your active experiences and running experiments into copy-and-paste GTM snippets. The page produces Custom HTML tags plus a variant trigger reference, not a container import file.

Overview

Generate GTM Code turns the rules you have built in Activate into the snippets you paste into Google Tag Manager. It is a snippet generator, not a container exporter. You will copy Custom HTML tags into GTM yourself, so there is no JSON container file to import. This keeps you in control of how the tags are sequenced and triggered inside your own container.

The page only includes rules that are live: experiences set to Active and experiments set to Running. Anything in Draft or Paused is skipped, which means the generated code always reflects exactly what should be firing on your site.

Review the summary

Go to Activate > Generate GTM Code. The summary bar at the top reports how many experiences are active, how many experiments are running, and the total number of rules that will be generated. If the total is zero, set at least one experience to Active or one experiment to Running first, otherwise there is nothing to bundle.

Generate the code

Click Generate GTM Code. The page bundles every active rule and reveals four tabs: Init Tag, Re-evaluate Tag, Conversions Tag, and Variant Triggers. The Init Tag holds your full rules array and changes whenever you add, pause, or remove a rule. The Re-evaluate and Conversions tags are static helpers you set up once.

Copy the tags into GTM

Each tag tab has a Copy button. In GTM, create a Custom HTML tag and paste the snippet. The Init Tag must fire after the TPHelperFactory base script loads, so use tag sequencing or fire it on a custom event like tph_consent_ready. The Conversions Tag fires on your purchase event, for example tp_purchase. Because the Init Tag changes with every generation, re-copy it into GTM each time you regenerate.

Wire the triggers

Open the Variant Triggers tab for a reference table of event names and filters. For each row, create a GTM Custom Event trigger that matches the event name and filter, then attach your own Custom HTML render tag to that trigger to show, hide, or swap content. The page deliberately does not generate render logic, since how you change the page is specific to your site's markup.

Tips

This is a snippet generator: you copy Custom HTML tags into GTM yourself, there is no container file to import. The Init Tag must fire after the TPHelperFactory base script. Only active experiences and running experiments are included, so flip a rule live before generating.

Re-copy after every change

The Init Tag embeds your current rules. Whenever you add, pause, or remove a rule, regenerate and paste the new Init Tag into GTM, otherwise your container will run stale logic.

Troubleshooting

The Generate button is disabled

There are no active rules to bundle. Set at least one experience to Active or one experiment to Running, then reload the page and the button becomes available.

Tags fire but nothing renders

The generated tags only push data layer events. You still need a render tag for each variant trigger. Check the Variant Triggers tab, create the matching Custom Event triggers, and attach your own Custom HTML tags that actually change the page.

Init Tag throws because TPHelperFactory is undefined

The Init Tag ran before the base SDK loaded. Use GTM tag sequencing so the Init Tag fires after the TPHelperFactory base script, or trigger it on a later custom event such as tph_consent_ready.