/marketing-skills:analytics-trackingfrom marketing-skills
Implements and audits web/SaaS analytics (GA4, GTM, event taxonomy, conversion tracking, UTM strategy). Includes checkers for UTM links, event names/params/PII, and funnel drop-off.
Ships in marketing-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Category: Marketing Tags: GA4, Google Tag Manager, event tracking, conversion tracking, UTM, analytics audit, consent mode
Analytics Tracking is the implementation layer for marketing measurement. Bad tracking is worse than no tracking -- duplicate events, missing parameters, unconsented data, and broken conversions lead to decisions based on bad data. This skill covers building tracking right the first time and finding what is broken when it is not.
This skill handles implementation only. For analyzing campaign performance data, use campaign-analytics. For product analytics and in-app behavior, use the product-team skills.
Before building the tracking plan, settle the inputs below. When one is missing or vague and would change the result, ask about it; when it wouldn't, use a sensible default and say which one you used.
Ask about the two or three inputs that matter most for this request, not the whole list. If the user wants a result straight away, produce it and state your assumptions at the top.
No analytics in place. Build the tracking plan, implement GA4 + GTM, define event taxonomy, configure conversions.
Tracking exists but data cannot be trusted. Audit coverage, identify gaps, clean up duplicates, fix consent issues.
Events are missing, conversions do not match, GTM preview shows fires but GA4 does not record. Structured debugging workflow.
Get this right before touching GA4 or GTM. Retrofitting taxonomy is painful and expensive.
Format: object_action (snake_case, past tense verb)
| Correct | Wrong | Why Wrong |
|---|---|---|
form_submitted | submitForm | camelCase, verb-first |
plan_selected | clickPricingPlan | Implementation detail, not user action |
video_started | VideoStart | PascalCase, inconsistent tense |
checkout_completed | purchase | Ambiguous, not a verb phrase |
Rules:
noun_verb order, never verb_noun_started, _completed, _failed, _viewedonboarding_step_completed, billing_plan_selectedEvery custom event should include applicable parameters from this table:
| Parameter | Type | Example | Required When |
|---|---|---|---|
user_id | string | usr_abc123 | Always (if authenticated) |
plan_name | string | professional | Billing/pricing events |
value | number | 99.00 | Revenue events |
currency | string | USD | Always with value |
content_group | string | onboarding | Page/flow grouping |
method | string | google_oauth | Signup/login events |
step_name | string | connect_account | Multi-step flows |
step_number | number | 3 | Multi-step flows |
source | string | pricing_page | CTA click events |
Core Funnel:
visitor_arrived (automatic page_view in GA4)
signup_started (user clicked "Sign up")
signup_completed (account created)
trial_started (free trial began)
onboarding_step_completed (params: step_name, step_number)
feature_activated (params: feature_name)
plan_selected (params: plan_name, billing_period)
checkout_started (params: value, currency, plan_name)
checkout_completed (params: value, currency, transaction_id)
subscription_renewed (params: value, plan_name)
subscription_cancelled (params: cancel_reason, plan_name)
Micro-Conversions:
pricing_viewed
demo_requested (params: source)
form_submitted (params: form_name, form_location)
content_downloaded (params: content_name, content_type)
video_started (params: video_title)
video_completed (params: video_title, percent_watched)
chat_opened
help_article_viewed (params: article_name)
invite_sent (params: recipient_role)
integration_connected (params: integration_name)
GA4 renamed "conversions" to key events in March 2024; "conversions" now refers to key events imported into Google Ads. Mark as key events in GA4 Admin > Data display > Events (star icon):
signup_completedcheckout_completeddemo_requestedtrial_startedRules:
Source: Mark events as key events (as of September 2026).
Register custom dimensions for any event parameter you want to filter/segment by:
| Parameter | Scope | Dimension Name |
|---|---|---|
plan_name | Event | Plan Name |
user_id | User | User ID |
content_group | Event | Content Group |
feature_name | Event | Feature Name |
Register in GA4 Admin > Custom definitions > Create custom dimension.
GTM Container
├── Tags
│ ├── GA4 Configuration (All Pages trigger)
│ ├── GA4 Event Tags (one per custom event)
│ ├── Google Ads Conversion Tags (per conversion action)
│ └── Meta Pixel / LinkedIn Insight (if running ads)
├── Triggers
│ ├── All Pages (Page View)
│ ├── DOM Ready
│ ├── Custom Event triggers (one per dataLayer event)
│ └── Element Click triggers (CSS selector based)
└── Variables
├── Data Layer Variables (one per dataLayer key)
├── Constants (GA4 Measurement ID, etc.)
└── Lookup Tables (if needed for mapping)
Your application pushes events to the data layer. GTM picks them up and sends to GA4.
Application code:
// Push event when user completes signup
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'signup_completed',
method: 'email',
user_id: userId,
plan_name: 'trial'
});
GTM configuration:
Trigger:
Type: Custom Event
Event name: signup_completed
Tag:
Type: GA4 Event
Event name: signup_completed
Parameters:
method: {{DLV - method}}
user_id: {{DLV - user_id}}
plan_name: {{DLV - plan_name}}
Single Page Applications need special attention because page views do not fire automatically on route changes.
Option A: History change trigger (GTM built-in)
Option B: DataLayer push on route change (more control)
// In your router (React Router, Next.js, etc.)
router.events.on('routeChangeComplete', (url) => {
window.dataLayer.push({
event: 'page_view',
page_location: url,
page_title: document.title
});
});
Recommended approach: Import GA4 conversions into Google Ads (single source of truth).
Enhanced Conversions: Enable it. Sends hashed first-party data (email, phone) to match conversions that cookies miss; compare reported conversions before and after to measure the lift on your own account.
PageView, Lead, CompleteRegistration, Purchaseevent_id to prevent double-countingsignup_completed -> LinkedIn "Sign-up" conversion| Parameter | Convention | Example |
|---|---|---|
utm_source | Platform name, lowercase | google, linkedin, newsletter |
utm_medium | Traffic type | cpc, email, social, organic |
utm_campaign | Campaign identifier | q1-trial-push, brand-awareness-2026 |
utm_content | Creative variant | hero-cta-blue, sidebar-text-link |
utm_term | Paid keyword (search only) | saas-analytics-tool |
Critical rules:
Google and google are different sources in GA4| Platform | Default | Recommended for SaaS |
|---|---|---|
| GA4 | 30 days | 30-90 days (match your sales cycle) |
| Google Ads | 30 days | 30 days (trial), 90 days (enterprise) |
| Meta | 7-day click, 1-day view | 7-day click only (view-through inflates; 7-/28-day view windows were removed Jan 2026) |
| 30 days | 30 days |
Visits from AI assistants (ChatGPT, Gemini, Claude, Copilot, Perplexity, etc.) are a growing, distinct acquisition source. Measure them explicitly instead of letting them blur into Referral or Direct.
Since May 13, 2026, GA4's Default Channel Group includes an AI Assistant channel. When the referrer matches Google's list of recognized AI assistants, GA4 sets medium = ai-assistant and campaign = (ai-assistant), and the session is grouped under AI Assistant. No configuration is needed. The rule is evaluated before Referral. Sources: Default channel group, What's new in Google Analytics.
| Gap | What happens | Mitigation |
|---|---|---|
| Not retroactive | Sessions before the rollout stay in Referral | Use the custom channel group below for historical comparison |
| Unrecognized assistants | AI tools not on Google's list still land in Referral | Custom channel group with your own regex |
| Google AI Overviews / AI Mode clicks | Excluded from AI Assistant; they arrive from google.com and count as Organic Search | Use Search Console (Web search type + Generative AI report) — GA4 cannot isolate them |
| Referrer stripped | Many app and copy-paste visits arrive with no referrer and fall into Direct | Add UTMs to links you control (e.g., in llms.txt, docs, GPT/app listings); watch Direct landing pages that match AI-cited pages |
| Assistant-added UTMs | Some assistants append their own UTM (ChatGPT adds utm_source=chatgpt.com to referral links, per OpenAI's publisher FAQ), which changes how source/medium are recorded | Match on session source (which the UTM sets) rather than referrer alone |
Create a custom channel group in GA4 (Admin > Data display > Channel groups), add an "AI Assistant (custom)" channel above Referral, with the condition Session source matches regex:
^(chatgpt\.com|chat\.openai\.com|openai\.com|perplexity\.ai|www\.perplexity\.ai|gemini\.google\.com|bard\.google\.com|claude\.ai|copilot\.microsoft\.com|edgeservices\.bing\.com|chat\.deepseek\.com|grok\.com|meta\.ai|chat\.mistral\.ai|you\.com|phind\.com)$
Keep the list in version control and review it quarterly; assistant domains change. The campaign-analytics attribution script uses the same list to classify an ai_assistant channel.
For funnels crossing domains (e.g., acme.com to app.acme.com):
linker > Add domainsVerification: Visit domain A, click link to domain B, check GA4 DebugView. The session should NOT restart. If a new session starts, cross-domain tracking is broken.
Required for EU compliance and for maintaining data quality in consent-heavy markets.
| Setting | No Consent Mode | Basic | Advanced |
|---|---|---|---|
| User declines cookies | Zero data | Zero data | Modeled data (GA4 estimates) |
| Data quality impact | Data lost for every decliner | Data lost for every decliner | Modeled data fills part of the gap (size varies by site; no fixed figure) |
| Implementation effort | None | Medium | Medium-High |
Recommendation: Implement Advanced Consent Mode v2 via GTM with a CMP (Cookiebot, OneTrust, Usercentrics).
Consent rates vary widely by banner design and region; read yours from your CMP's reports instead of assuming a figure.
1. Install CMP tag (fires first, before any other tags)
2. Set default consent state:
- analytics_storage: denied
- ad_storage: denied
- ad_user_data: denied
- ad_personalization: denied
3. CMP updates consent state on user choice
4. GA4 and ad tags respect consent automatically
Event Quality:
Configuration Quality:
Consent Quality:
| Issue | Symptom | Root Cause | Fix |
|---|---|---|---|
| Inflated page views | 2x expected volume | GTM page_view + Enhanced Measurement | Disable Enhanced page_view |
| Missing conversions | GA4 and Ads numbers differ | Attribution window mismatch | Align windows |
| (not set) pages | Pages show as "/(not set)" | SPA routing not handled | Implement SPA tracking |
| Self-referrals | Own domain in referral report | Missing cross-domain config | Add domains to referral exclusion |
| Direct traffic spike | Paid traffic showing as direct | UTMs missing or stripped | Audit UTM usage |
| Zero EU data | No traffic from EU markets | Consent blocks all tracking | Implement Advanced Consent Mode |
Step 1: Open GTM Preview mode
- Is the tag firing? Check triggers and conditions
- Is the data layer populated? Check dataLayer in console
Step 2: Check GA4 DebugView (Admin > DebugView)
- Is the event appearing? If yes, GTM is working
- Are parameters populated? Check parameter values
Step 3: Check GA4 Realtime report
- Events appearing with 5-minute delay? Normal
- Events not appearing at all? Check measurement ID
Step 4: Check Network tab (DevTools)
- Filter by "collect" or "analytics"
- Is the request being sent? Check status code
- Is the request being blocked? Check ad blockers / consent
Surface these findings without being asked:
user_id parameter on authenticated events: cannot connect analytics to CRM or understand cohorts/(not set): SPA routing not handled properlyutm_source showing as direct for known paid campaigns: UTMs missing or being stripped by redirects| Skill | Use When |
|---|---|
| campaign-analytics | Analyzing marketing performance and channel ROI (not implementation) |
| ab-test-setup | Designing experiments (this skill's events feed A/B tests) |
| launch-strategy | Tracking events for product launches |
| email-sequence | Setting up email click tracking and UTM parameters |
| Symptom | Likely Cause | Resolution |
|---|---|---|
| GA4 shows 50% less traffic than expected after privacy changes | Client-side tracking blocked by ad blockers and ITP/ETP cookie expiry | Implement server-side GTM tagging — recovers part of the lost attribution data (measure the recovery on your own account) |
| Conversion counts differ between GA4 and Google Ads by >15% | Attribution window mismatch or deduplication failure between pixel and CAPI | Align attribution windows across platforms and ensure matching event_id for deduplication |
| Events fire in GTM Preview but do not appear in GA4 reports | Measurement ID mismatch, consent mode blocking, or data processing delay | Check Measurement ID in GA4 Configuration tag, verify consent state, wait 24-48 hours for standard reports |
| UTM parameters show as (not set) in GA4 | UTMs stripped by redirects, social platform link wrappers, or internal links overwriting | Audit redirect chains, use UTM-safe shorteners, never tag internal links with UTMs |
| Server-side container returns 400 errors | Malformed event payload or missing required fields in Measurement Protocol requests | Validate payload against GA4 Measurement Protocol schema, check required client_id and api_secret |
| Enhanced Measurement duplicating custom GTM events | Both Enhanced Measurement and GTM firing the same event type (e.g., page_view, scroll) | Disable the overlapping Enhanced Measurement toggle for events you track via GTM |
| Consent Mode v2 reporting zero EU data instead of modeled data | Default consent state not set before GA4 tag fires, or CMP not updating consent correctly | Ensure consent defaults fire as the very first tag in GTM before all other tags |
noun_verb snake_case naming convention with zero violations in schema auditIn Scope: GA4 configuration, GTM implementation, event taxonomy design, conversion tracking setup, UTM strategy, consent management, data quality auditing, server-side tagging architecture, cross-domain tracking, ad platform conversion integration (Google Ads, Meta, LinkedIn).
Out of Scope: Product analytics platforms (Amplitude, Mixpanel), data warehouse configuration, custom ETL pipelines, mobile app tracking (Firebase), marketing attribution modeling (see marketing-analyst skill), A/B test statistical analysis (see ab-test-setup skill).
Limitations: Server-side tracking requires a cloud-hosted GTM container (GCP, AWS, or third-party) with associated infrastructure costs. Privacy-first analytics with Consent Mode v2 produces modeled data for non-consented users — modeled data is an estimate, not a count. This skill does not make LLM or API calls; all validation is deterministic.
Three stdlib-only checkers. They read your files and print what they read, findings that quote your values, and a fix for each. No score is produced.
| Script | Input | Use |
|---|---|---|
scripts/utm_validator.py | CSV with a url column or utm_* columns, or --url | Lowercase, spaces, missing source/medium/campaign, non-standard medium, UTMs on organic links |
scripts/event_schema_checker.py | JSON list of {"event", "params"} | snake_case noun_verb names, required params per event, value without currency, PII in param names and values |
scripts/funnel_drop_off_analyzer.py | JSON [{name, count}] or --stages "A:100,B:40" | Stage conversion, drops above --max-drop (default 70, a heuristic), later stages larger than earlier ones (tracking error) |
All accept --format text|json (--json is an alias). event_schema_checker.py --generate-schema prints the built-in SaaS taxonomy to customize, then pass it with --schema.
python3 scripts/event_schema_checker.py assets/flawed_events.json
Read: 5 events, 5 unique
ERROR (8)
[signupCompleted #0] 'signupCompleted' is not lowercase snake_case
fix: rename to 'signup_completed'
[signupCompleted #0] parameter name 'email' is a PII field
fix: remove 'email' or send a hashed/internal id (e.g. user_id)
...
FIX 10 issue(s) (8 errors, 2 warnings, 4 PII)
| Code | Meaning |
|---|---|
| 0 | No findings (info notes allowed) |
| 1 | Findings to fix (errors or warnings) |
| 2 | Unusable input: missing or unreadable file, empty file, wrong shape, no recognised columns. One BLOCKED: <reason> line on stderr |
Samples in assets/ (sample_* exit 0, flawed_* exit 1, malformed_* exit 2) are declared in assets/contract.json.
assets/contract.json (opens in a new tab)assets/flawed_events.json (opens in a new tab)assets/flawed_funnel.json (opens in a new tab)assets/flawed_utm_links.csv (opens in a new tab)assets/malformed_events.json (opens in a new tab)assets/malformed_funnel.json (opens in a new tab)assets/malformed_utm_links.csv (opens in a new tab)assets/sample_events.json (opens in a new tab)assets/sample_funnel.json (opens in a new tab)assets/sample_utm_links.csv (opens in a new tab)scripts/event_schema_checker.py (opens in a new tab)scripts/funnel_drop_off_analyzer.py (opens in a new tab)scripts/utm_validator.py (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
ga4, google-tag-manager, event-tracking, conversion-tracking, utm, analytics-audit
npx claudepluginhub borghei/claude-skills --plugin marketing-skills46 skills in this plugin
/ab-test-setupCalculates A/B test sample size and duration, writes a reviewable test plan, and analyzes conversion results (z-test, confidence interval, sample ratio check, ship/revert/inconclusive verdict). Use when setting up an A/B test, sizing an experiment, checking whether a test ran long enough, or deciding whether to ship a variant from visitor and conversion counts.
/ad-creativeDesign ad creative across Google, Meta, LinkedIn, Twitter/X, and TikTok with platform format specs, headline formulas, and A/B testing. Use when writing ad copy, generating headline variations, creating ad sets, or validating creative.
/aeoAnswer Engine Optimization (AEO): checks a page for the structures LLM answers quote (definition first, tables, numbered steps, sourced numbers, question headings, visible date), generates FAQ/HowTo JSON-LD from the page's own Q&A, and tallies brand mentions and cited URLs in saved LLM answers. Use when auditing a page for LLM citability, adding Q&A schema, or measuring whether ChatGPT, Claude, Perplexity or Gemini name your brand.
/ai-content-disclosureCheck AI-generated marketing content and reviews for required disclosures under the EU AI Act, FTC rules and platform AI-label policies. Use when you have a list of AI-made ads, deepfakes, chatbots, influencer posts or testimonials to clear before publishing, or a set of customer reviews to vet for fakes.
/ai-seoOptimize content to rank in AI search engines (AI Overviews, Perplexity, ChatGPT) via generative engine optimization (GEO), citability audits, and schema markup. Use when optimizing for AI search, generative search, or LLM visibility, when auditing a page for AI citability, when checking which passage answers a query, or when classifying keywords by intent for AI answers.
/app-store-optimizationApp Store Optimization toolkit for researching keywords, optimizing metadata, and tracking mobile app performance on Apple App Store and Google Play Store.
Other plugins' skills for the same job