GA4 Experiment Tracking Setup

Choose and configure the right tracking approach for your A/B experiments.

GA4 Experiment Tracking Setup

ClickMint CRO Platform — Client Documentation Last updated: April 2026


Overview

ClickMint setup follows a simple two-step story:

  1. Configure GA4 for ClickMint by registering the cm_tracking event and the custom dimensions ClickMint relies on for reporting.
  2. Install the ClickMint script using the pattern that matches your site:
    • Approach 1: Direct / Native install for sites where GA4 is already installed directly in site code
    • Approach 2: GTM serverless event tracking for GTM-, sGTM-, or consent-managed setups

This split matters because the GA4 configuration is shared across every installation path, but the best place to load the ClickMint script depends on how your site already loads GA4.


How ClickMint tracking works

When a visitor lands on a page running an experiment:

  1. The ClickMint script loads from https://experiments.api.clickmint.com/{YOUR_ORG_TOKEN}{page-path}.
  2. It checks whether an active experiment exists for that page and assigns the visitor to a control or variant experience.
  3. It sets the GA4 user-scoped tracking property ClickMint currently relies on: experiment_id.
  4. It fires a cm_tracking event with experiment metadata such as outcome_id, outcome_index, outcome_type, experiment_mode, and event_type for diagnostics and reporting.
  5. Later in the same session, GA4 attaches the persisted experiment_id user property to downstream events like purchase, allowing ClickMint to correlate conversion activity back to the tracked visitor journey.

Important: ClickMint does not inject cart tracking, checkout tracking, revenue tracking, or PII capture. It records the experiment assignment in your GA4 property, then reads aggregate results back from GA4 through the Reporting API.


Step 1 — Register the cm_tracking event and GA4 custom dimensions

This step is required before either installation approach will report correctly.

A. Optional but recommended: grant ClickMint GA4 Viewer access

If you have not already done so, complete GA4 Integration Setup first so ClickMint can read reporting data from your GA4 property.

B. Create the cm_tracking custom event

In GA4 → Admin → Data display → Events → Create event, add one custom event:

Custom event nameMatching condition
cm_trackingevent_name equals cm_tracking

C. Register the required user-scoped custom dimension

In GA4 → Admin → Data display → Custom definitions → Create custom dimension, register the following with Scope = User.

This is the key user-scoped dimension ClickMint's current reporting pipeline relies on.

Suggested nameUser property nameWhy it matters
CM User Experiment IDexperiment_idPersistent ClickMint tracking ID used for cross-session attribution and reporting

Important: older internal references may mention additional user-scoped properties such as experiment_variant, outcome_id, or outcome_index. For the current customer-facing setup, experiment_id is the required user-scoped custom definition to register.

D. Register the recommended event-scoped custom dimensions

Still in Custom definitions, register the following with Scope = Event.

These are recommended for DebugView checks, diagnostics, and implementation support. ClickMint's current reporting flow depends on the event payload for outcome-level context.

Suggested nameEvent parameterDescription
CM Event Typeevent_typeImpression type such as variant_loaded, control, or error
CM Experiment IDexperiment_idExperiment identifier on the cm_tracking event
CM Experiment Modeexperiment_modeUsually production or preview
CM Experiment Variantexperiment_variantVariant token carried on the event
CM Outcome IDoutcome_idOutcome / variant UUID
CM Outcome Indexoutcome_indexNumeric variant index
CM Outcome Typeoutcome_typeredirect, repaint, control, or error descriptor
CM Page Pathpage_pathPage path where the assignment occurred

⚠️ GA4 processing delay: after creating new custom definitions, allow 24–48 hours before conversion data appears reliably in ClickMint. DebugView can show events sooner, but Data API-backed reports take longer.


Step 2 — Choose how to install the ClickMint script

Once GA4 is configured, choose the installation path that matches how GA4 is already deployed on your site.

Approach 1: Direct / Native installApproach 2: GTM serverless event tracking
Best forSites where GA4 already lives directly in site code / <head>Sites where GA4 is managed by GTM, sGTM, Consent Mode v2, Elevar, etc.
GA4 ownershipDirect gtag.js or native code installExisting Google Tag / GA4 Configuration tag stays in place
Preferred script locationDirectly in the page <head>Also directly in the page <head> when possible
Fallback if head access is unavailableN/AUse the complete GTM template and accept a presentation delay
Primary tradeoffRequires code or CMS head accessMore moving parts, but protects existing GTM / consent architecture

Choose Approach 1 if…

  • Your site already loads GA4 directly in theme files, templates, or application code
  • You can edit the page <head> (or a CMS field that writes into the <head>)
  • You want the fastest possible experiment presentation with the least GTM complexity

Go to Approach 1: Direct / Native Script Installation

Choose Approach 2 if…

  • Your GA4 setup is managed by GTM, server-side GTM (sGTM), Consent Mode v2, or a vendor-managed stack such as Elevar or Littledata
  • You want to keep your current Google Tag / GA4 configuration intact
  • You need ClickMint to plug into your existing GTM measurement flow instead of replacing it

Approach 2 includes two GTM options:

  1. Preferred: import the events-only GTM template and install the ClickMint script manually in <head>
  2. Fallback: import the complete GTM template and let GTM inject the script, with a clear tradeoff: the experiment can appear later because GTM often appends Custom HTML near the end of <body>

Go to Approach 2: GTM Serverless Event Tracking

Need vendor-specific GTM notes?

If you are working inside Elevar, Segment, Shopify + GTM, Tealium, Adobe, or another vendor-managed analytics stack — or you are migrating from the older GTM Custom HTML instructions — use the supplemental guide:

GTM Platform Notes & Migration Guide


Privacy, consent, and attribution notes

These points are especially useful for legal, compliance, and analytics reviewers:

  • No direct PII collection: ClickMint's script does not collect names, email addresses, billing information, cart contents, form inputs, or click / scroll tracking.
  • Revenue comes from your GA4 property: ClickMint does not generate purchase data itself — it reads revenue and conversion events from the GA4 implementation you already own.
  • Consent is respected: if your CMP blocks GA4 entirely until consent is granted, the experiment can still run but no tracking event is sent until GA4 becomes available.
  • Consent Mode v2 behavior follows Google: when Consent Mode v2 is active, ClickMint does not bypass or override consent signals. Whatever GA4 is allowed to collect under the active consent state is what ClickMint inherits.

If your compliance posture requires certainty that no events reach GA4 before consent, the safest pattern is to block the GA4 tag entirely until consent is granted rather than relying only on Consent Mode v2 restrictions.


FAQ

Will I lose historical GA4 data?

No. You keep the same GA4 property and measurement ID. You are only changing how ClickMint experiment assignment is sent into that property.

Why is manual <head> install preferred for GTM-managed sites?

Because GTM Custom HTML tags are frequently appended near the end of <body>. That can delay when ClickMint applies the experiment, which may create a visible flash of the original page before the variant loads.

What if I cannot edit the page <head> at all?

Use Approach 2, Option B — the complete GTM template. It is a valid fallback, but it is slower than manual head install and should be used only when direct head placement is unavailable.

Does ClickMint still work if my CMP blocks analytics consent?

Yes — the experiment delivery still works, because that happens before GA4 tracking. Only the measurement is blocked when GA4 is unavailable.

I see "data flowing" in GA4. Is that enough?

Not by itself. Confirm that a cm_tracking event appears in GA4 DebugView, that it carries experiment parameters, and that the visitor session includes the experiment_id user property.

What if I am on Shopify and cannot edit theme code?

If your theme or app setup exposes a reliable way to write to the page <head>, use that. Otherwise, use Approach 2 and start with the GTM serverless guide.


Getting help

If you run into issues or need assistance:

  • Email: [email protected]
  • In-App Chat: Log in to your ClickMint dashboard and use the chat widget

When contacting support, please include:

  1. Your GA4 Measurement ID (for example G-XXXXXXXXXX)
  2. Which installation path you used (Direct / Native, GTM serverless Option A, or GTM serverless Option B)
  3. A screenshot of the cm_tracking event in GA4 DebugView
  4. A screenshot of Tag Assistant / GTM Preview if GTM is involved
  5. The URL of the page you are testing