google-analytics-4
Skill29 starsChanged 22 days agoApache-2.0View on GitHub
Use this skill whenever the user installs, configures, or debugs Google Analytics 4, or mentions gtag.js, the Google tag, GTM, key events or conversion tracking, e-commerce events, DebugView or Tag Assistant, or a cookie/consent banner tied to analytics. Covers installation (including Google tag gateway first-party serving), first-time setup (data retention, internal and hostname filters, key events), event tracking, user properties, e-commerce, Consent Mode v2 for EEA/UK/Swiss visitors, SPA pageview tracking, and BigQuery export. Skip for other analytics products (Plausible, Mixpanel, PostHog, Segment), Universal Analytics (sunset 2024), or server-side-only tracking.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- windsor-ai/claude-windsor-ai-plugintheir own version, first seen Sep 24, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- windsor-ai/claude-windsor-ai-plugin★ 1same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository6 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- llms.txtllms.txt
- aws-spa-deploySkill
- seo-llmoSkill
- web-accessibilitySkill
- web-performanceSkill
The file
We split this skill into the rules it gives an agent
6 rules. About 0 are common, 4 are distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈4
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Default: no - if yes, Consent Mode v2 setup is required (see Consent Mode v2)
- Distinctive: line 24
Default: no - if yes, ad consent signals matter for conversion tracking and which events you mark as key events and use as Ads conversions
- Very specific: line 27
Default: check package.json for a client-side router (react-router-dom, vue-router, @angular/router, next, nuxt, @sveltejs/kit) - if found, …
- Distinctive: line 30
Default: no - skip E-commerce Tracking if no
- Distinctive: line 33
Default: fresh start - if fresh start, create a property at analytics.google.com before writing any code
- Very specific: line 36
Default: direct gtag.js - recommend GTM only if the user has a marketing team managing multiple tags
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Google Analytics 4 Implementation Guide
Applies to: Any website or web app | Updated: October 2026
A practical guide for implementing Google Analytics 4 (GA4) - covering installation, critical first-time setup, event tracking, e-commerce, consent, and advanced topics. Written for AI coding assistants: skip sections that don't apply to the user's setup.
Note: Universal Analytics (UA / GA3) was fully sunset in 2024. GA4 is the only current Google Analytics product.
Section 0: Before You Start
Answer these questions before writing any code. They determine which sections apply.
Q: Are any of your visitors in the EU/EEA (European Economic Area), the UK, or Switzerland? Default: no - if yes, Consent Mode v2 setup is required (see Consent Mode v2)
Q: Do you run Google Ads (search, display, YouTube, or Shopping)? Default: no - if yes, ad consent signals matter for conversion tracking and which events you mark as key events and use as Ads conversions
Q: Is your site a single-page app (React, Vue, Angular, Next.js, etc.) where the URL changes without a full page reload?
Default: check package.json for a client-side router (react-router-dom, vue-router, @angular/router, next, nuxt, @sveltejs/kit) - if found, assume SPA and apply the Single-Page Apps section automatically
Q: Do you need to track purchases or sales? Default: no - skip E-commerce Tracking if no
Q: Do you already have a GA4 property, or is this a fresh start? Default: fresh start - if fresh start, create a property at analytics.google.com before writing any code
Q: Do you use Google Tag Manager, or add the tracking code directly? Default: direct gtag.js - recommend GTM only if the user has a marketing team managing multiple tags
AI assistant: Use these answers to skip irrelevant sections. Do not implement Consent Mode unless the user confirms EEA, UK, or Swiss users, and do not implement e-commerce unless confirmed. If a SPA framework is detected, apply the SPA section and pick exactly one page_view approach (never manual
page_viewcalls while the Enhanced Measurement history setting is still on); do not addanonymize_ip, which is a no-op in GA4 (see Common Pitfalls).
Contents
This guide is split into reference files. Use the Section 0 answers to decide which apply, then read only those; skip the rest.
- Installation: Adding GA4 to a site: gtag.js, Google Tag Manager, or Google tag gateway (first-party serving).
- Basic Configuration: Setting gtag config options such as debug mode, cookie settings, or disabling the automatic page_view.
- Critical First-Time Setup: Right after installing, before production traffic: data retention, internal and hostname filters, key events, custom dimensions.
- Common Pitfalls: Reviewing or debugging any GA4 setup; a short list of mistakes that silently break tracking.
- Event Tracking: Tracking user actions with gtag event syntax, standard events, or custom events.
- Enhanced Measurement: Deciding which events GA4 already tracks automatically before adding custom ones.
- User Properties & Custom Dimensions: Setting user properties or a User ID for cross-device tracking.
- E-commerce Tracking: The user confirmed purchase or sales tracking: view_item, add_to_cart, begin_checkout, purchase.
- Consent Mode v2: The site may have EEA, UK, or Swiss visitors, or uses a cookie or consent banner.
- Single-Page Apps: The site is a SPA and route changes must produce page_view events (Enhanced Measurement history events, manual page_view, or GTM).
- Debugging: Events are missing or wrong: DebugView, raw network requests, logging gtag calls.
- Validation & Testing: Before launch, to verify the implementation with the pre-launch checklist.
- Advanced: BigQuery Export & Sampling: Reports are sampled, raw event data is needed in BigQuery, or attribution models come up.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

