AI Global Academy Join the waitlist

Courses / Analytics and measurement

Lesson 6.9 · 45 minTracking quality check

Duration~45 min in the lesson + ~25 min homework
PrerequisitesCheckpoint lesson-6.8; the browser connection from 1.6
Checkpointlesson-6.9

What you will have

The student has run a repeatable test routine over the whole tracking setup, recorded the results in docs/tracking-qa.md, and shown that for a test batch of consented submissions the number of generate_lead events in GA4 equals the number of new leads in the CRM.

Video

The video for this lesson is not recorded yet.

Prompts used in this lesson

Part 3 — Claude runs the batch

Prompt to Claude
Purpose: before spending money on ads I need proof that our tracking counts leads
correctly. Run a test batch on the live site and record the results.

Context: read docs/measurement-plan.md for the events, parameters, consent rules and
attribution rules. Use the browser connection. The live site is <your-domain>. GTM
forwards cta_click, form_start, form_submit and generate_lead to GA4 only when
analytics consent is granted. /api/leads stores leads in the leads table.

Do this:
A. Consented batch: 5 separate visits, each starting with empty cookies and storage.
   Each visit: open the site with its own test link
   (?utm_source=qa&utm_medium=test&utm_campaign=batch-1 ... batch-5), press
   "Accept all", click one call-to-action, fill the form with clearly fake data
   (name "QA Batch <n>", an address at example.com), submit once, wait for
   /thank-you, then reload /thank-you once.
   For each visit record: the events pushed to window.dataLayer in order; the
   requests sent to Google Analytics and which event each carried; whether the lead
   row exists in the database with the expected utm_campaign.
B. Rejected run: 1 visit with empty storage, link ?utm_source=qa&utm_medium=test
   &utm_campaign=rejected-1, press "Reject all", do the same steps and submit.
   Record: the data layer events; that zero requests went to Google Analytics or
   Clarity; the full list of cookies and storage entries at the end; that the lead
   row exists.
C. Counts: number of QA leads created in the database since <start time>, split
   into batch and rejected.

Done looks like: a file docs/tracking-qa.md with the date and time, the site
address, a table of checks (check, expected, actual, pass or fail), the per-visit
records, the counts, and a list of anything that failed or that you could not check.
Leave a clearly marked blank line "GA4 generate_lead count (entered by owner):".

Constraints:
- Submit exactly 6 leads in total. Do not retry a submission without telling me.
- No real personal data. Do not write the container ID or measurement ID in the file.
- If the spam check blocks you, stop and tell me; do not try to get around it.
- Do not change any code, tag or setting. This is a test, not a fix. Do not delete
  the test leads; I will do that after comparing counts.
- Report what you observed, not what you expected.

Do along

Work on your own project. Pause the video where a step says so.

  1. Pause after Part 2. Do the manual pass once: preview, accept, button, form, submit, reload. Confirm each event appears once.
  2. Pause when the prompt appears in Part 3. Note the start time. Run the batch prompt with your own domain. If the spam check blocks Claude's browser, submit the six visits by hand in private windows and have Claude write the file from the database rows and your notes.
  3. Read docs/tracking-qa.md. For any fail, ask Claude to investigate without changing anything: what it looked at, the likely cause, the proposed fix, and whether the fix is in code or in Tag Manager. Approve before it edits.
  4. Within 30 minutes of the batch, as Part 4 shows, read the generate_lead count in GA4 Realtime and the QA lead count in the CRM. Enter the GA4 number in the document.
  5. Pause after Part 5. Build and save the "Lead funnel" exploration. Delete the test leads.
  6. Pause after Part 6. Add the "when to re-run" list to the document. Commit and tag. The next-day steps from Parts 4 and 6 are homework task 1.

Check your work

  1. Open docs/tracking-qa.md. Expected: date, checks table, per-visit records, counts, and your GA4 number filled in.
  2. Compare two numbers in it. Expected: the GA4 generate_lead count for the batch equals the number of consented batch leads in the CRM.
  3. Read the rejected run. Expected: a lead in the CRM; zero requests to Google Analytics and Clarity; no _ga, _clck or _clsk cookies.
  4. Read the per-visit records. Expected: each consented visit shows each of the four events exactly once.
  5. In GA4 → Explore. Expected: a saved exploration "Lead funnel" with four steps.

Common problems

  • GA4 shows twice the CRM count. → Double counting. → In the per-visit record, see whether two requests carried generate_lead. Two pushes in the data layer means the code; one push and two requests means two tags in the container.
  • GA4 shows fewer than the CRM batch count, or zero. → The internal-traffic filter is Active, the container was not published, the Realtime window expired, or automated traffic was not counted. → Check the filter and the Versions tab; look for the missing request in the per-visit records; if only Claude-driven visits are missing, repeat the batch by hand.
  • The rejected visit produced a request to Google Analytics. → A tag is missing its consent requirement. → Open the consent overview in Tag Manager and fix the tag; publish; re-run part B.
  • The spam check blocked Claude's browser. → It is doing its job. → Submit by hand; do not weaken spam protection for a test.

Homework

About 25 minutes, spread over the following days. Section 7 can start without it. Change no code, tag or trigger. Each task adds to docs/tracking-qa.md: commit without a tag.

  1. The next-day confirmation (~10 min). Tomorrow, read the generate_lead count for the batch date in the standard events report and add it to the document. Open the "Lead funnel" exploration and look for the batch. Then set the internal-traffic filter to Active, as Part 6 showed. When you next test from your own connection, return it to Testing first. Done when: the document holds the Realtime and next-day counts, they agree with the CRM batch count, and the filter is Active.
  2. One run by hand on your phone (~10 min). On mobile data, in a private tab, open your site with ?utm_source=qa&utm_medium=test&utm_campaign=phone-1. Accept the banner, tap a call-to-action and submit with fake "QA" details. Check that the lead is in the CRM with that campaign and that generate_lead in Realtime rose by one. Add a "Phone run" line to the document and delete the lead. Done when: the line says pass, or names what failed.
  3. A real week (~5 min). A week from now, compare the generate_lead count for those seven days in GA4 with the new leads in the CRM, leaving out test leads. Done when: both numbers are in the document with one sentence explaining any difference, using Part 1.

Save your work

git add -A
git commit -m "Lesson 6.9: tracking QA routine and results"
git tag lesson-6.9
git push
git push --tags