Sub topic 3
Testing and debugging your tracking
This chapter assumes you have GA4 installed with a measurement ID, can open your browser's developer tools, and can read a UTM-tagged URL.
Testing and debugging your tracking
Check each event before you trust a report. Turn on GA4's debug mode, then open Admin, then DebugView to see events arrive within seconds. In the browser, the gtag.js library pushes events onto window.dataLayer, so you can inspect them in the console:
// Paste into the browser console on the page under test
console.table(window.dataLayer);Look for duplicate sign_up events, missing form_id values, and events that fire on page load when they should fire on submit.
Attribution and channel grouping
Attribution is the rule that assigns credit for a conversion to earlier touchpoints. GA4 uses data-driven attribution for conversion credit by default. Channel grouping sorts visits into buckets such as Organic Social and Paid Social based on source, medium, and referrer. A link tagged utm_medium=paid_social lands in Paid Social. An untagged visit from a social site usually lands in Organic Social.
Reporting on social media performance
Open the Traffic acquisition report, compare sessions, key events, and conversion rate by source and medium, and use the same date range for each channel.
Ad platform pixels and click IDs
A pixel is a small tracking script that an ad platform places on your site. Ad platforms also add a click ID to the landing URL, such as gclid, fbclid, or ttclid. The platform uses the ID to match a click to a later conversion. Each platform applies its own attribution window, so its counts differ from GA4.
Server-side measurement and first-party data
Server-side measurement sends events from your server instead of the visitor's browser. Ad blockers and browser restrictions affect it less. Data stored under your own domain is first-party data. Server-side setup costs more engineering work, and it still needs visitor consent.
Why the numbers never match: limits of tracking
Platforms count views and clicks differently, use different attribution windows, and deduplicate conversions in their own ways. Ad blockers, consent refusals, and closed tabs create data gaps. Judge trends across reports rather than expecting identical totals.
Exercise
Exercise
A purchase event fires twice during one checkout. Name one browser check that reveals this, and one reason the GA4 count can still differ from the ad platform count.
Show answer
Inspect window.dataLayer in the console, or watch DebugView for two purchase events from one session. The ad platform may count view-through conversions or use a different attribution window, so its count differs from GA4.