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_conversion is sent every time you call window.getintentTrackConversion().
window.dataLayer.push({
event: "getintent_conversion",
getintent_site_id: "clx0site...",
getintent_variant_id: "clx0var...",
getintent_experiment_id: "clx0exp...",
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 towindow.dataLayerfor Google Tag Manager. Nothing reaches GA4 until you add a tag for it.gtag: also callsgtag("event", …)when gtag.js is on the page, so the events go straight to GA4.segment: also callsanalytics.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
- In GTM, create a Data Layer Variable for each parameter you want, for example
getintent_variant_id. - Create a Custom Event trigger with the event name
getintent_personalized, and one forgetintent_conversion. - Create a Google Analytics: GA4 Event tag per trigger. Use the same event name and add the variables as event parameters.
- Publish the container and check the events in GA4 DebugView.
Report on it in GA4
- In GA4 Admin > Custom definitions, create event-scoped custom dimensions for
getintent_variant_id,getintent_variant_name,getintent_experiment_idandgetintent_intent_level. - Build an audience or segment of sessions that include
getintent_personalized, and compare their key events with the rest. - For A/B tests, break down your key event by
getintent_variant_name.
GA4 only shows custom dimensions from the moment you create them, so set them up before you start a test.
Parameters
| Parameter | Meaning |
|---|---|
getintent_variant_id | A/B test variant served to the visitor. |
getintent_variant_name | Name of that variant as set in the dashboard. |
getintent_experiment_id | A/B test the variant belongs to. |
getintent_intent_level | Intent confidence for the visit: high, medium, low or very_low. Not sent when the copy comes from the shared fast cache. |
getintent_elements | Number of page elements rewritten. |
getintent_cache_source | Where the copy came from: session (same tab), fast (shared cache) or full (generated or loaded on the server). |
getintent_conversion_name | The name field you pass to getintentTrackConversion, if any. |
getintent_personalized | On getintent_conversion: whether the page the conversion happened on was personalized. |
A/B test attribution
When a visitor is served an A/B test variant, the script remembers it for the browser session. A later getintentTrackConversion() call on any page of the site is attributed to that variant automatically, unless you pass your own variantId.