# Tracking rebuilt so every enrolment counts once

> Analytics showed two thirds of what the payment system knew, and nobody could say which third was missing. We rebuilt the tracking in Google Tag Manager and Google Analytics from the data layer up, with consent handled properly and every event tested.

Project on Variable Frog. Page: https://variablefrog.com/work/tracking-rebuild

- Client: An online education company
- Industry: Education
- Service: Foundation
- Stack: Google Tag Manager, Google Analytics, BigQuery
- What we built: Data layer, web and server side tracking
- Outcome: 43% more enrolments tracked
- Headline number: +43% enrolments tracked

## In short

- The problem: 212 tags from four agencies, and analytics recording only 68% of what the payment system knew.
- What we built: A measurement plan, one data layer, rebuilt web and server side containers in Google Tag Manager, and tests on every release.
- The result: 97% of paid enrolments recorded in analytics, against 68% on the old tags, with 171 fewer tags on the page.

Chart: Share of paid enrolments that analytics also recorded: sites on the new tracking against sites on the old tags.

Share of paid enrolments recorded in analytics over 10 weeks: sites on the new tracking rise from 68% to 97% while sites on the old tags stay near 68%.

### At a glance

- Challenge: **212** Tags in one container, added over six years by four agencies. Nobody knew which still mattered, so nobody dared remove one.
- Approach: **34** Events in a written data layer specification, each with its trigger, its parameters and an automated test.
- Result: **+43%** Paid enrolments that analytics also records, against sites still on the old tags.

An online education company sold courses through twelve country sites. Its marketing ran on what Google Analytics reported, and Google Analytics disagreed with the payment system by a third.

## The problem

The container had grown the way containers do. Each agency added its tags and left the old ones in place. Some conversions fired twice, some never, and some only when a visitor happened to pass through a page that still carried a 2019 script (An audit found 212 tags, of which 61 fired on every page and 48 sent data to accounts nobody could log in to.).

Consent made it worse. The banner blocked some tags and not others, in ways that differed by country, so the numbers were incomplete and the setup was not properly compliant either.

## What we built

A clean setup, written down before it was built. First a measurement plan: the questions the business asks, the events that answer them and the parameters each one carries. Then one data layer that the sites push to, a Tag Manager container built only from that data layer, and server side tagging so a purchase is confirmed by the payment system and not by whether a browser finished loading a thank you page. Consent mode is wired in per country, so each visitor's choice is respected and the gaps it leaves are modelled, not guessed.

### From a click to a number you can trust

The sites, the payment system and the consent banner feed a data layer, a Tag Manager container and a server side endpoint, which send tested events to Google Analytics, the ad platforms and the warehouse.

- On the sites: Data layer (34 events with named parameters, pushed the same way on all twelve sites.); Consent (Each visitor's choice, read by every tag, set up for each country's rules.); Payment system (Confirmed enrolments sent from the server, so a closed tab loses nothing.)
- Tag Manager: Web container (Rebuilt from zero: 41 tags where there were 212, each one named and documented.); Server container (Events checked, enriched and sent on from a first party endpoint.); Tests (Every release replays the key journeys and fails if an event is missing or doubled.)
- Where it goes: Google Analytics (One property with clean events, key events and audiences that match the plan.); Ad platforms (Conversions sent through their APIs, deduplicated, with consent respected.); Warehouse (The raw event export in BigQuery, joined to payments for the daily check.)

Six of the twelve country sites moved to the new tracking first, chosen at random. The other six kept the old container for ten weeks, and both were checked every day against the payment system.

## The result

On the new tracking, analytics records 97% of paid enrolments, against 68% on the old tags. The 3% that remain are visitors who declined measurement, which is the correct answer.

With conversions it could see, bidding in the ad platforms improved without a change in budget. Pages also load faster, because 171 tags are gone.

## What they own now

### Theirs to keep

The containers, the specification and the tests are theirs, with a change process that keeps the setup clean after we leave.

- **The measurement plan**: Questions, events and parameters, agreed and written down.
- **The data layer spec**: 34 events, the contract between site and tags.
- **The containers**: Web and server side, named and documented.
- **The tests**: Key journeys replayed on every release.
- **The daily check**: Analytics against payments, with an alert on drift.

### How it was measured

Each day, paid enrolments in the payment system were matched to purchase events in analytics. Six of twelve sites moved to the new tracking first, chosen at random, and six stayed on the old tags for ten weeks.

- Sites: 6 moved first, 6 stayed
- Period: 10 weeks
- Measure: Share of paid enrolments recorded in analytics
- Tags: From 212 to 41

