[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71MBWEQERAZHFYQESYVBGEA":3,"skill-same:01M71MBWEQERAZHFYQESYVBGEA":102},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":39,"linkOnly":40,"markdownContent":41,"markdownBody":42,"frontMatter":43,"refName":47,"commitSha":48,"skillDirectory":49,"forksCount":14,"repositoryHtmlUrl":50,"repositoryHomepageUrl":51,"ownerHtmlUrl":52,"ownerBlogUrl":6,"ownerDescription":6,"updatedAt":53,"install":54,"resources":67},"01M71MBWEQERAZHFYQESYVBGEA","analytics-tracking-testing",null,"Validate that analytics and marketing tracking fire CORRECTLY: GA4\u002FGTM dataLayer events, Meta\u002FTikTok\u002FLinkedIn pixels, and ad-tech tags. Covers building a tracking plan as the contract, intercepting collect-endpoint beacons and dataLayer.push in Playwright, asserting event name + params + values + timing + de-duplication, Consent Mode v2 gating, CI regression gating, and news-media events (article-view, scroll-depth, paywall). Use when: \"test analytics tracking,\" \"GA4 event test,\" \"verify the pixel fires,\" \"dataLayer test,\" \"tracking plan,\" \"Meta Pixel dedup,\" \"scroll-depth tracking test,\" \"gate tracking in CI.\" Not for: whether tracking is ALLOWED to fire under consent law (GDPR\u002FCMP) — that is compliance-testing; this skill checks the data is CORRECT. SEO meta tags \u002F structured data — out of scope. Related: compliance-testing, playwright-automation, api-testing, qa-project-context.","pattanation\u002FNorvik","pattanation","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F235419268?v=4","01M71M5THHYYB15ME8R2E4FCZG","Patta","01M71M5TJM1NDM992M8PDKYR2K",0,"MIT","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002FSKILL.md",[],[19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38],"analytics","analytics tracking","analytics tracking testing","tracking","testing","view","as","context","events","ga4","de","plan","specialized","ci","Meta","mode","tiktok","project","out of scope","Media","2026-11-10 10:56:23",false,"---\nname: analytics-tracking-testing\ndescription: >-\n  Validate that analytics and marketing tracking fire CORRECTLY: GA4\u002FGTM dataLayer events,\n  Meta\u002FTikTok\u002FLinkedIn pixels, and ad-tech tags. Covers building a tracking plan as the\n  contract, intercepting collect-endpoint beacons and dataLayer.push in Playwright, asserting\n  event name + params + values + timing + de-duplication, Consent Mode v2 gating, CI regression\n  gating, and news-media events (article-view, scroll-depth, paywall). Use when: \"test analytics\n  tracking,\" \"GA4 event test,\" \"verify the pixel fires,\" \"dataLayer test,\" \"tracking plan,\"\n  \"Meta Pixel dedup,\" \"scroll-depth tracking test,\" \"gate tracking in CI.\"\n  Not for: whether tracking is ALLOWED to fire under consent law (GDPR\u002FCMP) — that is\n  compliance-testing; this skill checks the data is CORRECT. SEO meta tags \u002F structured data —\n  out of scope.\n  Related: compliance-testing, playwright-automation, api-testing, qa-project-context.\nlicense: MIT\nmetadata:\n  author: kindlmann\n  version: \"1.0\"\n  category: specialized\n---\n\n\u003Cobjective>\nTracking that \"looks fine\" in GA4 DebugView still drops events silently after a refactor, sends the wrong currency, or double-counts a purchase. Reading `window.dataLayer` or asserting the button is `toBeVisible()` proves nothing — the beacon may never leave the browser. This skill makes you intercept the real network beacon (`google-analytics.com\u002Fg\u002Fcollect`, `facebook.com\u002Ftr`, `analytics.tiktok.com`, `px.ads.linkedin.com`), parse the event name and parameters out of the request, and assert them against a tracking plan that is a typed contract — then gate that contract in CI so a dropped event fails the build.\n\u003C\u002Fobjective>\n\n## Quick Route\n\n| Situation | Go to |\n|-----------|-------|\n| Assert one GA4 event fired with correct params | [Intercepting GA4 beacons](#intercepting-ga4-beacons) |\n| Treat the tracking plan as a validated contract | [The Tracking Plan Is the Contract](#the-tracking-plan-is-the-contract) |\n| Verify dataLayer.push shape (not the beacon) | [Asserting dataLayer.push](#asserting-datalayerpush) |\n| Pixel + server CAPI deduplication (event_id) | [Pixels and Server-Side Deduplication](#pixels-and-server-side-deduplication) |\n| Events must\u002Fmustn't fire by consent state | [Consent Mode v2 Gating](#consent-mode-v2-gating) |\n| Capture every pixel in one reusable fixture | `references\u002Fcapture-fixture.md` |\n| News-media: article-view, scroll-depth, paywall | [News-Media Events](#news-media-events) |\n| Fail the build on a tracking regression | [Regression-Gating in CI](#regression-gating-in-ci) |\n| Hundreds of events, many domains, small team | [Buy vs Build](#buy-vs-build) |\n\n## Discovery Questions\n\nFirst: check `.agents\u002Fqa-project-context.md` in the project root and skip anything it already answers (stack, tag manager, consent platform, target environments).\n\n- **Which tracking destinations are live?** GA4 (`\u002Fg\u002Fcollect`), Meta Pixel (`facebook.com\u002Ftr`), TikTok (`analytics.tiktok.com`), LinkedIn (`px.ads.linkedin.com`), ad-tech tags — each has a different endpoint grammar, so the capture helper must know them all.\n- **GTM or hardcoded gtag?** GTM means the truth flows through `window.dataLayer.push` first, then GTM fires the beacon. You may assert at the push layer (input contract) AND the beacon (output contract); they are different tests.\n- **Is there a tracking plan?** If not, build one first — it is the contract everything else validates against. No plan means no objective pass\u002Ffail.\n- **Consent platform and default consent state?** Consent Mode v2 changes which beacons are even allowed to fire before consent. You need the CMP's accept\u002Freject selectors to drive the test.\n- **Client + server (CAPI) dedup in play?** If purchases fire both client Pixel and server Conversions API, the `event_id` must match or you double-count. This is the correctness property, not \"did fbq run.\"\n- **News-media surface?** Article pages add article-view, scroll-depth thresholds (25\u002F50\u002F75\u002F100), and paywall-meter events that generic e-commerce plans miss.\n\n---\n\n## Core Principles\n\n1. **Intercept the beacon, never trust the DOM or `dataLayer` alone.** A button click that updates the DOM, or a `dataLayer.push` that GTM silently drops, leaves no GA4 hit. The only proof an event was *sent* is the outbound request to the collect endpoint. Assert on the network beacon's URL params; reading `window.dataLayer` via `page.evaluate` only proves the push happened, not that anything left the browser.\n\n2. **The tracking plan is a typed contract, not a comment.** Every expected event lives in an external schema (JSON\u002FYAML\u002FTS interface) with required params and their types. Tests validate captured events against it and report `missing` params and type `violations`. Hardcoding one expected value inline asserts nothing about the other twenty params and rots on the first plan change.\n\n3. **De-duplication is the real correctness property for purchases.** Checking that `fbevents.js` loaded or counting that `fbq('track','Purchase')` ran misses double-counting entirely. The property that matters: the browser Pixel and the server CAPI send the *same* `event_id`\u002F`eventID` so Meta collapses them into one conversion.\n\n4. **Consent state is an input dimension, not a footnote.** The same page produces different beacons before vs after consent. Test both: before consent → no beacon (or only a cookieless consent ping); after accept → full beacon. And the default must be `denied` for all four Consent Mode v2 signals — a `granted` default is a compliance bug AND makes the gating test meaningless.\n\n5. **Drive real user actions and wait on requests, never the clock.** Scroll depth fires from actual scrolling (`mouse.wheel`, `scrollIntoView`, `evaluate(scrollTo)`), and you wait for the beacon with `waitForRequest`, not `waitForTimeout`. A fixed sleep is flaky and hides the very timing bug you should catch.\n\n6. **A tracking test that can't fail the build is theater.** \"Check it in GA4 DebugView\" and \"monitor production\" never block a regression. The contract must run in CI and exit non-zero when an event drops or a required param goes missing.\n\n---\n\n## Intercepting GA4 Beacons\n\nGA4 (gtag.js \u002F GTM) sends every event as an HTTP request to `https:\u002F\u002Fwww.google-analytics.com\u002Fg\u002Fcollect` (region variants like `region1.google-analytics.com\u002Fg\u002Fcollect` also occur). The event identity lives in the URL query string — you do not need the response.\n\nGA4 `\u002Fg\u002Fcollect` URL grammar you assert on:\n\n| Param | Meaning | Example |\n|-------|---------|---------|\n| `v=2` | Measurement Protocol version (always 2 for GA4) | `v=2` |\n| `tid=G-XXXXXXX` | Measurement ID | `tid=G-ABC123` |\n| `en=` | **Event name** | `en=add_to_cart` |\n| `ep.\u003Cname>=` | Event parameter, **string** type | `ep.currency=USD` |\n| `epn.\u003Cname>=` | Event parameter, **number** type | `epn.value=49.99` |\n| `gcs=` \u002F `gcd=` | Consent state (see Consent Mode v2 section) | `gcs=G111` |\n\nThe string\u002Fnumber split is load-bearing: GA4 types params automatically, so `price` arrives as `epn.value` (number) and `currency` as `ep.currency` (string). Asserting `ep.value` when it is really `epn.value` silently fails.\n\nIntercept with `page.waitForRequest` (single expected event), `page.on('request', ...)` (collect many), or `page.route` (inspect then continue — never `abort`). Parse params from `new URL(request.url()).searchParams`. Then `expect(...).toBe(...)` \u002F `toEqual` \u002F `toContain` on the parsed values.\n\nMinimal pattern (full version with helper in `references\u002Fga4-interception.md`):\n\n```ts\ntest('add_to_cart fires with correct params', async ({ page }) => {\n  await page.goto('\u002Fproduct\u002F42');\n  const [request] = await Promise.all([\n    page.waitForRequest(r => r.url().includes('\u002Fg\u002Fcollect') && r.url().includes('en=add_to_cart')),\n    page.getByRole('button', { name: 'Add to cart' }).click(),\n  ]);\n  const params = new URL(request.url()).searchParams;\n  expect(params.get('v')).toBe('2');\n  expect(params.get('tid')).toContain('G-');\n  expect(params.get('en')).toBe('add_to_cart');\n  expect(params.get('ep.currency')).toBe('USD');\n  expect(Number(params.get('epn.value'))).toBe(49.99);\n});\n```\n\nNever substitute `page.evaluate(() => window.dataLayer)` as the only assertion, `toBeVisible()` on the button, or `waitForTimeout()` to \"let the beacon send.\" See `references\u002Fga4-interception.md` for batched-event parsing (GA4 can pack multiple events into one POST body) and region-endpoint handling.\n\n---\n\n## The Tracking Plan Is the Contract\n\nA tracking plan is the source of truth: for every event, its name, required params, and each param's type. Keep it as a versioned file (`tracking-plan.json` \u002F `.yaml`, or a TS `interface`\u002F`Zod` schema) that both the app team and the tests import. Tests read the captured event and validate it against the plan — they do not hardcode expected values inline.\n\nValidation produces a structured result, not a pass\u002Ffail boolean: list every `missing` required param and every type `mismatch`\u002F`violation`. Example plan entry and validator:\n\n```ts\n\u002F\u002F tracking-plan.json\n{ \"add_to_cart\": { \"required\": { \"currency\": \"string\", \"value\": \"number\", \"item_id\": \"string\" } } }\n\nfunction validateEvent(plan, eventName, params) {\n  const spec = plan[eventName];\n  const violations = [];\n  for (const [name, type] of Object.entries(spec.required)) {\n    const raw = params.get(`ep.${name}`) ?? params.get(`epn.${name}`);\n    if (raw == null) { violations.push({ param: name, problem: 'missing' }); continue; }\n    if (type === 'number' && Number.isNaN(Number(raw))) violations.push({ param: name, problem: 'type', expected: 'number' });\n  }\n  return violations; \u002F\u002F empty array = event satisfies the contract\n}\n```\n\nThen `expect(validateEvent(plan, 'add_to_cart', params)).toEqual([])`. Asserting only the event name and ignoring params, or hardcoding expected values with no plan file, is the bare-agent shortcut this skill exists to replace. See `references\u002Ftracking-plan.md` for the YAML form, a Zod-typed plan, and a reusable `assertAgainstPlan` matcher.\n\n---\n\n## Asserting dataLayer.push\n\nWhen the question is specifically the GTM **input** — \"is the right object pushed to `dataLayer` when the page loads?\" — assert the push, not the GA4 beacon. This is the inverse of beacon interception: here the dataLayer push IS the target.\n\nCapture pushes by wrapping `window.dataLayer.push` in `addInitScript` *before navigation* so you record every push from page load, then read the recorded array via `page.evaluate`. Do **not** `page.route` to mock the dataLayer (you would replace the thing under test), and do not read the GA4 network beacon instead (that is the output, a different contract).\n\nFor ecommerce, assert the nested shape, not just the event name — the `ecommerce.items` array and each item's `item_id`, `price`, `currency`:\n\n```ts\nawait page.addInitScript(() => {\n  window.dataLayer = window.dataLayer || [];\n  const orig = window.dataLayer.push.bind(window.dataLayer);\n  window.__pushes = [];\n  window.dataLayer.push = (...args) => { window.__pushes.push(...args); return orig(...args); };\n});\nawait page.goto('\u002Fproduct\u002F42');\nconst pushes = await page.evaluate(() => window.__pushes);\nconst viewItem = pushes.find(p => p.event === 'view_item');\nexpect(viewItem.ecommerce.items[0]).toMatchObject({ item_id: 'SKU-42', price: 49.99, currency: 'USD' });\n```\n\nUse `find`\u002F`filter`\u002F`some` to locate the event in the recorded pushes. Full helper in `references\u002Fdatalayer-capture.md`.\n\n---\n\n## Pixels and Server-Side Deduplication\n\nMarketing pixels send their own beacons. Endpoints to intercept:\n\n| Destination | Endpoint | Event param | Dedup key |\n|-------------|----------|-------------|-----------|\n| Meta Pixel | `facebook.com\u002Ftr` (also `\u002Ftr?`) | `ev=PageView`, `ev=Purchase` | `eid` \u002F `event_id` |\n| TikTok | `analytics.tiktok.com` | event in body\u002Fparams | `event_id` |\n| LinkedIn | `px.ads.linkedin.com` | conversion id | — |\n\nFor Meta, asserting that `connect.facebook.net\u002Fen_US\u002Ffbevents.js` loaded, or that `fbq('track','Purchase')` ran, is a load\u002Fcount check — it does **not** prove correctness. The correctness property for a Purchase that fires both client-side (Pixel) and server-side (Conversions API \u002F CAPI) is **deduplication**: both must carry the *same* `event_id` so Meta merges them into one conversion instead of double-counting.\n\nTest it: capture the browser `facebook.com\u002Ftr` beacon for `ev=Purchase`, read its `event_id`, and assert it equals the `event_id` your server sent to CAPI (from a mocked\u002Fcaptured server call or a known fixture value). Skeleton:\n\n```ts\nconst [pixel] = await Promise.all([\n  page.waitForRequest(r => r.url().includes('facebook.com\u002Ftr') && r.url().includes('ev=Purchase')),\n  completeCheckout(page),\n]);\nconst clientEventId = new URL(pixel.url()).searchParams.get('eid'); \u002F\u002F event_id on the wire\nexpect(clientEventId).toBe(serverCapiEventId); \u002F\u002F deduplicates against the server CAPI event\n```\n\nSee `references\u002Fpixels-and-dedup.md` for parsing TikTok\u002FLinkedIn payloads and capturing the server CAPI call.\n\n---\n\n## Consent Mode v2 Gating\n\nConsent Mode v2 is the standard (mandatory four-signal model). As of the **June 15 2026** change, Google acts only on the CMP-sent consent signal, so any two-signal answer is outdated. Test two states.\n\nThe four signals — all must default to `denied`:\n\n| Signal | Governs |\n|--------|---------|\n| `ad_storage` | Advertising cookies |\n| `analytics_storage` | Analytics cookies |\n| `ad_user_data` | Sending user data to Google for ads |\n| `ad_personalization` | Personalized ads \u002F remarketing |\n\nA `granted` default is a bug; omitting `ad_user_data` and `ad_personalization` (the v2 additions) is the outdated two-signal model and is wrong.\n\n**Before consent:** no full beacon should fire — or only a *cookieless consent ping*. Use `addInitScript` to seed the `gtag('consent', 'default', {...})` denied state before page scripts run, and assert no `\u002Fg\u002Fcollect` request fires (or that the one that does carries a denied consent state).\n\n**After accept:** click the CMP accept button; the full beacon now fires.\n\nThe consent state rides on the beacon URL:\n\n- `gcs=` — encodes `ad_storage` + `analytics_storage` only. `G100` = both denied, `G111` = both granted, `G110`\u002F`G101` = partial. Before consent you expect `gcs=G100`.\n- `gcd=` — encodes all four signals (string starting `11...`); present on every hit to Google services.\n\nAssert the denied default and the `gcs=`\u002F`gcd=` value on the pre-consent beacon, then the granted state post-accept. Full test with `addInitScript` consent seeding and CMP click in `references\u002Fconsent-mode.md`.\n\n> Whether the law *permits* a beacon under a given consent state is `compliance-testing`. This skill asserts that *when* a beacon fires, its data and consent params are correct.\n\n---\n\n## News-Media Events\n\nNews and publisher sites have a tracking surface generic e-commerce plans miss. Cover all three:\n\n- **article_view** (or `article-view`) on article load — assert the beacon fires once with article metadata (id, section, author).\n- **scroll-depth** at the 25 \u002F 50 \u002F 75 \u002F 100 percent thresholds — one event per bucket, driven by *real scrolling*.\n- **paywall \u002F meter** — a `paywall_hit` (or meter) event when the free-article meter is exhausted.\n\nDrive scroll with actual actions — `mouse.wheel`, `element.scrollIntoView`, or `page.evaluate(() => window.scrollTo(...))` \u002F `scrollBy` — and wait on the beacon (`waitForRequest` or your captured-events list), never `waitForTimeout`. Scrolling in fixed sleeps both flakes and masks threshold-timing bugs.\n\n```ts\nconst buckets = [25, 50, 75, 100];\nfor (const pct of buckets) {\n  const [req] = await Promise.all([\n    page.waitForRequest(r => r.url().includes('\u002Fg\u002Fcollect') && r.url().includes('en=scroll')),\n    page.evaluate(p => window.scrollTo(0, document.body.scrollHeight * (p \u002F 100)), pct),\n  ]);\n  expect(new URL(req.url()).searchParams.get('epn.percent_scrolled')).toBe(String(pct));\n}\n```\n\nFull suite (article_view metadata, the four scroll buckets de-duplicated, and the paywall-meter event) in `references\u002Fnews-media.md`.\n\n---\n\n## Multi-Pixel Capture Fixture\n\nDon't re-implement beacon capture in every test. Build one reusable Playwright fixture (`test.extend`) that listens with `page.on('request', ...)`, matches all destination endpoints (GA4 `\u002Fg\u002Fcollect`, `facebook.com\u002Ftr`, `analytics.tiktok.com`, `px.ads.linkedin.com`), parses each request's `new URL(...).searchParams` and `postData()`, and pushes a normalized `{ destination, eventName, params }` onto a `collected` array tests assert against.\n\nCritical trap: a capture helper must **observe**, so use `page.on('request')` (or `page.route` followed by `route.continue()`), **never** `page.route(...).abort()` — aborting blocks the very beacons you are trying to see. And it must capture pixels too, not GA4 only. Full fixture in `references\u002Fcapture-fixture.md`.\n\n---\n\n## Regression-Gating in CI\n\nThe gate diffs captured events against the tracking-plan baseline and **fails the build** (non-zero exit) when a previously-firing event stops firing or a required param goes missing after a release. Structure it as a Playwright project that runs the journeys, captures every beacon via the fixture, and validates each against the plan; on any `missing`\u002Fdropped event the test `expect` fails, Playwright exits non-zero, and the GitHub Actions (or any CI) job goes red.\n\nDo **not** make the gate \"check GA4 DebugView manually,\" \"only run against production traffic,\" or \"warn but pass anyway\" — none of those block a regression. The diff-against-baseline run belongs in PR CI, before merge. See `references\u002Fci-gating.md` for the workflow YAML, the baseline-diff script, and how to surface missing-param failures in the job summary.\n\n---\n\n## Buy vs Build\n\nDIY Playwright interception is the right call for a bounded set of events on a few critical journeys gated in CI. It stops paying off at scale: hundreds of events across many domains, with a small team, and a need for *continuous production \u002F drift monitoring* (catching a tag a marketer breaks in GTM at 2am, which a pre-merge CI gate never sees).\n\n| Dimension | Build (Playwright) | Buy |\n|-----------|-------------------|-----|\n| Few events, key journeys, pre-merge gate | Best fit | Overkill |\n| Hundreds of events, many domains | Maintenance crushes you | Buy |\n| Continuous 24\u002F7 production drift monitoring | Out of scope for CI | Buy |\n| Small team, high coverage demand | Build cost too high | Buy |\n\nCurrent live paid options worth naming:\n\n- **Trackingplan** — always-on\u002Fcontinuous monitoring of live traffic across web, mobile, and server-side; strongest when you need real-time drift detection rather than scheduled checks.\n- **ObservePoint** — scheduled scans\u002Faudits of journeys against a tracking plan; mature for periodic governance.\n\nDon't recommend Segment Protocols as the *only* validation (it governs data flowing through Segment, not arbitrary client beacons), and never call Google Tag Assistant a CI gate — it is an interactive debug tool, not an automated pass\u002Ffail. Tie the decision to scale, many domains, maintenance burden, and continuous monitoring — the axes where DIY stops paying off.\n\n---\n\n## Anti-Patterns\n\n### 1. Asserting `window.dataLayer` (or the DOM) instead of the beacon\n`page.evaluate(() => window.dataLayer)` proves a push happened, not that GA4 sent anything; `toBeVisible()` proves nothing about tracking. Intercept the `\u002Fg\u002Fcollect` request and assert its `en=` and `ep.`\u002F`epn.` params. (The one exception: when the *push itself* is the contract — see dataLayer.push — but then never reach for the GA4 beacon instead.)\n\n### 2. `waitForTimeout` to \"wait for the event to fire\"\nA fixed sleep flakes and hides timing bugs. Wait on the request: `page.waitForRequest(r => r.url().includes('\u002Fg\u002Fcollect'))`.\n\n### 3. Asserting only the event name\nName-only assertions pass while currency, value, and item_id are wrong. Validate every required param and its type against the tracking plan.\n\n### 4. Hardcoding expected values inline with no plan file\nThere is no source of truth, so nothing catches a renamed param across the suite. Keep the plan external and validate against it.\n\n### 5. Load\u002Fcount checks for pixels (`fbevents.js` loaded, `fbq` ran)\nNeither proves the conversion is correct or de-duplicated. For Purchase, assert the client and server `event_id` match.\n\n### 6. Two-signal Consent Mode, or a `granted` default\nOmitting `ad_user_data` and `ad_personalization` is the pre-2026 model. Default all four to `denied` and assert `gcs=`\u002F`gcd=`.\n\n### 7. `page.route(...).abort()` inside a capture helper\nAborting blocks the beacons you meant to observe. Use `page.on('request')` (or `route.continue()`).\n\n### 8. A \"gate\" that can't fail the build\nGA4 DebugView, production-only monitoring, or warn-but-pass do not stop a regression. Make CI exit non-zero on a dropped event or missing required param.\n\n---\n\n## Verification\n\nSmallest check first — prove the suite actually catches a regression, don't just trust a green run:\n\n- **One event, one beacon:** `npx playwright test -g add_to_cart` passes, and its trace (`--trace on`) shows the captured `\u002Fg\u002Fcollect` request with `en=add_to_cart`. A green test with no matching request in the trace means you asserted on the wrong thing.\n- **The gate can fail:** rename a required param in a branch (e.g. `value` → `amount` in the app) and re-run the CI project — the build must exit non-zero with a `missing`\u002Fviolation message. If it still passes, the gate is theater.\n- **Consent default is denied:** with the denied seed and no accept click, `gcs=G100` (or no full beacon) on every captured hit; after accept, `gcs=G111`. A pre-consent `G111` means the default is wrongly `granted`.\n- **Dedup holds:** the client `eid` from `facebook.com\u002Ftr?ev=Purchase` equals the server CAPI `event_id` for the same order. Different values mean Meta will double-count.\n\n## Done When\n\n- Each tracked event has a test that intercepts the real collect-endpoint beacon (`\u002Fg\u002Fcollect`, `facebook.com\u002Ftr`, etc.) and parses `en=`\u002F`ev=` plus params from `searchParams`\u002F`postData` — no DOM-only or dataLayer-only assertions.\n- A versioned tracking plan file exists (JSON\u002FYAML\u002FTS) with required params and types; tests validate captured events against it and report `missing`\u002Ftype violations, not just the event name.\n- Purchase (or any client+server event) has a deduplication assertion: client beacon `event_id` equals the server CAPI `event_id`.\n- A Consent Mode v2 test asserts all four signals default to `denied`, no full beacon fires before consent (or only a cookieless ping), the full beacon fires after accept, and `gcs=`\u002F`gcd=` carry the expected consent state.\n- A reusable capture fixture (`test.extend`) collects GA4 + Meta + TikTok + LinkedIn beacons; no test re-implements capture and no capture helper calls `route.abort()`.\n- News-media surfaces (if present) cover article_view, scroll-depth at 25\u002F50\u002F75\u002F100 driven by real scroll actions, and a paywall\u002Fmeter event — all using `waitForRequest`, no `waitForTimeout`.\n- A CI job runs the suite, diffs captured events against the tracking-plan baseline, and exits non-zero on a dropped event or missing required param — verified by a deliberately-broken tag turning the build red.\n\n## Related Skills\n\n- **compliance-testing** — Whether a beacon is *allowed* to fire under GDPR\u002FCMP consent law, cookie-consent UI, and data-subject rights. This skill assumes the beacon is permitted and checks its data is correct; go there for the legality question.\n- **playwright-automation** — Page Object Model, fixtures, config, and the general E2E patterns this skill builds its interception on.\n- **api-testing** — Validating the server-side Conversions API \u002F Measurement Protocol calls directly (request body, auth, response) when you need to assert the server half of deduplication.\n- **qa-project-context** — Stack, tag manager, consent platform, and target environments that this skill's discovery questions read first.\n\n## Reference Files (in `references\u002F`)\n\n- **ga4-interception.md** — Full GA4 `\u002Fg\u002Fcollect` interception helper, batched-event POST-body parsing, region-endpoint handling.\n- **tracking-plan.md** — JSON and YAML plan forms, a Zod-typed contract, and the reusable `assertAgainstPlan` matcher.\n- **datalayer-capture.md** — `addInitScript` dataLayer.push wrapper and ecommerce `items[]` shape assertions.\n- **pixels-and-dedup.md** — Meta\u002FTikTok\u002FLinkedIn payload parsing and client-vs-server CAPI `event_id` dedup capture.\n- **consent-mode.md** — Consent Mode v2 default-denied seeding, CMP accept-click flow, and `gcs=`\u002F`gcd=` assertions.\n- **news-media.md** — article_view, de-duplicated 25\u002F50\u002F75\u002F100 scroll buckets, and paywall-meter event tests.\n- **capture-fixture.md** — The reusable multi-pixel `test.extend` capture fixture.\n- **ci-gating.md** — GitHub Actions workflow, baseline-diff script, and surfacing missing-param failures.\n","\u003Cobjective>\nTracking that \"looks fine\" in GA4 DebugView still drops events silently after a refactor, sends the wrong currency, or double-counts a purchase. Reading `window.dataLayer` or asserting the button is `toBeVisible()` proves nothing — the beacon may never leave the browser. This skill makes you intercept the real network beacon (`google-analytics.com\u002Fg\u002Fcollect`, `facebook.com\u002Ftr`, `analytics.tiktok.com`, `px.ads.linkedin.com`), parse the event name and parameters out of the request, and assert them against a tracking plan that is a typed contract — then gate that contract in CI so a dropped event fails the build.\n\u003C\u002Fobjective>\n\n## Quick Route\n\n| Situation | Go to |\n|-----------|-------|\n| Assert one GA4 event fired with correct params | [Intercepting GA4 beacons](#intercepting-ga4-beacons) |\n| Treat the tracking plan as a validated contract | [The Tracking Plan Is the Contract](#the-tracking-plan-is-the-contract) |\n| Verify dataLayer.push shape (not the beacon) | [Asserting dataLayer.push](#asserting-datalayerpush) |\n| Pixel + server CAPI deduplication (event_id) | [Pixels and Server-Side Deduplication](#pixels-and-server-side-deduplication) |\n| Events must\u002Fmustn't fire by consent state | [Consent Mode v2 Gating](#consent-mode-v2-gating) |\n| Capture every pixel in one reusable fixture | `references\u002Fcapture-fixture.md` |\n| News-media: article-view, scroll-depth, paywall | [News-Media Events](#news-media-events) |\n| Fail the build on a tracking regression | [Regression-Gating in CI](#regression-gating-in-ci) |\n| Hundreds of events, many domains, small team | [Buy vs Build](#buy-vs-build) |\n\n## Discovery Questions\n\nFirst: check `.agents\u002Fqa-project-context.md` in the project root and skip anything it already answers (stack, tag manager, consent platform, target environments).\n\n- **Which tracking destinations are live?** GA4 (`\u002Fg\u002Fcollect`), Meta Pixel (`facebook.com\u002Ftr`), TikTok (`analytics.tiktok.com`), LinkedIn (`px.ads.linkedin.com`), ad-tech tags — each has a different endpoint grammar, so the capture helper must know them all.\n- **GTM or hardcoded gtag?** GTM means the truth flows through `window.dataLayer.push` first, then GTM fires the beacon. You may assert at the push layer (input contract) AND the beacon (output contract); they are different tests.\n- **Is there a tracking plan?** If not, build one first — it is the contract everything else validates against. No plan means no objective pass\u002Ffail.\n- **Consent platform and default consent state?** Consent Mode v2 changes which beacons are even allowed to fire before consent. You need the CMP's accept\u002Freject selectors to drive the test.\n- **Client + server (CAPI) dedup in play?** If purchases fire both client Pixel and server Conversions API, the `event_id` must match or you double-count. This is the correctness property, not \"did fbq run.\"\n- **News-media surface?** Article pages add article-view, scroll-depth thresholds (25\u002F50\u002F75\u002F100), and paywall-meter events that generic e-commerce plans miss.\n\n---\n\n## Core Principles\n\n1. **Intercept the beacon, never trust the DOM or `dataLayer` alone.** A button click that updates the DOM, or a `dataLayer.push` that GTM silently drops, leaves no GA4 hit. The only proof an event was *sent* is the outbound request to the collect endpoint. Assert on the network beacon's URL params; reading `window.dataLayer` via `page.evaluate` only proves the push happened, not that anything left the browser.\n\n2. **The tracking plan is a typed contract, not a comment.** Every expected event lives in an external schema (JSON\u002FYAML\u002FTS interface) with required params and their types. Tests validate captured events against it and report `missing` params and type `violations`. Hardcoding one expected value inline asserts nothing about the other twenty params and rots on the first plan change.\n\n3. **De-duplication is the real correctness property for purchases.** Checking that `fbevents.js` loaded or counting that `fbq('track','Purchase')` ran misses double-counting entirely. The property that matters: the browser Pixel and the server CAPI send the *same* `event_id`\u002F`eventID` so Meta collapses them into one conversion.\n\n4. **Consent state is an input dimension, not a footnote.** The same page produces different beacons before vs after consent. Test both: before consent → no beacon (or only a cookieless consent ping); after accept → full beacon. And the default must be `denied` for all four Consent Mode v2 signals — a `granted` default is a compliance bug AND makes the gating test meaningless.\n\n5. **Drive real user actions and wait on requests, never the clock.** Scroll depth fires from actual scrolling (`mouse.wheel`, `scrollIntoView`, `evaluate(scrollTo)`), and you wait for the beacon with `waitForRequest`, not `waitForTimeout`. A fixed sleep is flaky and hides the very timing bug you should catch.\n\n6. **A tracking test that can't fail the build is theater.** \"Check it in GA4 DebugView\" and \"monitor production\" never block a regression. The contract must run in CI and exit non-zero when an event drops or a required param goes missing.\n\n---\n\n## Intercepting GA4 Beacons\n\nGA4 (gtag.js \u002F GTM) sends every event as an HTTP request to `https:\u002F\u002Fwww.google-analytics.com\u002Fg\u002Fcollect` (region variants like `region1.google-analytics.com\u002Fg\u002Fcollect` also occur). The event identity lives in the URL query string — you do not need the response.\n\nGA4 `\u002Fg\u002Fcollect` URL grammar you assert on:\n\n| Param | Meaning | Example |\n|-------|---------|---------|\n| `v=2` | Measurement Protocol version (always 2 for GA4) | `v=2` |\n| `tid=G-XXXXXXX` | Measurement ID | `tid=G-ABC123` |\n| `en=` | **Event name** | `en=add_to_cart` |\n| `ep.\u003Cname>=` | Event parameter, **string** type | `ep.currency=USD` |\n| `epn.\u003Cname>=` | Event parameter, **number** type | `epn.value=49.99` |\n| `gcs=` \u002F `gcd=` | Consent state (see Consent Mode v2 section) | `gcs=G111` |\n\nThe string\u002Fnumber split is load-bearing: GA4 types params automatically, so `price` arrives as `epn.value` (number) and `currency` as `ep.currency` (string). Asserting `ep.value` when it is really `epn.value` silently fails.\n\nIntercept with `page.waitForRequest` (single expected event), `page.on('request', ...)` (collect many), or `page.route` (inspect then continue — never `abort`). Parse params from `new URL(request.url()).searchParams`. Then `expect(...).toBe(...)` \u002F `toEqual` \u002F `toContain` on the parsed values.\n\nMinimal pattern (full version with helper in `references\u002Fga4-interception.md`):\n\n```ts\ntest('add_to_cart fires with correct params', async ({ page }) => {\n  await page.goto('\u002Fproduct\u002F42');\n  const [request] = await Promise.all([\n    page.waitForRequest(r => r.url().includes('\u002Fg\u002Fcollect') && r.url().includes('en=add_to_cart')),\n    page.getByRole('button', { name: 'Add to cart' }).click(),\n  ]);\n  const params = new URL(request.url()).searchParams;\n  expect(params.get('v')).toBe('2');\n  expect(params.get('tid')).toContain('G-');\n  expect(params.get('en')).toBe('add_to_cart');\n  expect(params.get('ep.currency')).toBe('USD');\n  expect(Number(params.get('epn.value'))).toBe(49.99);\n});\n```\n\nNever substitute `page.evaluate(() => window.dataLayer)` as the only assertion, `toBeVisible()` on the button, or `waitForTimeout()` to \"let the beacon send.\" See `references\u002Fga4-interception.md` for batched-event parsing (GA4 can pack multiple events into one POST body) and region-endpoint handling.\n\n---\n\n## The Tracking Plan Is the Contract\n\nA tracking plan is the source of truth: for every event, its name, required params, and each param's type. Keep it as a versioned file (`tracking-plan.json` \u002F `.yaml`, or a TS `interface`\u002F`Zod` schema) that both the app team and the tests import. Tests read the captured event and validate it against the plan — they do not hardcode expected values inline.\n\nValidation produces a structured result, not a pass\u002Ffail boolean: list every `missing` required param and every type `mismatch`\u002F`violation`. Example plan entry and validator:\n\n```ts\n\u002F\u002F tracking-plan.json\n{ \"add_to_cart\": { \"required\": { \"currency\": \"string\", \"value\": \"number\", \"item_id\": \"string\" } } }\n\nfunction validateEvent(plan, eventName, params) {\n  const spec = plan[eventName];\n  const violations = [];\n  for (const [name, type] of Object.entries(spec.required)) {\n    const raw = params.get(`ep.${name}`) ?? params.get(`epn.${name}`);\n    if (raw == null) { violations.push({ param: name, problem: 'missing' }); continue; }\n    if (type === 'number' && Number.isNaN(Number(raw))) violations.push({ param: name, problem: 'type', expected: 'number' });\n  }\n  return violations; \u002F\u002F empty array = event satisfies the contract\n}\n```\n\nThen `expect(validateEvent(plan, 'add_to_cart', params)).toEqual([])`. Asserting only the event name and ignoring params, or hardcoding expected values with no plan file, is the bare-agent shortcut this skill exists to replace. See `references\u002Ftracking-plan.md` for the YAML form, a Zod-typed plan, and a reusable `assertAgainstPlan` matcher.\n\n---\n\n## Asserting dataLayer.push\n\nWhen the question is specifically the GTM **input** — \"is the right object pushed to `dataLayer` when the page loads?\" — assert the push, not the GA4 beacon. This is the inverse of beacon interception: here the dataLayer push IS the target.\n\nCapture pushes by wrapping `window.dataLayer.push` in `addInitScript` *before navigation* so you record every push from page load, then read the recorded array via `page.evaluate`. Do **not** `page.route` to mock the dataLayer (you would replace the thing under test), and do not read the GA4 network beacon instead (that is the output, a different contract).\n\nFor ecommerce, assert the nested shape, not just the event name — the `ecommerce.items` array and each item's `item_id`, `price`, `currency`:\n\n```ts\nawait page.addInitScript(() => {\n  window.dataLayer = window.dataLayer || [];\n  const orig = window.dataLayer.push.bind(window.dataLayer);\n  window.__pushes = [];\n  window.dataLayer.push = (...args) => { window.__pushes.push(...args); return orig(...args); };\n});\nawait page.goto('\u002Fproduct\u002F42');\nconst pushes = await page.evaluate(() => window.__pushes);\nconst viewItem = pushes.find(p => p.event === 'view_item');\nexpect(viewItem.ecommerce.items[0]).toMatchObject({ item_id: 'SKU-42', price: 49.99, currency: 'USD' });\n```\n\nUse `find`\u002F`filter`\u002F`some` to locate the event in the recorded pushes. Full helper in `references\u002Fdatalayer-capture.md`.\n\n---\n\n## Pixels and Server-Side Deduplication\n\nMarketing pixels send their own beacons. Endpoints to intercept:\n\n| Destination | Endpoint | Event param | Dedup key |\n|-------------|----------|-------------|-----------|\n| Meta Pixel | `facebook.com\u002Ftr` (also `\u002Ftr?`) | `ev=PageView`, `ev=Purchase` | `eid` \u002F `event_id` |\n| TikTok | `analytics.tiktok.com` | event in body\u002Fparams | `event_id` |\n| LinkedIn | `px.ads.linkedin.com` | conversion id | — |\n\nFor Meta, asserting that `connect.facebook.net\u002Fen_US\u002Ffbevents.js` loaded, or that `fbq('track','Purchase')` ran, is a load\u002Fcount check — it does **not** prove correctness. The correctness property for a Purchase that fires both client-side (Pixel) and server-side (Conversions API \u002F CAPI) is **deduplication**: both must carry the *same* `event_id` so Meta merges them into one conversion instead of double-counting.\n\nTest it: capture the browser `facebook.com\u002Ftr` beacon for `ev=Purchase`, read its `event_id`, and assert it equals the `event_id` your server sent to CAPI (from a mocked\u002Fcaptured server call or a known fixture value). Skeleton:\n\n```ts\nconst [pixel] = await Promise.all([\n  page.waitForRequest(r => r.url().includes('facebook.com\u002Ftr') && r.url().includes('ev=Purchase')),\n  completeCheckout(page),\n]);\nconst clientEventId = new URL(pixel.url()).searchParams.get('eid'); \u002F\u002F event_id on the wire\nexpect(clientEventId).toBe(serverCapiEventId); \u002F\u002F deduplicates against the server CAPI event\n```\n\nSee `references\u002Fpixels-and-dedup.md` for parsing TikTok\u002FLinkedIn payloads and capturing the server CAPI call.\n\n---\n\n## Consent Mode v2 Gating\n\nConsent Mode v2 is the standard (mandatory four-signal model). As of the **June 15 2026** change, Google acts only on the CMP-sent consent signal, so any two-signal answer is outdated. Test two states.\n\nThe four signals — all must default to `denied`:\n\n| Signal | Governs |\n|--------|---------|\n| `ad_storage` | Advertising cookies |\n| `analytics_storage` | Analytics cookies |\n| `ad_user_data` | Sending user data to Google for ads |\n| `ad_personalization` | Personalized ads \u002F remarketing |\n\nA `granted` default is a bug; omitting `ad_user_data` and `ad_personalization` (the v2 additions) is the outdated two-signal model and is wrong.\n\n**Before consent:** no full beacon should fire — or only a *cookieless consent ping*. Use `addInitScript` to seed the `gtag('consent', 'default', {...})` denied state before page scripts run, and assert no `\u002Fg\u002Fcollect` request fires (or that the one that does carries a denied consent state).\n\n**After accept:** click the CMP accept button; the full beacon now fires.\n\nThe consent state rides on the beacon URL:\n\n- `gcs=` — encodes `ad_storage` + `analytics_storage` only. `G100` = both denied, `G111` = both granted, `G110`\u002F`G101` = partial. Before consent you expect `gcs=G100`.\n- `gcd=` — encodes all four signals (string starting `11...`); present on every hit to Google services.\n\nAssert the denied default and the `gcs=`\u002F`gcd=` value on the pre-consent beacon, then the granted state post-accept. Full test with `addInitScript` consent seeding and CMP click in `references\u002Fconsent-mode.md`.\n\n> Whether the law *permits* a beacon under a given consent state is `compliance-testing`. This skill asserts that *when* a beacon fires, its data and consent params are correct.\n\n---\n\n## News-Media Events\n\nNews and publisher sites have a tracking surface generic e-commerce plans miss. Cover all three:\n\n- **article_view** (or `article-view`) on article load — assert the beacon fires once with article metadata (id, section, author).\n- **scroll-depth** at the 25 \u002F 50 \u002F 75 \u002F 100 percent thresholds — one event per bucket, driven by *real scrolling*.\n- **paywall \u002F meter** — a `paywall_hit` (or meter) event when the free-article meter is exhausted.\n\nDrive scroll with actual actions — `mouse.wheel`, `element.scrollIntoView`, or `page.evaluate(() => window.scrollTo(...))` \u002F `scrollBy` — and wait on the beacon (`waitForRequest` or your captured-events list), never `waitForTimeout`. Scrolling in fixed sleeps both flakes and masks threshold-timing bugs.\n\n```ts\nconst buckets = [25, 50, 75, 100];\nfor (const pct of buckets) {\n  const [req] = await Promise.all([\n    page.waitForRequest(r => r.url().includes('\u002Fg\u002Fcollect') && r.url().includes('en=scroll')),\n    page.evaluate(p => window.scrollTo(0, document.body.scrollHeight * (p \u002F 100)), pct),\n  ]);\n  expect(new URL(req.url()).searchParams.get('epn.percent_scrolled')).toBe(String(pct));\n}\n```\n\nFull suite (article_view metadata, the four scroll buckets de-duplicated, and the paywall-meter event) in `references\u002Fnews-media.md`.\n\n---\n\n## Multi-Pixel Capture Fixture\n\nDon't re-implement beacon capture in every test. Build one reusable Playwright fixture (`test.extend`) that listens with `page.on('request', ...)`, matches all destination endpoints (GA4 `\u002Fg\u002Fcollect`, `facebook.com\u002Ftr`, `analytics.tiktok.com`, `px.ads.linkedin.com`), parses each request's `new URL(...).searchParams` and `postData()`, and pushes a normalized `{ destination, eventName, params }` onto a `collected` array tests assert against.\n\nCritical trap: a capture helper must **observe**, so use `page.on('request')` (or `page.route` followed by `route.continue()`), **never** `page.route(...).abort()` — aborting blocks the very beacons you are trying to see. And it must capture pixels too, not GA4 only. Full fixture in `references\u002Fcapture-fixture.md`.\n\n---\n\n## Regression-Gating in CI\n\nThe gate diffs captured events against the tracking-plan baseline and **fails the build** (non-zero exit) when a previously-firing event stops firing or a required param goes missing after a release. Structure it as a Playwright project that runs the journeys, captures every beacon via the fixture, and validates each against the plan; on any `missing`\u002Fdropped event the test `expect` fails, Playwright exits non-zero, and the GitHub Actions (or any CI) job goes red.\n\nDo **not** make the gate \"check GA4 DebugView manually,\" \"only run against production traffic,\" or \"warn but pass anyway\" — none of those block a regression. The diff-against-baseline run belongs in PR CI, before merge. See `references\u002Fci-gating.md` for the workflow YAML, the baseline-diff script, and how to surface missing-param failures in the job summary.\n\n---\n\n## Buy vs Build\n\nDIY Playwright interception is the right call for a bounded set of events on a few critical journeys gated in CI. It stops paying off at scale: hundreds of events across many domains, with a small team, and a need for *continuous production \u002F drift monitoring* (catching a tag a marketer breaks in GTM at 2am, which a pre-merge CI gate never sees).\n\n| Dimension | Build (Playwright) | Buy |\n|-----------|-------------------|-----|\n| Few events, key journeys, pre-merge gate | Best fit | Overkill |\n| Hundreds of events, many domains | Maintenance crushes you | Buy |\n| Continuous 24\u002F7 production drift monitoring | Out of scope for CI | Buy |\n| Small team, high coverage demand | Build cost too high | Buy |\n\nCurrent live paid options worth naming:\n\n- **Trackingplan** — always-on\u002Fcontinuous monitoring of live traffic across web, mobile, and server-side; strongest when you need real-time drift detection rather than scheduled checks.\n- **ObservePoint** — scheduled scans\u002Faudits of journeys against a tracking plan; mature for periodic governance.\n\nDon't recommend Segment Protocols as the *only* validation (it governs data flowing through Segment, not arbitrary client beacons), and never call Google Tag Assistant a CI gate — it is an interactive debug tool, not an automated pass\u002Ffail. Tie the decision to scale, many domains, maintenance burden, and continuous monitoring — the axes where DIY stops paying off.\n\n---\n\n## Anti-Patterns\n\n### 1. Asserting `window.dataLayer` (or the DOM) instead of the beacon\n`page.evaluate(() => window.dataLayer)` proves a push happened, not that GA4 sent anything; `toBeVisible()` proves nothing about tracking. Intercept the `\u002Fg\u002Fcollect` request and assert its `en=` and `ep.`\u002F`epn.` params. (The one exception: when the *push itself* is the contract — see dataLayer.push — but then never reach for the GA4 beacon instead.)\n\n### 2. `waitForTimeout` to \"wait for the event to fire\"\nA fixed sleep flakes and hides timing bugs. Wait on the request: `page.waitForRequest(r => r.url().includes('\u002Fg\u002Fcollect'))`.\n\n### 3. Asserting only the event name\nName-only assertions pass while currency, value, and item_id are wrong. Validate every required param and its type against the tracking plan.\n\n### 4. Hardcoding expected values inline with no plan file\nThere is no source of truth, so nothing catches a renamed param across the suite. Keep the plan external and validate against it.\n\n### 5. Load\u002Fcount checks for pixels (`fbevents.js` loaded, `fbq` ran)\nNeither proves the conversion is correct or de-duplicated. For Purchase, assert the client and server `event_id` match.\n\n### 6. Two-signal Consent Mode, or a `granted` default\nOmitting `ad_user_data` and `ad_personalization` is the pre-2026 model. Default all four to `denied` and assert `gcs=`\u002F`gcd=`.\n\n### 7. `page.route(...).abort()` inside a capture helper\nAborting blocks the beacons you meant to observe. Use `page.on('request')` (or `route.continue()`).\n\n### 8. A \"gate\" that can't fail the build\nGA4 DebugView, production-only monitoring, or warn-but-pass do not stop a regression. Make CI exit non-zero on a dropped event or missing required param.\n\n---\n\n## Verification\n\nSmallest check first — prove the suite actually catches a regression, don't just trust a green run:\n\n- **One event, one beacon:** `npx playwright test -g add_to_cart` passes, and its trace (`--trace on`) shows the captured `\u002Fg\u002Fcollect` request with `en=add_to_cart`. A green test with no matching request in the trace means you asserted on the wrong thing.\n- **The gate can fail:** rename a required param in a branch (e.g. `value` → `amount` in the app) and re-run the CI project — the build must exit non-zero with a `missing`\u002Fviolation message. If it still passes, the gate is theater.\n- **Consent default is denied:** with the denied seed and no accept click, `gcs=G100` (or no full beacon) on every captured hit; after accept, `gcs=G111`. A pre-consent `G111` means the default is wrongly `granted`.\n- **Dedup holds:** the client `eid` from `facebook.com\u002Ftr?ev=Purchase` equals the server CAPI `event_id` for the same order. Different values mean Meta will double-count.\n\n## Done When\n\n- Each tracked event has a test that intercepts the real collect-endpoint beacon (`\u002Fg\u002Fcollect`, `facebook.com\u002Ftr`, etc.) and parses `en=`\u002F`ev=` plus params from `searchParams`\u002F`postData` — no DOM-only or dataLayer-only assertions.\n- A versioned tracking plan file exists (JSON\u002FYAML\u002FTS) with required params and types; tests validate captured events against it and report `missing`\u002Ftype violations, not just the event name.\n- Purchase (or any client+server event) has a deduplication assertion: client beacon `event_id` equals the server CAPI `event_id`.\n- A Consent Mode v2 test asserts all four signals default to `denied`, no full beacon fires before consent (or only a cookieless ping), the full beacon fires after accept, and `gcs=`\u002F`gcd=` carry the expected consent state.\n- A reusable capture fixture (`test.extend`) collects GA4 + Meta + TikTok + LinkedIn beacons; no test re-implements capture and no capture helper calls `route.abort()`.\n- News-media surfaces (if present) cover article_view, scroll-depth at 25\u002F50\u002F75\u002F100 driven by real scroll actions, and a paywall\u002Fmeter event — all using `waitForRequest`, no `waitForTimeout`.\n- A CI job runs the suite, diffs captured events against the tracking-plan baseline, and exits non-zero on a dropped event or missing required param — verified by a deliberately-broken tag turning the build red.\n\n## Related Skills\n\n- **compliance-testing** — Whether a beacon is *allowed* to fire under GDPR\u002FCMP consent law, cookie-consent UI, and data-subject rights. This skill assumes the beacon is permitted and checks its data is correct; go there for the legality question.\n- **playwright-automation** — Page Object Model, fixtures, config, and the general E2E patterns this skill builds its interception on.\n- **api-testing** — Validating the server-side Conversions API \u002F Measurement Protocol calls directly (request body, auth, response) when you need to assert the server half of deduplication.\n- **qa-project-context** — Stack, tag manager, consent platform, and target environments that this skill's discovery questions read first.\n\n## Reference Files (in `references\u002F`)\n\n- **ga4-interception.md** — Full GA4 `\u002Fg\u002Fcollect` interception helper, batched-event POST-body parsing, region-endpoint handling.\n- **tracking-plan.md** — JSON and YAML plan forms, a Zod-typed contract, and the reusable `assertAgainstPlan` matcher.\n- **datalayer-capture.md** — `addInitScript` dataLayer.push wrapper and ecommerce `items[]` shape assertions.\n- **pixels-and-dedup.md** — Meta\u002FTikTok\u002FLinkedIn payload parsing and client-vs-server CAPI `event_id` dedup capture.\n- **consent-mode.md** — Consent Mode v2 default-denied seeding, CMP accept-click flow, and `gcs=`\u002F`gcd=` assertions.\n- **news-media.md** — article_view, de-duplicated 25\u002F50\u002F75\u002F100 scroll buckets, and paywall-meter event tests.\n- **capture-fixture.md** — The reusable multi-pixel `test.extend` capture fixture.\n- **ci-gating.md** — GitHub Actions workflow, baseline-diff script, and surfacing missing-param failures.\n",{"name":5,"license":15,"metadata":44,"description":7},{"author":45,"version":46,"category":31},"kindlmann","1.0","claude\u002Finstall-gsd-build-foQdV","d86cd127f527124b5fd0fd0bc679a4d79b7d01d7",".agents\u002Fskills\u002Fanalytics-tracking-testing","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik","https:\u002F\u002Fnorvik-orpin.vercel.app","https:\u002F\u002Fgithub.com\u002Fpattanation","2026-07-17 11:17:04",{"source":8,"skillName":5,"commands":55,"prompt":65,"zipAvailable":66},[56,59,62],{"tool":57,"command":58},"npx","npx skills add pattanation\u002FNorvik --skill analytics-tracking-testing",{"tool":60,"command":61},"bunx","bunx skills add pattanation\u002FNorvik --skill analytics-tracking-testing",{"tool":63,"command":64},"pnpm","pnpm dlx skills add pattanation\u002FNorvik --skill analytics-tracking-testing","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002FSKILL.md",true,[68,74,78,82,86,90,94,98],{"path":69,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":72,"sourceHtmlUrl":73},"references\u002Fcapture-fixture.md","REFERENCE","参考文档",3025,"https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002Freferences\u002Fcapture-fixture.md",{"path":75,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":76,"sourceHtmlUrl":77},"references\u002Fci-gating.md",3301,"https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002Freferences\u002Fci-gating.md",{"path":79,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":80,"sourceHtmlUrl":81},"references\u002Fconsent-mode.md",3040,"https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002Freferences\u002Fconsent-mode.md",{"path":83,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":84,"sourceHtmlUrl":85},"references\u002Fdatalayer-capture.md",2348,"https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002Freferences\u002Fdatalayer-capture.md",{"path":87,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":88,"sourceHtmlUrl":89},"references\u002Fga4-interception.md",3394,"https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002Freferences\u002Fga4-interception.md",{"path":91,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":92,"sourceHtmlUrl":93},"references\u002Fnews-media.md",3191,"https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002Freferences\u002Fnews-media.md",{"path":95,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":96,"sourceHtmlUrl":97},"references\u002Fpixels-and-dedup.md",2811,"https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002Freferences\u002Fpixels-and-dedup.md",{"path":99,"resourceType":70,"resourceTypeDesc":71,"sizeBytes":100,"sourceHtmlUrl":101},"references\u002Ftracking-plan.md",2978,"https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fanalytics-tracking-testing\u002Freferences\u002Ftracking-plan.md",[103,112,119,126,151,176],{"skillNo":104,"name":105,"nameZh":6,"description":106,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":6,"sourceHtmlUrl":108,"categories":109,"keywords":110,"publishedAt":111},"01M73Z1NPMJ667E0DSPBS9FH0B","jetson-set-target","Switch the active Jetson target-platform pointer to an existing profile YAML. Use before customize\u002Fbuild\u002Fflash to change target; not for authoring profiles — use jetson-init-target instead.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fjetson-set-target\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":113,"name":114,"nameZh":6,"description":115,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":6,"sourceHtmlUrl":116,"categories":117,"keywords":118,"publishedAt":111},"01M73YC29YWGCW521P7B0NM3HQ","earth2studio-data-fetch","Fetch weather\u002Fclimate data via Earth2Studio data sources for specific variables and times. Do NOT use for inference pipelines, model discovery, or installation.","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fearth2studio-data-fetch\u002FSKILL.md",[],[],{"skillNo":120,"name":121,"nameZh":6,"description":122,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":6,"sourceHtmlUrl":123,"categories":124,"keywords":125,"publishedAt":111},"01M73YBNHMHFDFP83MAVGQQ92N","earth2studio-create-datasource","Create and validate Earth2Studio data source wrappers (DataSource, ForecastSource, DataFrameSource, ForecastFrameSource) from remote stores. Do NOT use for fetching data with existing sources, model inference, or installation tasks.","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fearth2studio-create-datasource\u002FSKILL.md",[],[],{"skillNo":127,"name":128,"nameZh":6,"description":129,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":130,"sourceHtmlUrl":131,"categories":132,"keywords":133,"publishedAt":150},"01M71QDV4DM8T19HEHWATEF1K4","webapp-testing","Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fwebapp-testing\u002FSKILL.md",[],[134,23,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149],"webapp","webapp testing","local","screenshots","for","applications","browser","ui","behavior","web","playwright","with","frontend","debugging","toolkit","logs","2026-11-10 13:02:02",{"skillNo":152,"name":153,"nameZh":6,"description":154,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":107,"licenseFileUrl":155,"sourceHtmlUrl":156,"categories":157,"keywords":158,"publishedAt":150},"01M71QDH2GGMXGA9105C9W1N7B","web-artifacts-builder","Suite of tools for creating elaborate, multi-component claude.ai HTML artifacts using modern frontend web technologies (React, Tailwind CSS, shadcn\u002Fui). Use for complex artifacts requiring state management, routing, or shadcn\u002Fui components - not for simple single-file HTML\u002FJSX artifacts.","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fweb-artifacts-builder\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fweb-artifacts-builder\u002FSKILL.md",[],[159,143,160,161,162,163,164,165,166,167,168,169,138,170,171,146,172,173,174,175],"web artifacts builder","artifacts","artifacts builder","builder","multi","state","routing","state management","react","single-file","css","Tailwind","ui components","single","use","file","components",{"skillNo":177,"name":178,"nameZh":6,"description":179,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":180,"sourceHtmlUrl":181,"categories":182,"keywords":183,"publishedAt":150},"01M71QD9T2XC3EWMQNN9ACNWQ1","vueuse-functions","Apply VueUse composables where appropriate to build concise, maintainable Vue.js \u002F Nuxt features.","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fvueuse-functions\u002FLICENSE.md","https:\u002F\u002Fgithub.com\u002Fpattanation\u002FNorvik\u002Fblob\u002Fclaude\u002Finstall-gsd-build-foQdV\u002F.agents\u002Fskills\u002Fvueuse-functions\u002FSKILL.md",[],[184,185,186,187,36,188,189,190,191,192,193,194,195,196],"vueuse","vueuse functions","functions","composables","nuxt","apply","github","concise","build","https","features","vue","js"]