plugins/digital-marketing/skills/ga4-implementation/SKILL.md
Knowledge base for implementing Google Analytics 4 (GA4) and Google Tag Manager (GTM) on websites, with deep coverage of EU/GDPR Consent Mode v2 compliance, CMP selection (iubenda, Orestbida CookieConsent), event taxonomy, conversion (Key Event) configuration, remarketing audiences, framework-specific integration (vanilla HTML, Next.js, React, WordPress), Microsoft Clarity and Search Console integration, and diagnostic patterns for low-traffic sites. TRIGGER WHEN: implementing or auditing GA4, GTM, gtag, dataLayer, Consent Mode v2, cookie banner, conversion tracking, Key Events, remarketing audiences, Google Ads conversion import, Enhanced Conversions, or diagnosing why a site has traffic but no conversions. DO NOT TRIGGER WHEN: the task involves non-Google analytics (Matomo, Plausible, Fathom), server-side analytics infrastructure unrelated to GA4/GTM, BigQuery export pipelines, or pure SEO work without a measurement layer.
npx skillsauth add acaprino/anvil-toolset ga4-implementationInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
This skill is the knowledge base behind the ga4-implementation-expert agent. It covers everything needed to deploy Google Analytics 4 with Google Tag Manager on a real website: the legal/compliance layer that is mandatory in the EU, the technical installation across frameworks, the event and conversion taxonomy, the audiences for remarketing, and the diagnostic patterns to figure out why a site is not converting.
GA4 cannot be legally deployed in Italy or the EU without all of the following:
analytics_storage, ad_storage, ad_user_data, ad_personalization) set to denied by defaultA cookie policy page that describes which cookies the site uses does not satisfy the law. The site must have a technical mechanism that prevents the cookies from being set in the first place. This is the most common compliance failure on Italian and EU sites.
For non-EU traffic the legal bar is lower, but Consent Mode v2 is still mandatory by Google policy since 6 March 2024 for any property serving any EEA user. Without it, Google disables remarketing and audience building.
Most GA4 implementation tasks follow this sequence:
references/gdpr-compliance-eu.md. If the CMP and Consent Mode v2 layer is not in place, fix that before touching tags.references/gtm-setup.md for the step-by-step walkthrough including snippet placement order.references/events-and-conversions.md for the standard event taxonomy, custom dimensions, Key Events marking, and audience patterns.references/framework-integration.md for vanilla HTML, Next.js (App + Pages Router), React, and WordPress patterns.references/diagnostics-troubleshooting.md for verification tools, the traffic-vs-conversion diagnostic split, industry benchmarks, and the common errors checklist.For diagnostic-only tasks ("why isn't my site converting"), jump straight to step 5.
gdpr-compliance-eu.mdThe legal layer. Italian Garante decisions timeline (2022 Caffeina, 2023 DPF adequacy, 2025 T-553/23, pending Schrems III appeal), cookie banner mandatory requirements, GA4 account-level mandatory configurations, the four Consent Mode v2 signals and their defaults, Basic vs Advanced mode trade-off, CMP selection (iubenda recommended for non-technical users, Orestbida CookieConsent v3 as the free open-source alternative), and ready-to-paste code snippets.
gtm-setup.mdThe technical installation walkthrough. Why GTM is preferred over gtag.js direct, step-by-step GA4 property creation, GTM container creation, snippet installation in correct order (Consent Mode v2 default block → CMP loader → GTM head snippet → GTM noscript body snippet), GA4 Google Tag configuration with the Initialization - All Pages trigger, container publishing, and the verification checklist (Realtime, Tag Assistant, DebugView, DevTools Network).
events-and-conversions.mdThe measurement layer. Enhanced Measurement auto-events, custom event patterns via GTM (book button clicks, tel/mailto/wa.me link clicks, form submissions, external OTA clicks), the GA4 recommended events list with item array structure for ecommerce, custom dimensions registration walkthrough, Key Events marking (formerly Conversions), the standard audience pattern set, Google Ads link procedure, Enhanced Conversions, and attribution settings.
framework-integration.mdThe per-framework implementation patterns. Vanilla HTML and static site generators (Jekyll, Hugo, Eleventy), Next.js (App Router with @next/third-parties/google, Pages Router with _document.tsx and next/script, route change tracking), CRA/Vite React with router listeners, WordPress (theme functions.php action hooks vs plugins like Site Kit and GTM4WP), and common pitfalls (hydration mismatches, double-firing on Strict Mode, caching plugins stripping snippets).
diagnostics-troubleshooting.mdThe diagnostic and troubleshooting layer. The traffic-vs-conversion split (Scenario A: nobody visits / Scenario B: people visit but don't convert) with the GA4 reports to check for each, Acquisition report interpretation, Funnel Exploration setup, hospitality and travel benchmarks, data thresholding workarounds for low-traffic sites, Microsoft Clarity integration, Google Search Console integration, and the common errors checklist (snippet on one page only, double tracking, wrong placement, Measurement ID typos, internal IP exclusion).
gdpr-compliance-eu.md mentions Matomo briefly as the EU-hosted alternative if the DPF is invalidated, but this skill is GA4-specific.The legal and compliance content reflects Italian Garante guidance (Provvedimenti 9677876 and 9782874), the EU-US Data Privacy Framework adequacy decision (10 July 2023), the Tribunale Generale UE ruling on Case T-553/23 (3 September 2025), and the Google Consent Mode v2 specification as of 2025-2026. Verify against current Garante and Google publications when implementing for production sites, especially if a "Schrems III" decision lands at the Court of Justice in late 2026 or early 2027.
development
Unified web frontend knowledge base covering CSS architecture, UX psychology, UI components, distinctive aesthetics, and interface design generation. TRIGGER WHEN: working on web styling, design systems, component decisions, responsive strategy, distinctive frontend aesthetics, or exploring multiple interface designs. DO NOT TRIGGER WHEN: the task is purely backend or unrelated to web frontend.
development
Coordinate parallel code reviews across multiple quality dimensions with finding deduplication, severity calibration, and consolidated reporting. Use this skill when organizing multi-reviewer code reviews, calibrating finding severity, or consolidating review results.
tools
Knowledge base for the codebase-mapper plugin. Provides writing guidelines, tone rules, and diagram conventions for generating human-readable project guides. Referenced by all codebase-mapper agents during document generation. TRIGGER WHEN: referenced by codebase-mapper pipeline agents (codebase-explorer, overview-writer, tech-writer, flow-writer, onboarding-writer, ops-writer, config-writer, guide-reviewer) during document generation. DO NOT TRIGGER WHEN: outside the /map-codebase pipeline (general documentation work should use docs:readme-craft or codebase-mapper:docs-create).
tools
Progressive Web App knowledge base for 2025-2026: Web App Manifest, Service Workers (Workbox 7, Serwist), Web Push (VAPID, RFC 8030/8291/8292, Declarative Push for Safari 18.4+), install flows (beforeinstallprompt, Window Controls Overlay), OPFS storage, Project Fugu, Core Web Vitals (INP < 200ms), security (HTTPS, CSP, COOP/COEP), and distribution (Bubblewrap, PWA Builder MSIX, Capacitor). TRIGGER WHEN: building, auditing, or debugging PWAs, including manifest, service worker, Web Push, install flow, OPFS, Background Sync, Wake Lock, vite-plugin-pwa, Next.js Serwist, @angular/pwa, @vite-pwa/nuxt, Bubblewrap, TWA, PWA Builder, or Capacitor wrapping. DO NOT TRIGGER WHEN: the task is generic frontend styling (use frontend), React performance (use react-development:review-react), cross-platform security unrelated to PWA (use platform-engineering), Tauri or Electron wrappers (use tauri-development), or GA4 / analytics (use digital-marketing).