GTM Template: Complete

GTM container JSON with ClickMint script + cm_tracking event forwarding — fallback when access is unavailable (Option B).

GTM Complete Template

ClickMint CRO Platform — GTM Container Template Last updated: April 2026

Back to Approach 2: GTM Serverless


⚠️

This is the fallback template. It lets GTM inject the ClickMint script via Custom HTML, which can delay when the experiment appears. Use the Events-Only Template (Option A) whenever you can install the script in <head> yourself.


What this template includes

ComponentIncluded
GA4 Event tag (cm event tracking - serverless)
Custom Event trigger (cm tracking event)
8 Data Layer Variables (cm dl *)
ClickMint script tag (cm script - serverless)✅ — injected by GTM Custom HTML

Configure before importing

Find and replace both placeholders in the JSON below:

PlaceholderReplace with
REPLACE_WITH_GA4_MEASUREMENT_IDYour GA4 Measurement ID (e.g. G-XXXXXXXXXX)
REPLACE_WITH_ORG_TOKENYour ClickMint org token / script identifier

How to configure and import

  1. Copy the full JSON below
  2. Paste into a text editor
  3. Find and replace both placeholders listed above
  4. Save the file as gtm-complete.json
  5. In GTM, go to Admin → Import Container
  6. Upload the file, choose Merge, then Rename conflicting tags, triggers, and variables
  7. Confirm the import

Template 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 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"
      },
      {
        "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"
      }
    ]
  }
}

After importing

  1. In GTM Preview, verify both:
    • The cm_tracking event is reaching GA4
    • The experiment is appearing early enough on page load
  2. If you see the original page briefly before the experiment applies, switch to Option A (Events-Only Template) as soon as you have a path to install the script in <head>
  3. Publish the GTM workspace

Back to Approach 2: GTM Serverless