Using a Tag Manager to insert the Convert tracking code on a page makes it sub-optimal because the loading of the script will become asynchronous and therefore, will eventually load after the page has loaded. In that way, there will be quite some time until the experiment changes are applied.
Users may notice a flickering effect, seeing the original page for a short time before changes are applied to your variation content.
We do not advise on using any Tag Manager (e.g. Google Tag Manager, Tealium) for inserting the main tracking code on a page.
But if you do not have easy access to your site's source code to add the Convert snippet, you can inject the Convert snippet through Google Tag Manager (GTM).
Use GTM to Insert Convert Experiences code
Find the Convert tracking code
Grab the tracking code from your Project's Configuration inside your account;
Create a new tag of type Custom HTML in GTM
In GTM, create a new tag of type Custom HTML.
Give it a descriptive name and paste the below code followed by the main Convert Experiences Tracking code (the one you grabbed in step 1) inside the tag content
The code above is added to disable body hiding, since tags loaded through GTM are asynchronous.
Do check the Support document.write since that's used to fire the Convert code.
Select a triggering type and hit Save.
Publish your GTM Workspace
Your tag is ready. You need to publish now your current workspace.
- Click on the Submit button at the top right hand side of the screen. The Submit Changes screen will appear, with options to publish the container and save a version of your container. Select Publish and Create Version if it is not already selected.
- Review the Workspace Changes section to see if everything looks as expected.
- Enter a Version Name and Version Description.
- If you have Tag Manager configured to use multiple environments, select which environment you'd like to publish to in the Publish to Environment section.
- Click Publish.
keyword: Google Tag Manager