Zum Inhalt springen

Google Analytics and the data layer

Measure personalization in your own analytics. The GetIntent script reports each personalized page view and each tracked conversion to the data layer, and optionally straight to GA4 (gtag.js) and Segment.

What is sent

getintent_personalized is sent once per page view, after GetIntent has rewritten the page. Page views that were not personalized send nothing, so you can compare sessions with and without the event.

window.dataLayer.push({
  event: "getintent_personalized",
  getintent_site_id: "clx0site...",
  getintent_variant_id: "clx0var...",      // only when the visitor is in an A/B test
  getintent_variant_name: "Outcome-led",
  getintent_experiment_id: "clx0exp...",
  getintent_intent_level: "high",          // high | medium | low | very_low
  getintent_elements: 3,                   // elements rewritten on this page
  getintent_cache_source: "full"           // session | fast | full
})

getintent_experiment_exposure is sent once per page view when the visitor is in a running A/B test, in both arms. For visitors in the holdout it is the only page event, because their page is not rewritten.

window.dataLayer.push({
  event: "getintent_experiment_exposure",
  getintent_site_id: "clx0site...",
  getintent_experiment_id: "clx0exp...",
  getintent_variant_id: "clx0var...",
  getintent_variant_name: "Original page (holdout)",
  getintent_experiment_arm: "holdout"      // holdout | personalized
})

getintent_conversion is sent every time you call window.getintentTrackConversion(), and once per browser session when an automatically tracked click or page-view goal is reached, with the goal name as getintent_conversion_name.

window.dataLayer.push({
  event: "getintent_conversion",
  getintent_site_id: "clx0site...",
  getintent_variant_id: "clx0var...",
  getintent_experiment_id: "clx0exp...",
  getintent_experiment_arm: "personalized",
  getintent_conversion_name: "demo_request", // the "name" you pass to getintentTrackConversion
  getintent_personalized: true               // whether this page view was personalized
})

Empty values are left out. No personal data, IP address, company name or page copy is included.

Choose where events go

Add data-analytics-events to the script tag. The default is datalayer.

  • datalayer: pushes to window.dataLayer for Google Tag Manager. Nothing reaches GA4 until you add a tag for it.
  • gtag: also calls gtag("event", …) when gtag.js is on the page, so the events go straight to GA4.
  • segment: also calls analytics.track(…) when Segment's analytics.js is on the page.
  • off: sends nothing.
<script
  src="https://getintent.co/pixel.js"
  data-site-id="YOUR_SITE_ID"
  data-analytics-events="datalayer,gtag"
  async
></script>

Combine values with commas. If you send to GA4 through both GTM and gtag.js, pick one, or each event is counted twice.

Consent

Nothing is sent while analytics consent is denied: GetIntent reads Google Consent Mode (analytics_storage) and the GetCookies consent record. With Google Consent Mode v2 turned on (Install > Privacy & Consent), the script also waits for consent before it runs at all.

GA4 through Google Tag Manager

  1. In GTM, create a Data Layer Variable for each parameter you want, for example getintent_variant_id.
  2. Create a Custom Event trigger with the event name getintent_personalized, one for getintent_experiment_exposure and one for getintent_conversion.
  3. Create a Google Analytics: GA4 Event tag per trigger. Use the same event name and add the variables as event parameters.
  4. Publish the container and check the events in GA4 DebugView.

Report on it in GA4

  1. In GA4 Admin > Custom definitions, create event-scoped custom dimensions for getintent_variant_id, getintent_variant_name, getintent_experiment_id, getintent_experiment_arm and getintent_intent_level.
  2. Build an audience or segment of sessions that include getintent_personalized, and compare their key events with the rest.
  3. For A/B tests, break down your key event by getintent_experiment_arm (holdout vs. personalized) or getintent_variant_name. Compare sessions with getintent_experiment_exposure, not with getintent_personalized, because holdout visitors never send the latter.

GA4 only shows custom dimensions from the moment you create them, so set them up before you start a test.

Parameters

ParameterMeaning
getintent_variant_idA/B test variant served to the visitor.
getintent_variant_nameName of that variant as set in the dashboard.
getintent_experiment_idA/B test the variant belongs to.
getintent_experiment_armholdout when the visitor sees your original page as the experiment's control group, personalized otherwise.
getintent_intent_levelIntent confidence for the visit: high, medium, low or very_low. Not sent when the copy comes from the shared fast cache.
getintent_elementsNumber of page elements rewritten.
getintent_cache_sourceWhere the copy came from: session (same tab), fast (shared cache) or full (generated or loaded on the server).
getintent_conversion_nameThe name field you pass to getintentTrackConversion, or the goal name for a click or page-view goal.
getintent_personalizedOn getintent_conversion: whether the page the conversion happened on was personalized.

A/B test attribution

When a visitor enters an A/B test, the script remembers the arm for the browser session, including the holdout that keeps your original page. A later getintentTrackConversion() call on any page of the site is attributed to that arm automatically, unless you pass your own variantId.