This article provides step-by-step instructions on how to install Google Tag Manager container code in Kartra pages.

Important: The HEAD section in Kartra pages accepts JavaScript only. HTML must be removed from any tracking code entered in the HEAD section.

Follow the instructions from Google Support documentation to create a Tag Manager account and a container for your Kartra assets.

  1. Read: Set up and install Tag Manager (Google Support)
  2. Choose the container type Web and AMP

When the setup is complete, Tag Manager will provide you with two code snippets. (Example below)

Example of google tag manager code snippets

To install the Google Tag Manager, open a page in your Kartra account:

  1. Click Settings in the left side menu
  2. Click Tracking Codes
    Tracking Code button under settings in Kartra
  3. Go back to Tag Manager and copy the first snippet for the <head> section
  4. 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:
      Modified code snippet
      Embed tracking code snippet
  5. Go back to Tag Manager and copy the second snippet for the <body> section
  6. In Kartra, paste the snippet in the Embed tracking code into the <body> field
    Embed tracking code into the <body>IMPORTANT: The body field accepts both HTML and JavaScript. Do NOT modify the body snippet.
  7. Click Apply
  8. 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:

  1. In the page builder, click Sites
  2. In Export to Site, toggle Tracking Codes ON
  3. Select all or specific pages from the Export to other pages dropdown
  4. Click Apply
  5. 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.

Export to Site global toggles