Tags: analytics web-dev guide

Guide - Site Instrumentation

Date: 2026-10-30


Measurement end to end, in the order the work happens: name the decisions the numbers must support, choose the stack around them, write the plan, put facts in code and routing in the container, prove it before launch, then keep three sets — specified, fires, lands — matching for as long as anyone reads the numbers. Concepts link out; this guide does the sequence and the templates.


Site instrumentation is the work of making a site produce trustworthy measurement: deciding what to record, specifying it, implementing it across code, tag manager, consent and server, verifying it, and keeping it true as the site changes underneath it.

Conversion rate optimisation (CRO) is what most of these numbers feed. Running example: the same UK retailer as Guide - Ecommerce CRO and Guide - Running an Experiment — 120,000 sessions and 2,880 orders a month (2.40%), £62 average order value (AOV), £23.01 contribution per order, about 665 orders a week. Its measurement stack, worked through below: GA4 (Google Analytics 4) collected through GTM (Google Tag Manager), GA4’s raw export in BigQuery, and the order system as the source of truth. Storefront pages are the retailer’s own; the payment step is hosted, so checkout steps 2–3 are unobservable — the known limit already recorded in the CRO guide’s §3.

The lifecycle

STAGE               DOCUMENT                 OWNED BY                 GATE TO THE NEXT STAGE
1 Purpose           decision → metric list   analyst + decision-owner  every critical metric names its events
2 Stack             architecture decision    analyst + developer       each row decided, with a revisit trigger
3 Plan              the tracking plan        analyst                   critical-path rows complete, owners named
4 Implement         data layer + container   developer + analyst       plan rows built; pushes pass tests
5 QA                the launch checklist     analyst                   every line ticked, both consent states
6 Keep it true      the audit trail          analyst                   standing checks green; quarterly diff filed

Two starting points, one procedure. From nothing, work top to bottom. From an inherited mess, run the §6 inventory first — what actually lands — then do §1–3 properly, and the diff between the new plan and the inventory is the work list for §4. Don’t start by tidying the container; you can’t tell what’s wrong with it until you know what it’s for.

1. Decide what the measurement is for

The decisions bound the plan. Every event is a maintenance obligation, and the ones nobody decides anything with rot first. Start from the decisions, derive the metrics, and only then the events — Metric Design · North Star Metric.

For the retailer, the decisions already exist in the other guides:

DECISION                              METRIC                               EVENTS IT NEEDS                       PRECISION NEEDED
where CRO effort goes (CRO §4.3)      step conversion, loss in £ per step  view_item → begin_checkout → purchase  stable ratio, monthly
whether a test wins (EXP-041)         order conversion of exposed sessions experiment_viewed, purchase           exact per-user join
is the site earning more per visit    contribution per session (£0.552)    purchase value + items, sessions       reconciled to orders
which channel to fund                 orders + contribution by source      session source, purchase               directional only
did the release break something       funnel step rates, JavaScript errors the funnel, error events               week on week

Three things follow from the table:

  • The critical path is short. Everything in the third column — roughly the ecommerce funnel, experiment exposure, identity and errors — comes to fifteen-odd events. Those get the full treatment in §3–6. Everything else is optional and can be cheap
  • Precision differs by row, and so does where the number comes from. A test read needs an exact join; a channel read is directional however hard you try (Tool Discrepancies, Walled Garden Reporting). Over-engineering the directional rows is the common waste
  • The money metric is reconciled, not trusted. Contribution per session is computed from order-system revenue and analytics sessions; analytics revenue is checked against the order system rather than used in place of it — Revenue Metrics · Contribution Margin

2. Choose the stack and the architecture

A decision table, not a vendor survey. Each row is a choice that’s expensive to reverse; the right-hand column is what would make you revisit it.

DecisionOptionsRetailer’s choiceWhyRevisit when
Analytics toolGA4 · product analytics (PostHog, Amplitude) · self-hosted first-partyGA4Free at this volume, Ads integration, the ecommerce reports work without configurationProduct-style questions (retention, feature use) dominate — then PostHog
WarehouseNone · GA4’s BigQuery export · full warehouse-firstBigQuery export on day one, plus an orders tableThe export isn’t retroactive — what isn’t exported now doesn’t exist later. It’s also the only place reconciliation and test joins can happen — Warehouse-First AnalyticsA second data source needs joining routinely
Where the tracking decision livesHardcoded · data layer + tag manager · tag manager only · autocaptureFacts in code, routing in the containerMore than one destination (GA4, Ads, a social pixel), and only code knows when a payment succeeded — Hardcoded vs Tag-Managed TrackingOnly one destination remains
Client vs serverBrowser only · server for transactions · server container for everythingBrowser for interface events; order system → warehouse for orders; refunds sent server-to-GA4Interface facts are born in the browser, business facts in the order system — Client-Side vs Server-Side Tracking—
Server-side containerNone · server-side GTM · Google tag gatewayNone yetAt 120,000 sessions a month the infrastructure and maintenance outweigh the recovered signal — Server-Side Tag ManagementPaid social becomes a large share of spend and conversion APIs matter, or measured blocker loss grows — Server-Side Conversion APIs · Ad Blockers and Tracking Loss
Consent model — enforced by a consent management platform (CMP)Tags wait for consent · tags load and send cookieless pings while deniedTags wait for consentDefensible default under PECR (Privacy and Electronic Communications Regulations); the alternative is a legal judgement, not an analytics one — UK GDPR and PECR for AnalyticsLegal advice says otherwise
AutocaptureOff · on for exploration onlyGA4 enhanced measurement on, prunedKeep what nobody else implements; switch off anything the plan also fires deliberately, or it counts twice — Autocapture · Double Counting—

The confusing part of the Google stack, settled once: the Google tag (gtag.js) is a library that sends to Google; GTM is a container that loads anything, including that library. The retailer loads the Google tag from inside GTM and never hardcodes it as well — two copies on one measurement ID count every page view twice. The anatomy, the ID prefixes and “the same purchase three ways” are in Google Measurement Stack; container internals in Google Tag Manager; the data model and its limits in GA4; the export in BigQuery.

The architecture that results:

BROWSER                                                     SERVER

page code ── knows what happened                            order system ── truth for orders
   │  dataLayer.push({ event, … })                             │  order webhook
   ▼                                                           ▼
window.dataLayer ── one queue                               BigQuery: orders table
   │                                                           │  transaction_id, client_id,
   ▼                                                           │  goods, shipping, refunds
GTM web container                                              │
   ├─ consent: CMP sets state; every tag checks it             │  refunds ──▶ GA4, server to server
   ├─ Google tag + GA4 event tags ──▶ GA4 property ──export──▶ BigQuery: events_YYYYMMDD
   ├─ Google Ads conversion                                     │
   └─ social pixel                                              ▼
                                                    JOINS: transaction_id (order ↔ purchase event)
                                                           client_id (order ↔ browsing history)
                                                           user_id (logged-in customer)

What to notice: two independent routes for a purchase — the browser’s, which is lossy and consented, and the order system’s, which is complete — and two join keys between them. The reconciliation in §6 is the comparison of those two routes; without both keys it can’t be done.

Capacity check, one line. 120,000 sessions a month is about 3,945 a day (120,000 × 12 ÷ 365). Even at 40 events a session that’s 157,800 events a day, about 16% of the standard export’s 1M-a-day cap noted in GA4 — and only consented traffic is exported, so less in practice.

Alternatives in one line: PostHog does product analytics, flags, experiments and replay with a hardcoded SDK and no container — right where engineering owns tracking and the questions are about product use; a self-hosted first-party tool may qualify for the narrow PECR statistics exemption that GA4 almost certainly doesn’t (UK GDPR and PECR for Analytics). Adobe’s equivalent split is Adobe Analytics behind a tag manager.

3. Write the tracking plan

The plan is the contract between the person who wants the number and the person who writes the code, and it’s the reference §6 checks reality against. What a plan is and why it decays: Tracking Plans. Here, the decisions that fill it in.

Where it lives. In the repository, as a schema file, next to the code that fires it — reviewed in the same pull request as the feature. A spreadsheet drifts from the first sprint because nothing connects it to the code.

Naming — two conventions, written down. Google’s ecommerce events are inherited and keep their action–object names (view_item, begin_checkout, purchase) because every tool recognises them unmapped — Ecommerce Event Schema. The retailer’s own events are object–action, past tense, snake_case (delivery_info_viewed, experiment_viewed). The plan marks which is which, so nobody “fixes” begin_checkout — Event Taxonomy Design.

Properties carry the decisions. Few event names, rich properties: one promo_clicked with a promo_id, not an event per banner. Units in the name or fixed in the plan. Types fixed. Empty, missing and zero decided once — Events and Properties.

Global properties set once, not per event: anything a developer must remember to add is missing on a third of events. For the retailer: page type, logged-in state, internal user_id when known.

Revenue definition, decided once and matching the order system. value on purchase = goods after discounts, excluding shipping; shipping in its own field. Whatever the order system calls goods revenue — including its treatment of value added tax (VAT) — the plan copies, so a per-order comparison can come out exact. [CHECK: Google’s current guidance on whether purchase value should include shipping and tax — the plan’s definition must be stated either way, and reports read with it in mind.]

Identity, decided in the plan rather than discovered in analysis — Anonymous and Identified Users · Identity Stitching:

  • Anonymous ID — GA4’s client ID, cookie-based, so only exists for consented visitors
  • user_id — the internal customer ID, set when logged in. Never an email or anything personal — PII in Analytics
  • The checkout handoff — the client ID written onto the order before payment, so the order row can join back to the browsing that preceded it. This is the join most implementations never build

The inventory — the whole critical path on one screen:

EVENT                   SOURCE    CONVENTION   CRITICAL   DESTINATIONS          OWNER
page_view               GTM       inherited    yes        GA4                   alex
view_item_list          code      inherited    yes        GA4                   alex
view_item               code      inherited    yes        GA4, Ads, social      alex
delivery_info_viewed    code      own          yes        GA4                   alex   ← F3 diagnostic
add_to_cart             code      inherited    yes        GA4, Ads, social      alex
view_cart               code      inherited    yes        GA4                   alex
begin_checkout          code      inherited    yes        GA4, Ads, social      alex
add_shipping_info       —         inherited    —          —                     —      ← hosted step, unobservable
add_payment_info        —         inherited    —          —                     —      ← hosted step, unobservable
purchase                code      inherited    yes        GA4, Ads, social      alex
refund                  server    inherited    yes        GA4                   alex
login / sign_up         code      inherited    yes        GA4                   alex
experiment_viewed       code      own          yes        GA4                   alex
js_error                code      own          yes        GA4                   dev lead
promo_clicked           GTM       own          no         GA4                   marketing
scroll, outbound click  GA4 auto  inherited    no         GA4                   —      ← enhanced measurement

The two dashed rows are the plan doing its job: the events Google’s schema expects and this site can’t produce are recorded as unobservable, not left blank — Checkout Instrumentation Constraints.

Two rows filled in properly — the purchase that everything reconciles against, and the retailer’s own event behind finding F3:

- event: purchase
  convention: inherited          # Google ecommerce schema — exempt from object_action
  description: An order has been confirmed by the payment provider.
  trigger: >
    Once per order, on first render of the order-confirmation page, and only
    when the server has confirmed payment status = paid.
    NOT on click of "Place order". NOT on refresh, back button or a reopened
    tab. NOT for orders whose payment later fails or is cancelled.
  source: code (data layer)
  destinations: [ga4, google_ads, social_pixel]
  consent: analytics_storage for GA4; marketing category for ads tags
  owner: alex
  status: live
  properties:
    transaction_id: { type: string,  required: true,  example: "R10482", note: "order system ID; dedupe + join key" }
    value:          { type: number,  required: true,  example: 62.00,    note: "£, goods after discounts, ex shipping" }
    shipping:       { type: number,  required: true,  example: 3.95,     note: "£; 0.00 when free" }
    currency:       { type: string,  required: true,  allowed: [GBP] }
    coupon:         { type: string,  required: false, example: "WELCOME10" }
    items:          { type: array,   required: true,  note: "item_id = variant stock-keeping unit (SKU), as in the product feed; price per unit after discount; sum(price × quantity) = value" }
  checks:
    - per order, value equals order system goods total (±1p)
    - one event per transaction_id
    - none for orders with status != paid
 
- event: delivery_info_viewed
  convention: own
  description: Delivery cost or threshold information became visible.
  trigger: >
    When the delivery-cost block enters the viewport on a product page, or the
    delivery page renders. Once per page view.
  source: code
  destinations: [ga4]
  owner: alex
  status: proposed
  properties:
    location:       { type: string,  required: true,  allowed: [product_page, delivery_page, basket] }
    threshold_shown:{ type: boolean, required: true }

The NOT lines in the trigger are worth more than the description. Each one is a specific way this event has been wrong on other sites, and each becomes a line in the §5 checklist. The checks block is the bridge to §6 — the plan says how its own truth is tested.

4. Implement

Facts in code, routing in the container. The site states what happened, at the moment it became true, in a vendor-neutral shape; the container decides who hears about it and whether consent allows it. Neither knows anything about the other’s internals — The Data Layer.

4.1 The page, in load order

Order on the page is the whole trick, because the data layer is a queue that replays in order once GTM arrives:

<head>, TOP TO BOTTOM                          WHY HERE

1  create dataLayer (push, never reassign)     everything below pushes into it
2  consent default: all four signals denied    must exist before any Google tag reads state
3  page snapshot push                          page_type, logged_in, user_id if known
     — no event key; it's state, not news
4  GTM snippet                                 loads async; replays 1–3 in order
     ├ Consent Initialization: CMP loads,
     │   re-applies a stored choice
     └ Initialization: Google tag — held until
         analytics_storage is granted

<body>, AS THINGS BECOME TRUE
5  event pushes: view_item, add_to_cart …      each pushed with its data, at the moment it's true
6  visitor answers banner → consent update     held tags re-evaluate and fire

The consent default code itself is in Google Measurement Stack — copy it from there rather than from memory. Two traps:

  • window.dataLayer = [...] anywhere after GTM loads destroys the queue — the patched push is on the old array. Push, never assign
  • Page-specific keys persist in GTM’s merged model. A value from the last product page survives into the basket unless explicitly cleared — always ecommerce: null before an ecommerce push — The Data Layer

On a single-page application (SPA), route changes fire nothing on their own; the router has to push a page view on render complete, and GA4’s history-change page views must then be off — one owner per page view — The History API.

4.2 The purchase, on the success path

The one piece of code everything else reconciles against. It runs on the order-confirmation page, which the server renders only after the hosted payment provider has confirmed the order. The server also renders firstView: true the first time that order’s confirmation is shown and never again — a dedupe flag stored in the order system rather than on the device, so refreshes, back-button revisits and reopened tabs on another device don’t refire.

// Order-confirmation page. window.__order is rendered by the server
// only for orders the payment provider has confirmed.
(function () {
  const order = window.__order;
  if (!order || order.status !== 'paid') return;   // success path only — never on "Place order"
  if (!order.firstView) return;                     // refresh / back / reopen: already sent
 
  const pounds = (pence) => pence / 100;            // order system stores pence; schema wants £
 
  window.dataLayer = window.dataLayer || [];        // create-or-reuse, never reassign
  dataLayer.push({ ecommerce: null });              // GTM merges — clear the last ecommerce object
  dataLayer.push({
    event: 'purchase',
    ecommerce: {
      transaction_id: order.id,                     // order system ID: dedupe key + warehouse join
      value: pounds(order.goodsPence),              // goods after discounts, ex shipping — per the plan
      shipping: pounds(order.shippingPence),
      currency: 'GBP',
      coupon: order.discountCode || undefined,
      items: order.lines.map((line) => ({
        item_id: line.variantSku,                   // the variant, matching the product feed
        item_name: line.title,
        price: pounds(line.unitPricePence),         // per unit, after line discount
        quantity: line.quantity,
      })),
    },
  });
})();

What each annotated line prevents, in order of how often it bites on real sites:

  • status !== 'paid' — a purchase recorded for a declined card. The most expensive defect class, because it inflates conversion on exactly the path being optimised
  • pounds() — revenue 100× too high. Usually appears on one payment method only, because only that integration passes subunits
  • firstView — refresh duplicates. GA4 drops repeat transaction_ids (GA4), but the Ads and social tags on the same trigger don’t share that, so stop it at source — Idempotency and Deduplication
  • ecommerce: null — items from the last view_cart merged into the purchase
  • variantSku — the parent product ID instead of the variant breaks every join to stock and the ad feed

Consent isn’t checked here. The push is a statement of fact into a page-local queue; whether anything leaves the browser is the container’s decision. Code that gates its own pushes on consent duplicates the container’s job and drifts from it.

4.3 The container

Every tag reads the data layer; none reads the page. One trigger per event, many tags per trigger. The mapping for the critical path:

TRIGGER                       TAG                                 CONSENT REQUIRED             READS
Consent Initialization        CMP template                        —                            —
Initialization – All Pages    Google tag (GA4 config)             analytics_storage            page snapshot keys
CE purchase                   GA4 Event · purchase                analytics_storage            ecommerce.*
CE purchase                   Google Ads conversion               ad_storage + ad_user_data    ecommerce.value, transaction_id
CE purchase                   social pixel Purchase (template)    CMP marketing category       ecommerce.value, transaction_id
CE add_to_cart                GA4 Event · add_to_cart             analytics_storage            ecommerce.*
CE experiment_viewed          GA4 Event · experiment_viewed       analytics_storage            experiment_id, variant
Click – promo element         GA4 Event · promo_clicked           analytics_storage            promo_id (data attribute)

(CE = Custom Event trigger, matching the pushed event name.)

  • Consent Mode governs Google’s tags only. The social pixel needs its own consent condition from the CMP; a clean Consent Mode audit says nothing about it — Consent Management
  • Document Object Model (DOM) triggers only for the disposable. promo_clicked reads a data- attribute, not a CSS class, and nothing in a revenue report depends on it — Tag Managers
  • Register what you’ll report on. A parameter sent to GA4 is stored but only appears in the interface once registered as a custom dimension; the export has it regardless. Register experiment_id, variant, location; never register IDs or timestamps — GA4 · Cardinality
  • Names in the container follow the plan’s names, so a search for purchase finds the trigger, the tags and the plan row together — Google Tag Manager for naming and versions

The sequence, not the law — the law is UK GDPR and PECR for Analytics, the mechanism Consent Management:

  1. Default denied, before anything loads — §4.1 step 2. Tags that fire on load and stop on rejection have already breached
  2. The CMP restores a stored choice in Consent Initialization, before any other trigger
  3. On a choice, the CMP sends the update and pushes an event; held tags re-evaluate. [CHECK: whether a tag held by an additional consent requirement fires automatically when consent is granted later on the same page, or needs a trigger on the CMP’s update event — confirm in preview mode on this container]
  4. Withdrawal works — revisiting the banner and declining stops tags on the next page and clears analytics cookies where the CMP supports it
  5. The banner change is annotated, because launching or changing one is a step change in measured traffic that reads as a collapse otherwise — Annotation and Change Logs

What it does to every number below: GA4 sees the consenting population only, and that population isn’t a random sample — it differs by device, channel and probably intent. Rates inside GA4 are rates of consenters; counts need scaling against the order system, never presenting as totals.

4.5 Server-side events

Business facts from the system of record, joined back to browsing by the identifiers chosen in §3:

  • Orders → warehouse. The order webhook writes every order to a BigQuery orders table: transaction_id, timestamps (Coordinated Universal Time, plus a London-time date for reporting — Timezones and Date Boundaries), goods, shipping, discount, payment status, user_id, and the client ID captured at the handoff when one exists. Complete regardless of consent or blockers, so it’s the denominator for every reconciliation
  • Refunds → GA4, server to server via the Measurement Protocol, so GA4 revenue goes down as well as up. It needs the order’s client ID and the stream’s application programming interface (API) secret, so it only works for orders captured with consent — which are exactly the orders GA4 counted. The secret lives on the server, never in page code — Google Measurement Stack · Offline Conversion Imports
  • Purchase is not also sent server-to-GA4. That would double-count every consented order and send unconsented ones — Double Counting

Server-side is not a consent route. An event carrying a cookie-derived identifier depends on the cookie, whichever machine sends it — Client-Side vs Server-Side Tracking.

4.6 Identity

  • On login and sign-up, the page snapshot carries user_id; GA4 picks it up through the Google tag’s configuration — GA4
  • At begin_checkout, the storefront writes the GA4 client ID onto the basket so it survives the hosted payment step and arrives on the order webhook. Without it, the order row can’t be joined to the sessions that led to it, and every pre-purchase path analysis orphans its conversions — Identity Stitching
  • No probabilistic stitching. Deterministic joins only (login, order, the handoff); the rest stays anonymous and is reported as such

4.7 Experiment exposure

The code that renders the variant fires the exposure, because only it knows which arm was shown and when it became visible — Experiment Assignment Tracking.

For EXP-041 (delivery cost on product pages), from Guide - Running an Experiment: experiment_viewed with experiment_id: 'EXP-041' and variant, pushed when the price block — either version — first renders on a product page, once per session per experiment. Both arms push through the same code path. The checks that matter:

  • Exposed counts per arm close to equal, and both well below assigned counts — 72,000 exposed sessions a month against 120,000 total, not 120,000. If exposed equals assigned, exposure isn’t really being tracked
  • Declined consent is symmetric — declined visitors are assigned and unmeasured in both arms. A consent interaction that differs by arm presents as Sample Ratio Mismatch
  • The analysis joins in the warehouse, exposure to orders by client ID, not in GA4’s interface

5. QA before launch

Three questions, three tools — check them in order — Instrumentation Debugging:

QUESTION              TOOL                                       WHAT PASSES
1 Did it fire?        console: dataLayer · GTM preview           push present, payload matches the plan row
                                                                 field by field; the right tags fired, others didn't
2 Did it leave?       DevTools Network, filter /g/collect        one request per event, 2xx, payload values correct;
                      (Preserve log on for the confirmation)     zero requests with consent denied
3 Did it land?        GA4 DebugView, then BigQuery next day      present, parameters intact; in the export with
                                                                 the same transaction_id and value

Most wasted debugging is answering question 3 while believing you answered question 1. A tag firing with the wrong value is commoner than a tag not firing, so read the payload, not the tag name.

The consent × browser matrix. Every cell on the purchase path:

                         Chrome desktop   Safari iOS (real device)   Firefox + blocker
no choice yet            nothing sent     nothing sent               nothing sent
accept all               all tags         all tags                   GA4 likely blocked ← record, don't fix
analytics only           GA4 only         GA4 only                   —
reject all               nothing sent     nothing sent               nothing sent
accept, then withdraw    stops next page  stops next page            —

The failure paths — the rows the plan’s NOT lines predicted:

  • Declined card, then a successful retry → one purchase
  • Refresh, back button, reopen confirmation in a new tab → no further purchase
  • Two genuine orders in five minutes → two purchases (dedupe on transaction_id, never on user + time)
  • Discount code → item prices sum to value
  • Free-delivery order → shipping: 0, not missing
  • Logged-out checkout → client ID still on the order

Duplicates across the whole site, not just purchase: view source and the container for a second copy of the Google tag — theme and platform plugins are the usual source — and switch off any enhanced-measurement event the plan fires deliberately.

The launch checklist, filled in for the retailer’s rebuild:

INSTRUMENTATION LAUNCH CHECK        release 2026-11-xx            ☐ = not yet

PLAN
☐ every critical-path row built, or marked unobservable with a reason
☐ owners named on every row; plan merged in the same pull request as the code

PAGE
☐ load order: dataLayer → consent default → snapshot → GTM
☐ exactly one Google tag per measurement ID (view source + container)
☐ no reassignment of window.dataLayer anywhere (search the codebase)
☐ ecommerce: null before every ecommerce push

PURCHASE
☐ fires only when status = paid, once per order (refresh, back, reopen)
☐ value in £, matches order goods total to the penny on 3 test orders
☐ items sum to value with a discount applied
☐ transaction_id = order system ID; client ID present on the order row

CONSENT
☐ nothing leaves the browser before a choice (Network tab, cold load)
☐ every non-Google tag has its own consent condition
☐ every cell of the consent × browser matrix on the purchase path

ENVIRONMENT
☐ staging uses its own container environment and GA4 stream; test orders flagged
☐ internal traffic and test orders excluded from GA4 and the orders table
☐ export to BigQuery on and landing; orders table filling from the webhook

AFTER LAUNCH
☐ day 1: events in DebugView and the export; reconciliation run once
☐ day 7: first weekly reconciliation inside tolerance (§6)
☐ annotation written: release, container version, consent change if any

Internal-traffic filters break silently; check they still match — Bot and Internal Traffic. For an A/B test’s own launch check, the instrumentation lines above are prerequisites, not substitutes — Guide - Running an Experiment §2.

6. Keep it true

Instrumentation decays by default: every release, redesign, new tag and platform update is a chance to break an event silently, and broken tracking rarely errors — it just produces plausible wrong numbers. The condensed gate in Guide - Ecommerce CRO §3 is the minimum a CRO person runs before trusting anything; this is the owner’s version that keeps that gate passing.

The three sets

Three sets have to match: what’s specified (the plan), what fires (in the browser), and what lands (in the destination). Every defect is a gap between two of them:

SPECIFIED   FIRES   LANDS   DIAGNOSIS                       EXAMPLE
    ✓         ✗       ✗     build gap — never implemented   delivery_info_viewed (status: proposed)
    ✓         ✓       ✗     lost in transit / rejected      consent, blocker, malformed payload
    ✓         ✓       ≠     fires wrong                     value in pence; wrong trigger
    ✗         ✓       ✓     unowned event                   a tag added in the container last month
    ✓         ✗       ✓     ghost — lands from elsewhere    a plugin's hardcoded copy still sending

Decide which set is the reference before diffing. Usually the plan — but an inherited plan two years stale may be less right than what fires, in which case the first job is updating the plan.

What lands, inventoried from the export — every distinct event name over 30+ days with its first and last appearance and its plan status:

event_name             first_seen   last_seen    events (30d)   in plan
page_view              2025-03-02   2026-10-29        268,400   ✓
view_item              2025-03-02   2026-10-29        141,900   ✓
add_to_cart            2025-03-02   2026-10-29         19,800   ✓
purchase               2025-03-02   2026-10-29          2,170   ✓
experiment_viewed      2026-10-07   2026-10-29         41,300   ✓
select_promotion       2025-03-02   2026-10-08            960   ✗   ← stopped 3 weeks ago: dates the break
Purchase               2026-09-14   2026-10-29             41   ✗   ← capital P: a second implementation
form_start             2025-03-02   2026-10-29          7,200   ✗   ← enhanced measurement; plan or switch off

What to notice: last_seen dates an incident for free, and a near-duplicate name — Purchase beside purchase — is a second implementation counting the same orders under a name most queries will miss. Neither shows up in any report.

Standing checks

Run automatically where possible, in the warehouse, with a written tolerance — Data Quality Monitoring · Alerting on Metrics:

CheckHowToleranceFrequencyOn failure
Order completenessWebhook orders table vs the order system’s own count±1%, after documented exclusions (test orders, timezone)DailyBlock reporting
Purchase coverageGA4 purchases ÷ ordersExpected band — worked belowWeeklyInvestigate
Value per orderJoin GA4 purchases to orders on transaction_id; compare valueZero orders off by more than 1pDailyBlock
DuplicatesPurchase events vs distinct transaction_id in the exportZeroDailyInvestigate
Purchase on non-paid orderstransaction_ids in GA4 with order status ≠ paidZeroWeeklyBlock
Property driftNull rate and type per required property, critical pathNull rate within 2 points of last month; one typeWeeklyWarn
CardinalityDistinct values per registered dimensionNo steady climbMonthlyWarn — Cardinality
Personal dataPattern scan for emails, postcodes, phone numbers in page addresses (URLs) and string parametersZeroWeeklyIncident — PII in Analytics
Stitch rateShare of orders with a client ID that matches an export userNear purchase coverageMonthlyInvestigate the handoff
FreshnessLatest export table and latest order rowYesterday’s present by mid-morningDailyBlock

[CHECK: whether GA4’s BigQuery export keeps repeat purchase events that the GA4 interface deduplicates on transaction_id — if it does, the duplicates check runs in the export; if not, run it in the browser against the Network log.]

Stale is better than wrong. A blocked dashboard with a “data as of yesterday” stamp is recoverable; a wrong number gets acted on.

The purchase-coverage band, worked

Purchase coverage is the share of real orders that GA4 records. It isn’t 100% and shouldn’t be — consent and blockers remove a share — so the check is that it’s stable, not that it’s complete. A coverage of exactly 100% is the suspicious result: duplicates or an unknown filter.

The expected level, from what the retailer already knows:

consent coverage (CMP log)      mobile 71%   desktop 84%        ← CRO §3's known limit
orders by device                mobile 60%   desktop 40%        ← from the order system

consented share of orders     = 0.60 × 71%  +  0.40 × 84%
                              = 42.6%       +  33.6%            = 76.2%

blocker loss among consenters   1.6%                            ← measured once: Network log
                                                                  sample vs orders
expected coverage             = 76.2% × (1 − 0.016)  =  76.2% × 0.984  =  75.0%

This assumes buyers consent at the same rate as all visitors on their device — a reasonable first guess, and the observed coverage will correct it within a month.

How wide the band should be depends on how many orders it’s measured over. Treat each order as a coin-flip that GA4 records with probability p = 0.75. The standard error — the typical size of a chance wobble in the measured share — is √(p × (1 − p) ÷ n):

                 n (orders)   p × (1 − p) ÷ n             √ → standard error   95% band (± 1.96 × SE)
weekly             665        0.1875 ÷ 665  = 0.000282    0.0168 → 1.7 points   ± 3.3 points → 71.7–78.3%
monthly          2,880        0.1875 ÷ 2,880 = 0.0000651  0.0081 → 0.8 points   ± 1.6 points → 73.4–76.6%

In plain terms: at one week’s volume, coverage bouncing between 72% and 78% is just the luck of which customers happened to accept cookies that week. At a month’s volume, anything outside roughly 73–77% is a real change worth investigating.

The counterintuitive part: a weekly drop from 75% to 72% feels like a three-point problem and is within noise; the same drop over a month is twice the band’s half-width and almost certainly real. Alert weekly only outside the weekly band, and read the monthly figure for drift. A sudden move — 75% to 38%, or to 150% — is never noise: a broken tag, a consent change or a double-fire.

What the band doesn’t catch: a defect that moves coverage slowly — a slowly rising duplicate rate, or a growing share of Safari traffic losing the client ID. That’s why the value-per-order and duplicate checks run alongside it rather than being replaced by it.

Schema enforcement

GA4 accepts anything — malformed events land and look like data. So enforcement happens either side of it — Schema Enforcement:

  • Before collection: continuous integration (CI). End-to-end tests on the purchase path capture dataLayer pushes and validate them against the plan’s schema. A missing transaction_id or a value in pence fails the build, not the report. Catches new violations in code; can’t see container changes
  • After collection: the warehouse. The standing checks above, as scheduled queries. Catches everything that landed, including events the codebase never knew about
  • Quarantine needs a server. Validating and holding malformed events before they reach GA4 requires a server-side container; one more entry in §2’s “revisit when”

Change control

Two things change measurement and they’re versioned separately — a site release and a container publish — so a broken number has two candidate causes with two change logs. Make them one log:

  • Site releases: any change touching a data-layer push updates the plan in the same pull request; the CI schema test runs on it — Code Review
  • Container: named publishers only (two, not the whole marketing team); every publish has a version name and a note linking the plan row it implements; preview before publish; the last version is the rollback. No Custom HTML tag without review — it can do anything a script can — Google Tag Manager
  • Every tag has an owner and a review date; unowned tags are removed at the quarterly audit — Tag Managers · Third-Party Scripts
  • Every change is annotated where the people reading dashboards will see it — Annotation and Change Logs

Cadence

Matching the CRO guide’s gate: quarterly on the critical path, and immediately after a replatform, a checkout change, a consent banner change, a major redesign, a new destination, or any container change made outside the process. The quarterly audit is: inventory what lands, diff against the plan, run the purchase path by hand through the consent matrix, review owners and unowned tags, file the entry.

The audit trail — one entry per audit or incident, appended, never edited:

AUDIT   2026-Q4                     2026-10-29         run by: alex
Trigger         scheduled quarterly
Reference set   plan @ commit 4e1c9a (2026-10-07)
Container       version 87 live

DIFF
specified ✓ fires ✗   delivery_info_viewed — status proposed; EXP-041 diagnostic
                      relying on a GTM visibility trigger meanwhile    → build, sprint 46
specified ✗ lands ✓   Purchase (capital P) — 41 events since 2026-09-14; plugin
                      added with the reviews widget                     → remove; exclude from history
fires ✓ lands ✗       select_promotion — last_seen 2026-10-08; promo template
                      renamed its data attribute                        → fix trigger; annotate gap
fires ≠               none on the critical path

STANDING CHECKS (last 4 weeks)
order completeness    99.8–100%            ✓
purchase coverage     74.1 · 75.6 · 73.9 · 75.2%   ✓ inside weekly band (71.7–78.3)
value per order       0 mismatches         ✓
duplicates            0                    ✓
personal data         1 hit: email in ?ref= on a newsletter link   → incident logged, link fixed,
                                                                     parameter stripped in GA4
stitch rate           71%  vs coverage 75%  → 4 points lost at the handoff: logged-out
                                              checkout not writing client ID — fix

KNOWN LIMITS (unchanged)
checkout steps 2–3 unobservable (hosted payment)
consent coverage 71% mobile / 84% desktop

NEXT    2027-Q1, or on the next trigger above

The stitch-rate line is worth reading as arithmetic: 4 points of 665 weekly orders is about 27 orders a week (665 × 0.04 = 26.6) whose browsing history can’t be joined — invisible in any report, and fatal to any analysis of the paths that led to purchase.

When a specific number looks wrong rather than the whole setup, go symptom-first: the symptom list and Guide - Diagnosing a Metric Movement.

How instrumentation fails

  • No decisions behind it — two hundred events and no reconciled revenue
  • Tracking the click instead of the outcome — phantom purchases on declined cards
  • Two copies of the Google tag — page views doubled, engagement metrics drifting with no behaviour change
  • Consent banner that records a choice while tags fire anyway — a documented breach rather than an undocumented one
  • Counts read as totals — consented GA4 figures presented as the business, rather than scaled against orders
  • No join key at the checkout handoff — the order exists, the path to it doesn’t
  • Plan in a spreadsheet — accurate for one sprint
  • Container open to everyone — unowned tags, Custom HTML nobody reviewed, a publish with no note the week a number moved
  • Reconciliation never run — duplicates survive because they make the numbers look better — Double Counting
  • A zero-tolerance check — fails on penny rounding in week one, gets muted, misses the real break in month four

The short version

  1. Decisions first. List them, derive the metrics, and the events those need — the critical path is about fifteen events
  2. Choose the stack by decision row: facts in code, routing in the container; BigQuery export on day one; orders from the order system; consent before anything fires; one copy of each tag
  3. Write the plan in the repo, with triggers that say what doesn’t fire it, units in the definition, identity decided, unobservable steps recorded
  4. Implement in load order: data layer → consent default → snapshot → container → pushes at the moment the fact is true. Purchase only on confirmed payment, once, in pounds, with the order ID
  5. QA fired, left, landed — in that order, through every consent state and the failure paths, against a written checklist
  6. Keep three sets matching: inventory what lands, diff against the plan, standing checks with written tolerances in the warehouse, change control on the container, quarterly and after every trigger
  7. Coverage stable, not complete — 75% of orders in GA4, ± 3.3 points a week and ± 1.6 a month for this retailer

Related: Guide - Ecommerce CRO for the condensed gate and what the numbers are used for · Guide - Running an Experiment for the test that depends on exposure tracking · Guide - Diagnosing a Metric Movement for when one number moves · Analytics MOC for the full domain.