GTM Installation Guide

For GTM-managed sites: the default is no ClickMint tags at all — plus the two gated exceptions and their importable containers.

Using Google Tag Manager, server-side GTM, Consent Mode v2, or a vendor-managed stack? This page is for the person who owns the container. Verification and troubleshooting live in the Technical Reference.

GTM and vendor stacks

Default: GTM needs no ClickMint tags. Install the snippet in <head>, leave the container alone, verify the count is one. Your Google Tag, consent chain, ecommerce tags, and vendor data layers stay untouched. Adding a tag that re-sends cm_tracking on a site where a Google tag already processes gtag commands duplicates every event — older ClickMint documentation recommended that pattern; it is retired.

The two legitimate exceptions:

SituationUse
GA4 exists only inside GTM (no gtag.js, no platform integration) — verified count zeroEvent forwarding below
No way to write into the page <head> at allScript-install fallback

Never combine an exception with the normal path; after any change, re-verify the count.

Vendor notes

  • Shopify + GTM: snippet in theme.liquid <head>; never as a custom pixel; if both the Google & YouTube channel and a hardcoded GA4 snippet exist, remove one.
  • Elevar / Littledata: keep all vendor tags; snippet in <head>; nothing added to the container.
  • Segment: if Segment's GA4 Web destination is the only GA4 on the page, verification may count zero — treat as the GTM-only case after confirming.
  • Tealium / Adobe tags: keep the current GA4 owner; place the snippet in head-managed code (their head-placed HTML block is fine; end-of-body is not).
  • Clarity / PostHog / Klaviyo / Triple Whale: no ClickMint-specific action; just ensure GA4 has exactly one owner.

Removing a legacy ClickMint GTM setup

Older guidance created artifacts that double data. Remove from the web container: the GA4 Event tag cm event tracking - serverless (any tag re-sending cm_tracking), the trigger cm tracking event, the eight cm dl * variables, and any ga4 html install / cm script Custom HTML tags injecting gtag.js or a second snippet. From GA4 Admin: any condition-based cm_tracking "Create event" rule (re-register via Create with code).

Safe order: save a GTM workspace version → confirm the <head> snippet loads → pause the forwarding tag → delete trigger/variables once verified → fix the GA4 rule → re-verify (count one; ecommerce tags still firing). If verification counts zero without the forwarding tag, you are the gated exception — keep it.


GTM exception: event forwarding

🚫 Gate: verified count of ZERO only. On any site where the count was one, this setup makes it two.

Sets up: ClickMint script → dataLayer → Custom Event trigger → GA4 Event tag → GA4. Your existing Google Tag configuration inside GTM stays untouched; in this topology the forwarding tag is the only delivery path, keeping the count at one.

Steps: copy Appendix A, replace REPLACE_WITH_GA4_MEASUREMENT_ID, save as gtm-events-forwarding.json → GTM Admin → Import ContainerMerge + Rename conflicting → preview (cm event tracking - serverless fires on cm_tracking; cm dl * variables resolve) → publish → re-verify: exactly one.

Manual build (what the container contains)

GA4 Event tag cm event tracking - serverless — type Google Analytics: GA4 Event, your Measurement ID, event name cm_tracking, trigger cm tracking event. Parameters:

Parameter nameValue
event_type{{cm dl event type}}
experiment_id{{cm dl experiment id}}
experiment_mode{{cm dl experiment mode}}
experiment_variant{{cm dl experiment variant}}
outcome_id{{cm dl outcome id}}
outcome_index{{cm dl outcome index}}
outcome_type{{cm dl outcome type}}
page_path{{Page Path}}

User property: experiment_id = {{cm dl up experiment id}}.

Custom Event trigger cm tracking event — event name cm_tracking, all custom events.

Data Layer Variables (v2):

Variable nameData Layer Variable Name
cm dl event typeeventModel.event_type
cm dl experiment ideventModel.experiment_id
cm dl experiment modeeventModel.experiment_mode
cm dl experiment varianteventModel.experiment_variant
cm dl outcome ideventModel.outcome_id
cm dl outcome indexeventModel.outcome_index
cm dl outcome typeeventModel.outcome_type
cm dl up experiment iduser_properties.experiment_id

Keep untouched: your Google Tag / GA4 configuration, ecommerce event tags, vendor data-layer helpers.


GTM exception: script-install fallback

For sites with no <head> access: GTM loads the snippet via a Custom HTML tag on the Initialization trigger. Tradeoff: GTM often injects Custom HTML near the end of <body>, so the experiment can apply visibly late. Move to a direct head install when possible — and remove this tag first (two installs = doubled tracking). The container carries no event forwarding.

Steps: copy Appendix B, replace REPLACE_WITH_ORG_TOKEN, save as gtm-script-only.json → import (Merge + Rename conflicting) → preview (tag fires on initialization; script loads from experiments.api.clickmint.com) → publish → verify: exactly one cm_tracking.


Appendix A — event-forwarding container JSON

{
  "exportFormatVersion": 2,
  "exportTime": "2026-03-10 00:00:00",
  "containerVersion": {
    "path": "accounts/0/containers/0/versions/0",
    "accountId": "0",
    "containerId": "0",
    "containerVersionId": "0",
    "fingerprint": "0",
    "container": {
      "path": "accounts/0/containers/0",
      "accountId": "0",
      "containerId": "0",
      "name": "ClickMint Serverless Tracking",
      "publicId": "GTM-0000000",
      "usageContext": ["WEB"]
    },
    "builtInVariable": [
      {
        "accountId": "0",
        "containerId": "0",
        "type": "PAGE_URL",
        "name": "Page URL"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "type": "PAGE_HOSTNAME",
        "name": "Page Hostname"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "type": "PAGE_PATH",
        "name": "Page Path"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "type": "REFERRER",
        "name": "Referrer"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "type": "EVENT",
        "name": "Event"
      }
    ],
    "variable": [
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "0",
        "name": "cm dl event type",
        "type": "v",
        "parameter": [
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          },
          {
            "type": "BOOLEAN",
            "key": "setDefaultValue",
            "value": "false"
          },
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "eventModel.event_type"
          }
        ],
        "fingerprint": "0"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "0",
        "name": "cm dl experiment id",
        "type": "v",
        "parameter": [
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          },
          {
            "type": "BOOLEAN",
            "key": "setDefaultValue",
            "value": "false"
          },
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "eventModel.experiment_id"
          }
        ],
        "fingerprint": "0"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "0",
        "name": "cm dl experiment mode",
        "type": "v",
        "parameter": [
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          },
          {
            "type": "BOOLEAN",
            "key": "setDefaultValue",
            "value": "false"
          },
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "eventModel.experiment_mode"
          }
        ],
        "fingerprint": "0"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "0",
        "name": "cm dl experiment variant",
        "type": "v",
        "parameter": [
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          },
          {
            "type": "BOOLEAN",
            "key": "setDefaultValue",
            "value": "false"
          },
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "eventModel.experiment_variant"
          }
        ],
        "fingerprint": "0"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "0",
        "name": "cm dl outcome id",
        "type": "v",
        "parameter": [
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          },
          {
            "type": "BOOLEAN",
            "key": "setDefaultValue",
            "value": "false"
          },
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "eventModel.outcome_id"
          }
        ],
        "fingerprint": "0"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "0",
        "name": "cm dl outcome index",
        "type": "v",
        "parameter": [
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          },
          {
            "type": "BOOLEAN",
            "key": "setDefaultValue",
            "value": "false"
          },
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "eventModel.outcome_index"
          }
        ],
        "fingerprint": "0"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "0",
        "name": "cm dl outcome type",
        "type": "v",
        "parameter": [
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          },
          {
            "type": "BOOLEAN",
            "key": "setDefaultValue",
            "value": "false"
          },
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "eventModel.outcome_type"
          }
        ],
        "fingerprint": "0"
      },
      {
        "accountId": "0",
        "containerId": "0",
        "variableId": "0",
        "name": "cm dl up experiment id",
        "type": "v",
        "parameter": [
          {
            "type": "INTEGER",
            "key": "dataLayerVersion",
            "value": "2"
          },
          {
            "type": "BOOLEAN",
            "key": "setDefaultValue",
            "value": "false"
          },
          {
            "type": "TEMPLATE",
            "key": "name",
            "value": "user_properties.experiment_id"
          }
        ],
        "fingerprint": "0"
      }
    ],
    "trigger": [
      {
        "accountId": "0",
        "containerId": "0",
        "triggerId": "0",
        "name": "cm tracking event",
        "type": "CUSTOM_EVENT",
        "customEventFilter": [
          {
            "type": "EQUALS",
            "parameter": [
              {
                "type": "TEMPLATE",
                "key": "arg0",
                "value": "{{_event}}"
              },
              {
                "type": "TEMPLATE",
                "key": "arg1",
                "value": "cm_tracking"
              }
            ]
          }
        ],
        "fingerprint": "0"
      }
    ],
    "tag": [
      {
        "accountId": "0",
        "containerId": "0",
        "tagId": "0",
        "name": "cm event tracking - serverless",
        "type": "gaawe",
        "priority": {
          "type": "INTEGER",
          "value": "10"
        },
        "parameter": [
          {
            "type": "TEMPLATE",
            "key": "eventName",
            "value": "cm_tracking"
          },
          {
            "type": "TEMPLATE",
            "key": "measurementIdOverride",
            "value": "REPLACE_WITH_GA4_MEASUREMENT_ID"
          },
          {
            "type": "LIST",
            "key": "eventParameters",
            "list": [
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "event_type"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{cm dl event type}}"
                  }
                ]
              },
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "experiment_id"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{cm dl experiment id}}"
                  }
                ]
              },
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "experiment_mode"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{cm dl experiment mode}}"
                  }
                ]
              },
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "experiment_variant"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{cm dl experiment variant}}"
                  }
                ]
              },
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "outcome_id"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{cm dl outcome id}}"
                  }
                ]
              },
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "outcome_index"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{cm dl outcome index}}"
                  }
                ]
              },
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "outcome_type"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{cm dl outcome type}}"
                  }
                ]
              },
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "page_path"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{Page Path}}"
                  }
                ]
              }
            ]
          },
          {
            "type": "LIST",
            "key": "userProperties",
            "list": [
              {
                "type": "MAP",
                "map": [
                  {
                    "type": "TEMPLATE",
                    "key": "name",
                    "value": "experiment_id"
                  },
                  {
                    "type": "TEMPLATE",
                    "key": "value",
                    "value": "{{cm dl up experiment id}}"
                  }
                ]
              }
            ]
          }
        ],
        "firingTriggerId": ["0"],
        "tagFiringOption": "ONCE_PER_EVENT",
        "fingerprint": "0"
      }
    ]
  }
}

Appendix B — script-install container JSON

{
  "exportFormatVersion": 2,
  "exportTime": "2026-03-10 00:00:00",
  "containerVersion": {
    "path": "accounts/0/containers/0/versions/0",
    "accountId": "0",
    "containerId": "0",
    "containerVersionId": "0",
    "fingerprint": "0",
    "container": {
      "path": "accounts/0/containers/0",
      "accountId": "0",
      "containerId": "0",
      "name": "ClickMint Script Install",
      "publicId": "GTM-0000000",
      "usageContext": ["WEB"]
    },
    "tag": [
      {
        "accountId": "0",
        "containerId": "0",
        "tagId": "0",
        "name": "cm script - serverless",
        "type": "html",
        "priority": {
          "type": "INTEGER",
          "value": "100"
        },
        "parameter": [
          {
            "type": "TEMPLATE",
            "key": "html",
            "value": "<script>\n  ;(function () {\n    var currentPath = location.pathname;\n    var previewStorageKey = 'cm_preview_' + currentPath;\n    var referrerStorageKey = 'cm_referrer_' + currentPath;\n    var params = new URLSearchParams(location.search);\n    var previewParam = params.get('cm_preview');\n    var referrerParam = params.get('cm_referrer');\n\n    if (previewParam) {\n      localStorage.setItem(previewStorageKey, previewParam);\n    }\n    if (referrerParam) {\n      localStorage.setItem(referrerStorageKey, referrerParam);\n    }\n\n    var baseUrl = 'https://experiments.api.clickmint.com/REPLACE_WITH_ORG_TOKEN' + currentPath;\n    var queryParts = [];\n\n    var storedPreview = localStorage.getItem(previewStorageKey);\n    if (storedPreview) {\n      queryParts.push('cm_preview=' + encodeURIComponent(storedPreview));\n    }\n\n    var storedReferrer = localStorage.getItem(referrerStorageKey);\n    if (storedReferrer) {\n      queryParts.push('cm_referrer=' + encodeURIComponent(storedReferrer));\n    }\n\n    var scriptUrl = baseUrl + (queryParts.length > 0 ? '?' + queryParts.join('&') : '');\n    var script = document.createElement('script');\n    script.async = true;\n    script.src = scriptUrl;\n    ;(document.head || document.documentElement).appendChild(script);\n  })();\n</script>"
          },
          {
            "type": "BOOLEAN",
            "key": "supportDocumentWrite",
            "value": "true"
          }
        ],
        "firingTriggerId": ["2147479572"],
        "tagFiringOption": "ONCE_PER_EVENT",
        "fingerprint": "0"
      }
    ]
  }
}

Did this page help you?