Web Analytics with Google Analytics 4Tagging with a tag manager · Lesson 9 of 20

QA, debugging and release discipline

Article · 10 min · 8 min lecture

Video lecture

QA, debugging and release discipline

15 chapters · about 8 min · full transcript

Coming soon

Chapter 1 of 15

QA and debugging

  • Assume it's broken
  • The debugging toolkit
  • A step-by-step QA script
  • Common bugs
  • Reconciliation and monitoring

The narrated lecture is in production

Every chapter is scripted and ready. Browse the chapters and read the full transcript now — the video will appear here when it’s published.

Chapters

Why QA is the analyst's job

Bad data is worse than no data because people act on it. Every tracking change should pass a repeatable QA process before and after release. Assume every implementation is broken until proven otherwise.

The debugging toolkit

ToolUse it to
Tag manager preview mode (Tag Assistant)See which tags fired on each action, which did not, and the variable values at that moment
GA4 DebugViewSee events arriving in GA4 from debug-enabled devices, with parameters and user properties
GA4 Realtime reportSanity-check that production events are arriving at all
Browser developer tools (Network tab)Inspect requests to the GA4 collection endpoint and their parameters
Staging environmentTest changes without polluting production data

DebugView data is excluded from standard reports when you use the developer traffic filter, so you can test on production without distortion if needed.

A step-by-step QA script

For each event in the tracking plan:

1. Trigger:     Perform the action exactly as a user would (and the failure path).
2. Tag fired?   Preview mode shows the tag fired ONCE on the correct trigger.
3. Values:      Variables resolved to expected values (no "undefined", no PII).
4. Arrived?     DebugView shows the event with correct name and parameters.
5. Consent:     Repeat with consent denied - tag behavior matches consent design.
6. Devices:     Repeat on mobile and at least one other browser.
7. Reports:     24-48 hours later, confirm data in standard reports/explorations.
8. Document:    Mark row "verified" in the tracking plan with date and tester.

The most common bugs and how to spot them

SymptomLikely causeWhere to look
Page views doubledHard-coded tag plus tag manager; SPA double firingNetwork tab, preview mode
Key event count far above backend countTrigger on click/attempt; confirmation page reloadsTrigger config, transaction_id
Parameters show "(not set)"Variable undefined at fire time; not registered as custom dimensionPreview mode variables; custom definitions
Revenue in wrong magnitudeCurrency missing; value sent in minor units (cents/paisa)DebugView parameters
Paid traffic shows as referral or directUTMs stripped by redirects; unwanted referrals missingLanding URLs, redirect chains
Sudden drop to zeroContainer not published, consent banner blocking, site release removed snippetRealtime, page source

Reconciliation: how close is close enough?

GA4 key events will rarely match your backend exactly. Consent choices, ad blockers, network failures and browser restrictions all remove some hits. Establish a reconciliation routine: compare weekly GA4 purchases with orders from your system. Define an acceptable variance for your context, investigate when it widens suddenly, and explain the gap to stakeholders rather than hiding it. A stable gap is manageable; a changing gap signals breakage.

Monitoring after release

QA does not end at publish. Set up:

  • Custom insights / alerts in GA4 for sudden drops in key events or sessions.
  • A weekly smoke test of top journeys (for example: view product, add to cart, begin checkout).
  • Release coordination: developers notify analytics before front-end deployments; analytics re-runs the QA script afterwards.

Worked example: the missing Saudi orders

An e-commerce brand selling across the GCC notices GA4 purchases from Saudi Arabia dropped sharply while backend orders were steady. QA steps:

  1. Realtime shows purchases from other countries — the tag works in general.
  2. Preview mode on the Saudi storefront reveals the purchase tag does not fire: a new local payment method redirects to a different confirmation URL not matched by the trigger.
  3. Fix: move the trigger to a data layer purchase push from the order-confirmation logic, independent of URL.
  4. Add the new payment method to the QA script and unwanted referrals list.

The lesson: URL-based triggers break whenever the journey changes. Event-based triggers from the order logic are resilient.

Hands-on: automated monitoring with the BigQuery export

The interface shows problems late. With the BigQuery export (module 7) you can run a daily health query and alert on anomalies:

-- Daily tracking health for the last 14 days
SELECT
  event_date,
  COUNTIF(event_name = 'page_view')                                        AS page_views,
  COUNTIF(event_name = 'purchase')                                         AS purchases,
  COUNT(DISTINCT IF(event_name = 'purchase', ecommerce.transaction_id, NULL)) AS unique_orders,
  COUNTIF(event_name = 'purchase' AND ecommerce.transaction_id IS NULL)    AS purchases_missing_id,
  COUNTIF(event_name = 'purchase'
          AND (SELECT value.string_value FROM UNNEST(event_params) WHERE key = 'currency') IS NULL)
                                                                           AS purchases_missing_currency,
  COUNTIF(event_name = 'purchase' AND ecommerce.purchase_revenue IS NULL)  AS purchases_missing_revenue
FROM `my-project.analytics_123456789.events_*`
WHERE _TABLE_SUFFIX BETWEEN FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 14 DAY))
                        AND FORMAT_DATE('%Y%m%d', DATE_SUB(CURRENT_DATE(), INTERVAL 1 DAY))
GROUP BY event_date
ORDER BY event_date;

Watch for: purchases greater than unique_orders (duplicates), any missing ids, currencies or revenue, and sudden drops in page views on one day (a release or consent change). Schedule it as a BigQuery scheduled query and send results to a sheet or chat alert.

Custom insights and annotations

In the GA4 interface, create custom insights (alerts) for sudden drops in key events or sessions, and add an annotation or change-log entry whenever tracking changes so future analysts can see when data behavior changed.

Second worked example: a UK subscription box

A Bristol subscription company's weekly reconciliation shows GA4 purchases about 12% below orders (illustrative) for months, which the team accepts as consent and ad-blocker loss. One week the gap jumps sharply. The health query shows purchases_missing_id rising after a checkout update: a new payment step sent purchase without transaction_id, so duplicates and missing values appeared at once. The developer restored the field; the gap returned to its usual level within a day. A stable gap was fine; a changing gap was the signal.

Common mistakes

  • Testing only the happy path and never the failure path.
  • Testing only on desktop Chrome with an ad blocker disabled.
  • Declaring success because "Realtime shows something".
  • Not re-testing after site releases.
  • Chasing a perfect match with backend data instead of a stable, explained variance.

Release checklist

Key takeaways

  • Assume tracking is broken until a repeatable QA script proves otherwise.
  • Use preview mode for tags, DebugView for arrival, Realtime for sanity, reports for final confirmation.
  • Expect a stable gap between GA4 and backend data; investigate when it changes.
  • Re-test after every site release and monitor with alerts.

Check your understanding

Quick questions to lock in the lesson. They don’t count towards your certificate.

  1. Which tool shows whether a specific tag fired and what the variables resolved to at that moment?
  2. GA4 purchases are consistently a few percent below backend orders, and the gap has been stable for months. What is the best response?
  3. Revenue in GA4 appears 100 times higher than expected. What is the likely cause?

Put it into practice

Write a QA script for three events on a site you know, run it in preview mode (or describe how you would), and record results in a tracking-plan status column.

Enrol for free to save your progress

Reading is always free. Enrol to keep your place, take the final assessment and earn a verifiable certificate.