This article provides step-by-step instructions on how to install Google Tag Manager container code in Kartra pages.
Get the Google Tag Manager code
Follow the instructions from Google Support documentation to create a Tag Manager account and a container for your Kartra assets.
- Read: Set up and install Tag Manager (Google Support)
- Choose the container type Web and AMP
When the setup is complete, Tag Manager will provide you with two code snippets. (Example below)
Install the tracking code in a Kartra page
To install the Google Tag Manager, open a page in your Kartra account:
- Click Settings in the left side menu
- Click Tracking Codes
- Go back to Tag Manager and copy the first snippet for the <head> section
- In Kartra, paste the snippet in the Embed tracking code into the <head> field
- IMPORTANT: This field does not accept HTML code. To use the GTM code snippet in a Kartra page, you must remove the HTML <script></script> tags AND the HTML comments <!-- --> at the beginning and end of the code. Replace the HTML comments with JavaScript comments.
JavaScript comments:
/* Google Tag Manager */
/* End Google Tag Manager */
Your modified code should look something like this:
- IMPORTANT: This field does not accept HTML code. To use the GTM code snippet in a Kartra page, you must remove the HTML <script></script> tags AND the HTML comments <!-- --> at the beginning and end of the code. Replace the HTML comments with JavaScript comments.
- Go back to Tag Manager and copy the second snippet for the <body> section
- In Kartra, paste the snippet in the Embed tracking code into the <body> field
- IMPORTANT: The body field accepts both HTML and JavaScript. Do NOT modify the body snippet.
- IMPORTANT: The body field accepts both HTML and JavaScript. Do NOT modify the body snippet.
- Click Apply
- Click Actions > Publish live in the top right menu to publish the page so Google can detect the new code
Repeat this process for all pages you want to track with the Google Tag Manager.
Resources
For more information on how to use the Tag Manager or debug your setup, consult Google Support resources.
Global site update
If the page is assigned to a Site, export Tracking Codes to update all site pages in a global action:
- In the page builder, click Sites
- In Export to Site, toggle Tracking Codes ON
- Select all or specific pages from the Export to other pages dropdown
- Click Apply
- Click Proceed to acknowledge the overwrite warning
The export will begin immediately. Depending on the number of pages assigned the site, it may take some time to complete.