analytics-tracking
Analytics Tracking
Overview
Tracking is finished when a named person can answer a business question from a report, not when a tag fires. This skill takes a site from "we have GA4 installed" to a short tracking plan, code that sends each event exactly once with valid names, the Admin settings that make the data usable, and proof that it works. Everything here follows Google's current documentation for GA4, the Google tag and Tag Manager; Universal Analytics concepts (categories, actions, labels, goals, anonymize_ip) do not apply.
Instructions
1. Establish what exists
Ask: which decisions the data should inform, which actions count as success (lead, signup, purchase), which regions the visitors come from (consent), and who is allowed to publish the Tag Manager container. Then look in the code:
grep -rnE "gtag\(|dataLayer\.push|googletagmanager\.com|GTM-[A-Z0-9]{4,}|G-[A-Z0-9]{8,}|@next/third-parties" \
--include="*.ts" --include="*.tsx" --include="*.js" --include="*.jsx" --include="*.html" \
--exclude-dir=node_modules --exclude-dir=.next .
Choose one delivery path and keep to it. If a GTM- container is on the page, send events through the data layer and configure tags in Tag Manager; if only the Google tag is present, call gtag() directly. The same event sent through both paths is counted twice.