Sub topic 9
Testing and Debugging Your Tracking
This chapter assumes you know basic HTML, JavaScript, URLs, and query strings. You also need a GA4 property, at least one event, and access to the website code or tag manager. The goal is to prove that a social visit creates the correct session, event, and conversion data.
Test one complete journey
Test the path a real visitor follows:
- Click a tagged social link.
- Confirm that the landing page keeps the UTM parameters.
- Perform the target action, such as submitting a sign-up form.
- Check that the event fires once.
- Confirm that GA4 receives the event.
- Confirm that the event appears as a key event when appropriate.
Use a fresh private browser window for each test. This reduces interference from old cookies, cached pages, previous sessions, and browser extensions.
Add a test value to the campaign name, such as debug_signup_2026. This makes your session easier to find without mixing it with real campaign traffic.
Use the right debugging tool
GA4 DebugView shows events from devices that have debug mode enabled. It helps you inspect event names and parameters shortly after they are sent. Realtime reports also show recent traffic, but they provide less detail.
If you use Google Tag Manager, open Preview mode before loading the page. The preview panel shows which triggers fired, which tags ran, and the values available in the data layer.
Your browser's developer tools provide another view. In the Network panel, filter for requests containing collect. Inspect the request payload and check the event name, measurement ID, and parameters. In the Console, inspect the data layer:
window.dataLayer = window.dataLayer || [];
console.table(window.dataLayer);This command does not repair tracking. It shows whether your page or tag manager pushed the expected objects.
Validate names and parameters
Event names and parameter names are case-sensitive. If your report expects generate_lead, an event named generateLead is a different event. Use a small tracking contract before implementation.
| Item | Example | Check |
|---|---|---|
| Event name | `generate_lead` | Uses the agreed spelling |
| Parameter | `form_id` | Has a stable value |
| Source | `instagram` | Matches the UTM convention |
| Key event | `generate_lead` | Marked in GA4 when it represents success |
Check that an event fires only after the intended action succeeds. A button-click event can overcount when a form fails validation. For purchases, send the event after the payment confirmation, not when the checkout button is pressed.
Find common failures
- No event appears: check that the script loaded, the trigger ran, and consent allowed analytics storage.
- The event appears twice: inspect duplicate GA4 tags, repeated listeners, and both hard-coded code and tag-manager implementations.
- UTMs disappear: check redirects, link builders, and code that changes the URL before your storage script runs.
- The source is “direct”: confirm that the first landing request included UTMs and that redirects preserved them.
- Parameters are missing: inspect the request payload and verify that the data layer object exists before the tag fires.
- DebugView is empty: confirm the correct measurement ID and enable debug mode for the test device.
Understand why reports differ
A social platform may count an ad click or view using its own attribution window. GA4 may count a session, apply a different channel rule, or receive no data because of consent settings and browser restrictions. These systems answer different questions.
Compare trends and agreed conversion definitions rather than expecting identical totals. First verify that the same event, date range, timezone, and conversion window are being compared.
Exercise
A form submission appears twice in GA4. What should you inspect first?
Show answer
Check for duplicate event listeners, a hard-coded GA4 event plus a tag-manager event, and a trigger that fires more than once. Then submit the form once in a fresh test session and verify the network requests.