[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71H9M427MYVFDZ4KA7SWKVC":3,"skill-same:01M71H9M427MYVFDZ4KA7SWKVC":115},{"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":37,"publishedAt":58,"linkOnly":59,"markdownContent":60,"markdownBody":61,"frontMatter":62,"refName":68,"commitSha":69,"skillDirectory":70,"forksCount":71,"repositoryHtmlUrl":72,"repositoryHomepageUrl":6,"ownerHtmlUrl":73,"ownerBlogUrl":74,"ownerDescription":75,"updatedAt":76,"install":77,"resources":90},"01M71H9M427MYVFDZ4KA7SWKVC","analytics-tracking",null,"Set up, audit, and debug analytics tracking implementation — GA4, Google Tag Manager, event taxonomy, conversion tracking, and data quality. Use when building a tracking plan from scratch, auditing existing analytics for gaps or errors, debugging missing events, or setting up GTM. Trigger keywords: GA4 setup, Google Tag Manager, GTM, event tracking, analytics implementation, conversion tracking, tracking plan, event taxonomy, custom dimensions, UTM tracking, analytics audit, missing events, tracking broken. NOT for analyzing marketing campaign data — use campaign-analytics for that. NOT for BI dashboards — use product-analytics for in-product event analysis.","iDorgham\u002FWorkspace-Factory","iDorgham","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F136521493?v=4","01M6CNGBDAHE4ARW3YJEF4X2FD","Dorgham","01M71E8H3CXZ7DJX59MTM9JEB2",1,"MIT","https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Fanalytics-tracking\u002FSKILL.md",[18,23,26,31,34],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000013","分析与可视化","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000019","营销推广",{"categoryNo":27,"categoryName":28,"taxonomyType":29,"taxonomyTypeDesc":30},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",{"categoryNo":32,"categoryName":33,"taxonomyType":29,"taxonomyTypeDesc":30},"01JBSEEDCAT000000000000033","数据分析师",{"categoryNo":35,"categoryName":36,"taxonomyType":29,"taxonomyTypeDesc":30},"01JBSEEDCAT000000000000035","市场营销",[38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57],"analytics tracking","tracking","analytics","ga4 setup","product","ga4","bi","plan","gtm","dimensions","conversion","analysis","utm","when","debugging","errors","campaign","up","broken","SET","2026-11-10 10:12:30",false,"---\nname: \"analytics-tracking\"\ndescription: \"Set up, audit, and debug analytics tracking implementation — GA4, Google Tag Manager, event taxonomy, conversion tracking, and data quality. Use when building a tracking plan from scratch, auditing existing analytics for gaps or errors, debugging missing events, or setting up GTM. Trigger keywords: GA4 setup, Google Tag Manager, GTM, event tracking, analytics implementation, conversion tracking, tracking plan, event taxonomy, custom dimensions, UTM tracking, analytics audit, missing events, tracking broken. NOT for analyzing marketing campaign data — use campaign-analytics for that. NOT for BI dashboards — use product-analytics for in-product event analysis.\"\nlicense: MIT\nmetadata:\n  version: 1.0.0\n  author: Alireza Rezvani\n  category: marketing\n  updated: 2026-03-06\n---\n\n# Analytics Tracking\n\nYou are an expert in analytics implementation. Your goal is to make sure every meaningful action in the customer journey is captured accurately, consistently, and in a way that can actually be used for decisions — not just for the sake of having data.\n\nBad tracking is worse than no tracking. Duplicate events, missing parameters, unconsented data, and broken conversions lead to decisions made on bad data. This skill is about building it right the first time, or finding what's broken and fixing it.\n\n## Before Starting\n\n**Check for context first:**\nIf `marketing-context.md` exists, read it before asking questions. Use that context and only ask for what's missing.\n\nGather this context:\n\n### 1. Current State\n- Do you have GA4 and\u002For GTM already set up? If so, what's broken or missing?\n- What's your tech stack? (React SPA, Next.js, WordPress, custom, etc.)\n- Do you have a consent management platform (CMP)? Which one?\n- What events are you currently tracking (if any)?\n\n### 2. Business Context\n- What are your primary conversion actions? (signup, purchase, lead form, free trial start)\n- What are your key micro-conversions? (pricing page view, feature discovery, demo request)\n- Do you run paid campaigns? (Google Ads, Meta, LinkedIn — affects conversion tracking needs)\n\n### 3. Goals\n- Building from scratch, auditing existing, or debugging a specific issue?\n- Do you need cross-domain tracking? Multiple properties or subdomains?\n- Server-side tagging requirement? (GDPR-sensitive markets, performance concerns)\n\n## How This Skill Works\n\n### Mode 1: Set Up From Scratch\nNo analytics in place — we'll build the tracking plan, implement GA4 and GTM, define the event taxonomy, and configure conversions.\n\n### Mode 2: Audit Existing Tracking\nTracking exists but you don't trust the data, coverage is incomplete, or you're adding new goals. We'll audit what's there, gap-fill, and clean up.\n\n### Mode 3: Debug Tracking Issues\nSpecific events are missing, conversion numbers don't add up, or GTM preview shows events firing but GA4 isn't recording them. Structured debugging workflow.\n\n---\n\n## Event Taxonomy Design\n\nGet this right before touching GA4 or GTM. Retrofitting taxonomy is painful.\n\n### Naming Convention\n\n**Format:** `object_action` (snake_case, verb at the end)\n\n| ✅ Good | ❌ Bad |\n|--------|--------|\n| `form_submit` | `submitForm`, `FormSubmitted`, `form-submit` |\n| `plan_selected` | `clickPricingPlan`, `selected_plan`, `PlanClick` |\n| `video_started` | `videoPlay`, `StartVideo`, `VideoStart` |\n| `checkout_completed` | `purchase`, `buy_complete`, `checkoutDone` |\n\n**Rules:**\n- Always `noun_verb` not `verb_noun`\n- Lowercase + underscores only — no camelCase, no hyphens\n- Be specific enough to be unambiguous, not so verbose it's a sentence\n- Consistent tense: `_started`, `_completed`, `_failed` (not mix of past\u002Fpresent)\n\n### Standard Parameters\n\nEvery event should include these where applicable:\n\n| Parameter | Type | Example | Purpose |\n|-----------|------|---------|---------|\n| `page_location` | string | `https:\u002F\u002Fapp.co\u002Fpricing` | Auto-captured by GA4 |\n| `page_title` | string | `Pricing - Acme` | Auto-captured by GA4 |\n| `user_id` | string | `usr_abc123` | Link to your CRM\u002FDB |\n| `plan_name` | string | `Professional` | Segment by plan |\n| `value` | number | `99` | Revenue\u002Forder value |\n| `currency` | string | `USD` | Required with value |\n| `content_group` | string | `onboarding` | Group pages\u002Fflows |\n| `method` | string | `google_oauth` | How (signup method, etc.) |\n\n### Event Taxonomy for SaaS\n\n**Core funnel events:**\n```\nvisitor_arrived         (page view — automatic in GA4)\nsignup_started          (user clicked \"Sign up\")\nsignup_completed        (account created successfully)\ntrial_started           (free trial began)\nonboarding_step_completed (param: step_name, step_number)\nfeature_activated       (param: feature_name)\nplan_selected           (param: plan_name, billing_period)\ncheckout_started        (param: value, currency, plan_name)\ncheckout_completed      (param: value, currency, transaction_id)\nsubscription_cancelled  (param: cancel_reason, plan_name)\n```\n\n**Micro-conversion events:**\n```\npricing_viewed\ndemo_requested          (param: source)\nform_submitted          (param: form_name, form_location)\ncontent_downloaded      (param: content_name, content_type)\nvideo_started           (param: video_title)\nvideo_completed         (param: video_title, percent_watched)\nchat_opened\nhelp_article_viewed     (param: article_name)\n```\n\nSee [references\u002Fevent-taxonomy-guide.md](references\u002Fevent-taxonomy-guide.md) for the full taxonomy catalog with custom dimension recommendations.\n\n---\n\n## GA4 Setup\n\n### Data Stream Configuration\n\n1. **Create property** in GA4 → Admin → Properties → Create\n2. **Add web data stream** with your domain\n3. **Enhanced Measurement** — enable all, then review:\n   - ✅ Page views (keep)\n   - ✅ Scrolls (keep)\n   - ✅ Outbound clicks (keep)\n   - ✅ Site search (keep if you have search)\n   - ⚠️ Video engagement (disable if you'll track videos manually — avoid duplicates)\n   - ⚠️ File downloads (disable if you'll track these in GTM for better parameters)\n4. **Configure domains** — add all subdomains used in your funnel\n\n### Custom Events in GA4\n\nFor any event not auto-collected, create it in GTM (preferred) or via gtag directly:\n\n**Via gtag:**\n```javascript\ngtag('event', 'signup_completed', {\n  method: 'email',\n  user_id: 'usr_abc123',\n  plan_name: \"trial\"\n});\n```\n\n**Via GTM data layer (preferred — see GTM section):**\n```javascript\nwindow.dataLayer.push({\n  event: 'signup_completed',\n  signup_method: 'email',\n  user_id: 'usr_abc123'\n});\n```\n\n### Conversions Configuration\n\nMark these events as conversions in GA4 → Admin → Conversions:\n- `signup_completed`\n- `checkout_completed`\n- `demo_requested`\n- `trial_started` (if separate from signup)\n\n**Rules:**\n- Max 30 conversion events per property — curate, don't mark everything\n- Conversions are retroactive in GA4 — turning one on applies to 6 months of history\n- Don't mark micro-conversions as conversions unless you're optimizing ad campaigns for them\n\n---\n\n## Google Tag Manager Setup\n\n### Container Structure\n\n```\nGTM Container\n├── Tags\n│   ├── GA4 Configuration (fires on all pages)\n│   ├── GA4 Event — [event_name] (one tag per event)\n│   ├── Google Ads Conversion (per conversion action)\n│   └── Meta Pixel (if running Meta ads)\n├── Triggers\n│   ├── All Pages\n│   ├── DOM Ready\n│   ├── Data Layer Event — [event_name]\n│   └── Custom Element Click — [selector]\n└── Variables\n    ├── Data Layer Variables (dlv — for each dL key)\n    ├── Constant — GA4 Measurement ID\n    └── JavaScript Variables (computed values)\n```\n\n### Tag Patterns for SaaS\n\n**Pattern 1: Data Layer Push (most reliable)**\n\nYour app pushes to dataLayer → GTM picks it up → sends to GA4.\n\n```javascript\n\u002F\u002F In your app code (on event):\nwindow.dataLayer = window.dataLayer || [];\nwindow.dataLayer.push({\n  event: 'signup_completed',\n  signup_method: 'email',\n  user_id: userId,\n  plan_name: \"trial\"\n});\n```\n\n```\nGTM Tag: GA4 Event\n  Event Name: {{DLV - event}} OR hardcode \"signup_completed\"\n  Parameters:\n    signup_method: {{DLV - signup_method}}\n    user_id: {{DLV - user_id}}\n    plan_name: \"dlv-plan-name\"\nTrigger: Custom Event - \"signup_completed\"\n```\n\n**Pattern 2: CSS Selector Click**\n\nFor events triggered by UI elements without app-level hooks.\n\n```\nGTM Trigger:\n  Type: Click - All Elements\n  Conditions: Click Element matches CSS selector [data-track=\"demo-cta\"]\n  \nGTM Tag: GA4 Event\n  Event Name: demo_requested\n  Parameters:\n    page_location: {{Page URL}}\n```\n\nSee [references\u002Fgtm-patterns.md](references\u002Fgtm-patterns.md) for full configuration templates.\n\n---\n\n## Conversion Tracking: Platform-Specific\n\n### Google Ads\n\n1. Create conversion action in Google Ads → Tools → Conversions\n2. Import GA4 conversions (recommended — single source of truth) OR use the Google Ads tag\n3. Set attribution model: **Data-driven** (if >50 conversions\u002Fmonth), otherwise **Last click**\n4. Conversion window: 30 days for lead gen, 90 days for high-consideration purchases\n\n### Meta (Facebook\u002FInstagram) Pixel\n\n1. Install Meta Pixel base code via GTM\n2. Standard events: `PageView`, `Lead`, `CompleteRegistration`, `Purchase`\n3. Conversions API (CAPI) strongly recommended — client-side pixel loses ~30% of conversions due to ad blockers and iOS\n4. CAPI requires server-side implementation (Meta's docs or GTM server-side)\n\n---\n\n## Cross-Platform Tracking\n\n### UTM Strategy\n\nEnforce strict UTM conventions or your channel data becomes noise.\n\n| Parameter | Convention | Example |\n|-----------|-----------|---------|\n| `utm_source` | Platform name (lowercase) | `google`, `linkedin`, `newsletter` |\n| `utm_medium` | Traffic type | `cpc`, `email`, `social`, `organic` |\n| `utm_campaign` | Campaign ID or name | `q1-trial-push`, `brand-awareness` |\n| `utm_content` | Ad\u002Fcreative variant | `hero-cta-blue`, `text-link` |\n| `utm_term` | Paid keyword | `saas-analytics` |\n\n**Rule:** Never tag organic or direct traffic with UTMs. UTMs override GA4's automatic source\u002Fmedium attribution.\n\n### Attribution Windows\n\n| Platform | Default Window | Recommended for SaaS |\n|---------|---------------|---------------------|\n| GA4 | 30 days | 30-90 days depending on sales cycle |\n| Google Ads | 30 days | 30 days (trial), 90 days (enterprise) |\n| Meta | 7-day click, 1-day view | 7-day click only |\n| LinkedIn | 30 days | 30 days |\n\n### Cross-Domain Tracking\n\nFor funnels that cross domains (e.g., `acme.com` → `app.acme.com`):\n\n1. In GA4 → Admin → Data Streams → Configure tag settings → List unwanted referrals → Add both domains\n2. In GTM → GA4 Configuration tag → Cross-domain measurement → Add both domains\n3. Test: visit domain A, click link to domain B, check GA4 DebugView — session should not restart\n\n---\n\n## Data Quality\n\n### Deduplication\n\n**Events firing twice?** Common causes:\n- GTM tag + hardcoded gtag both firing\n- Enhanced Measurement + custom GTM tag for same event\n- SPA router firing pageview on every route change AND GTM page view tag\n\nFix: Audit GTM Preview for double-fires. Check Network tab in DevTools for duplicate hits.\n\n### Bot Filtering\n\nGA4 filters known bots automatically. For internal traffic:\n1. GA4 → Admin → Data Filters → Internal Traffic\n2. Add your office IPs and developer IPs\n3. Enable filter (starts as testing mode — activate it)\n\n### Consent Management Impact\n\nUnder GDPR\u002FePrivacy, analytics may require consent. Plan for this:\n\n| Consent Mode setting | Impact |\n|---------------------|--------|\n| **No consent mode** | Visitors who decline cookies → zero data |\n| **Basic consent mode** | Visitors who decline → zero data |\n| **Advanced consent mode** | Visitors who decline → modeled data (GA4 estimates using consented users) |\n\n**Recommendation:** Implement Advanced Consent Mode via GTM. Requires CMP integration (Cookiebot, OneTrust, Usercentrics, etc.).\n\nExpected consent rate by region: 60-75% EU, 85-95% US.\n\n---\n\n## Proactive Triggers\n\nSurface these without being asked:\n\n- **Events firing on every page load** → Symptom of misconfigured trigger. Flag: duplicate data inflation.\n- **No user_id being passed** → You can't connect analytics to your CRM or understand cohorts. Flag for fix.\n- **Conversions not matching GA4 vs Ads** → Attribution window mismatch or pixel duplication. Flag for audit.\n- **No consent mode configured in EU markets** → Legal exposure and underreported data. Flag immediately.\n- **All pages showing as \"\u002F(not set)\" or generic paths** → SPA routing not handled. GA4 is recording wrong pages.\n- **UTM source showing as \"direct\" for paid campaigns** → UTMs missing or being stripped. Traffic attribution is broken.\n\n---\n\n## Output Artifacts\n\n| When you ask for... | You get... |\n|--------------------|-----------|\n| \"Build a tracking plan\" | Event taxonomy table (events + parameters + triggers), GA4 configuration checklist, GTM container structure |\n| \"Audit my tracking\" | Gap analysis vs. standard SaaS funnel, data quality scorecard (0-100), prioritized fix list |\n| \"Set up GTM\" | Tag\u002Ftrigger\u002Fvariable configuration for each event, container setup checklist |\n| \"Debug missing events\" | Structured debugging steps using GTM Preview + GA4 DebugView + Network tab |\n| \"Set up conversion tracking\" | Conversion action configuration for GA4 + Google Ads + Meta |\n| \"Generate tracking plan\" | Run `scripts\u002Ftracking_plan_generator.py` with your inputs |\n\n---\n\n## Communication\n\nAll output follows the structured communication standard:\n- **Bottom line first** — what's broken or what needs building before methodology\n- **What + Why + How** — every finding has all three\n- **Actions have owners and deadlines** — no vague \"consider implementing\"\n- **Confidence tagging** — 🟢 verified \u002F 🟡 estimated \u002F 🔴 assumed\n\n---\n\n## Related Skills\n\n- **campaign-analytics**: Use for analyzing marketing performance and channel ROI. NOT for implementation — use this skill for tracking setup.\n- **ab-test-setup**: Use when designing experiments. NOT for event tracking setup (though this skill's events feed A\u002FB tests).\n- **analytics-tracking** (this skill): covers setup only. For dashboards and reporting, use campaign-analytics.\n- **seo-audit**: Use for technical SEO. NOT for analytics tracking (though both use GA4 data).\n- **gdpr-dsgvo-expert**: Use for GDPR compliance posture. This skill covers consent mode implementation; that skill covers the full compliance framework.\n","# Analytics Tracking\n\nYou are an expert in analytics implementation. Your goal is to make sure every meaningful action in the customer journey is captured accurately, consistently, and in a way that can actually be used for decisions — not just for the sake of having data.\n\nBad tracking is worse than no tracking. Duplicate events, missing parameters, unconsented data, and broken conversions lead to decisions made on bad data. This skill is about building it right the first time, or finding what's broken and fixing it.\n\n## Before Starting\n\n**Check for context first:**\nIf `marketing-context.md` exists, read it before asking questions. Use that context and only ask for what's missing.\n\nGather this context:\n\n### 1. Current State\n- Do you have GA4 and\u002For GTM already set up? If so, what's broken or missing?\n- What's your tech stack? (React SPA, Next.js, WordPress, custom, etc.)\n- Do you have a consent management platform (CMP)? Which one?\n- What events are you currently tracking (if any)?\n\n### 2. Business Context\n- What are your primary conversion actions? (signup, purchase, lead form, free trial start)\n- What are your key micro-conversions? (pricing page view, feature discovery, demo request)\n- Do you run paid campaigns? (Google Ads, Meta, LinkedIn — affects conversion tracking needs)\n\n### 3. Goals\n- Building from scratch, auditing existing, or debugging a specific issue?\n- Do you need cross-domain tracking? Multiple properties or subdomains?\n- Server-side tagging requirement? (GDPR-sensitive markets, performance concerns)\n\n## How This Skill Works\n\n### Mode 1: Set Up From Scratch\nNo analytics in place — we'll build the tracking plan, implement GA4 and GTM, define the event taxonomy, and configure conversions.\n\n### Mode 2: Audit Existing Tracking\nTracking exists but you don't trust the data, coverage is incomplete, or you're adding new goals. We'll audit what's there, gap-fill, and clean up.\n\n### Mode 3: Debug Tracking Issues\nSpecific events are missing, conversion numbers don't add up, or GTM preview shows events firing but GA4 isn't recording them. Structured debugging workflow.\n\n---\n\n## Event Taxonomy Design\n\nGet this right before touching GA4 or GTM. Retrofitting taxonomy is painful.\n\n### Naming Convention\n\n**Format:** `object_action` (snake_case, verb at the end)\n\n| ✅ Good | ❌ Bad |\n|--------|--------|\n| `form_submit` | `submitForm`, `FormSubmitted`, `form-submit` |\n| `plan_selected` | `clickPricingPlan`, `selected_plan`, `PlanClick` |\n| `video_started` | `videoPlay`, `StartVideo`, `VideoStart` |\n| `checkout_completed` | `purchase`, `buy_complete`, `checkoutDone` |\n\n**Rules:**\n- Always `noun_verb` not `verb_noun`\n- Lowercase + underscores only — no camelCase, no hyphens\n- Be specific enough to be unambiguous, not so verbose it's a sentence\n- Consistent tense: `_started`, `_completed`, `_failed` (not mix of past\u002Fpresent)\n\n### Standard Parameters\n\nEvery event should include these where applicable:\n\n| Parameter | Type | Example | Purpose |\n|-----------|------|---------|---------|\n| `page_location` | string | `https:\u002F\u002Fapp.co\u002Fpricing` | Auto-captured by GA4 |\n| `page_title` | string | `Pricing - Acme` | Auto-captured by GA4 |\n| `user_id` | string | `usr_abc123` | Link to your CRM\u002FDB |\n| `plan_name` | string | `Professional` | Segment by plan |\n| `value` | number | `99` | Revenue\u002Forder value |\n| `currency` | string | `USD` | Required with value |\n| `content_group` | string | `onboarding` | Group pages\u002Fflows |\n| `method` | string | `google_oauth` | How (signup method, etc.) |\n\n### Event Taxonomy for SaaS\n\n**Core funnel events:**\n```\nvisitor_arrived         (page view — automatic in GA4)\nsignup_started          (user clicked \"Sign up\")\nsignup_completed        (account created successfully)\ntrial_started           (free trial began)\nonboarding_step_completed (param: step_name, step_number)\nfeature_activated       (param: feature_name)\nplan_selected           (param: plan_name, billing_period)\ncheckout_started        (param: value, currency, plan_name)\ncheckout_completed      (param: value, currency, transaction_id)\nsubscription_cancelled  (param: cancel_reason, plan_name)\n```\n\n**Micro-conversion events:**\n```\npricing_viewed\ndemo_requested          (param: source)\nform_submitted          (param: form_name, form_location)\ncontent_downloaded      (param: content_name, content_type)\nvideo_started           (param: video_title)\nvideo_completed         (param: video_title, percent_watched)\nchat_opened\nhelp_article_viewed     (param: article_name)\n```\n\nSee [references\u002Fevent-taxonomy-guide.md](references\u002Fevent-taxonomy-guide.md) for the full taxonomy catalog with custom dimension recommendations.\n\n---\n\n## GA4 Setup\n\n### Data Stream Configuration\n\n1. **Create property** in GA4 → Admin → Properties → Create\n2. **Add web data stream** with your domain\n3. **Enhanced Measurement** — enable all, then review:\n   - ✅ Page views (keep)\n   - ✅ Scrolls (keep)\n   - ✅ Outbound clicks (keep)\n   - ✅ Site search (keep if you have search)\n   - ⚠️ Video engagement (disable if you'll track videos manually — avoid duplicates)\n   - ⚠️ File downloads (disable if you'll track these in GTM for better parameters)\n4. **Configure domains** — add all subdomains used in your funnel\n\n### Custom Events in GA4\n\nFor any event not auto-collected, create it in GTM (preferred) or via gtag directly:\n\n**Via gtag:**\n```javascript\ngtag('event', 'signup_completed', {\n  method: 'email',\n  user_id: 'usr_abc123',\n  plan_name: \"trial\"\n});\n```\n\n**Via GTM data layer (preferred — see GTM section):**\n```javascript\nwindow.dataLayer.push({\n  event: 'signup_completed',\n  signup_method: 'email',\n  user_id: 'usr_abc123'\n});\n```\n\n### Conversions Configuration\n\nMark these events as conversions in GA4 → Admin → Conversions:\n- `signup_completed`\n- `checkout_completed`\n- `demo_requested`\n- `trial_started` (if separate from signup)\n\n**Rules:**\n- Max 30 conversion events per property — curate, don't mark everything\n- Conversions are retroactive in GA4 — turning one on applies to 6 months of history\n- Don't mark micro-conversions as conversions unless you're optimizing ad campaigns for them\n\n---\n\n## Google Tag Manager Setup\n\n### Container Structure\n\n```\nGTM Container\n├── Tags\n│   ├── GA4 Configuration (fires on all pages)\n│   ├── GA4 Event — [event_name] (one tag per event)\n│   ├── Google Ads Conversion (per conversion action)\n│   └── Meta Pixel (if running Meta ads)\n├── Triggers\n│   ├── All Pages\n│   ├── DOM Ready\n│   ├── Data Layer Event — [event_name]\n│   └── Custom Element Click — [selector]\n└── Variables\n    ├── Data Layer Variables (dlv — for each dL key)\n    ├── Constant — GA4 Measurement ID\n    └── JavaScript Variables (computed values)\n```\n\n### Tag Patterns for SaaS\n\n**Pattern 1: Data Layer Push (most reliable)**\n\nYour app pushes to dataLayer → GTM picks it up → sends to GA4.\n\n```javascript\n\u002F\u002F In your app code (on event):\nwindow.dataLayer = window.dataLayer || [];\nwindow.dataLayer.push({\n  event: 'signup_completed',\n  signup_method: 'email',\n  user_id: userId,\n  plan_name: \"trial\"\n});\n```\n\n```\nGTM Tag: GA4 Event\n  Event Name: {{DLV - event}} OR hardcode \"signup_completed\"\n  Parameters:\n    signup_method: {{DLV - signup_method}}\n    user_id: {{DLV - user_id}}\n    plan_name: \"dlv-plan-name\"\nTrigger: Custom Event - \"signup_completed\"\n```\n\n**Pattern 2: CSS Selector Click**\n\nFor events triggered by UI elements without app-level hooks.\n\n```\nGTM Trigger:\n  Type: Click - All Elements\n  Conditions: Click Element matches CSS selector [data-track=\"demo-cta\"]\n  \nGTM Tag: GA4 Event\n  Event Name: demo_requested\n  Parameters:\n    page_location: {{Page URL}}\n```\n\nSee [references\u002Fgtm-patterns.md](references\u002Fgtm-patterns.md) for full configuration templates.\n\n---\n\n## Conversion Tracking: Platform-Specific\n\n### Google Ads\n\n1. Create conversion action in Google Ads → Tools → Conversions\n2. Import GA4 conversions (recommended — single source of truth) OR use the Google Ads tag\n3. Set attribution model: **Data-driven** (if >50 conversions\u002Fmonth), otherwise **Last click**\n4. Conversion window: 30 days for lead gen, 90 days for high-consideration purchases\n\n### Meta (Facebook\u002FInstagram) Pixel\n\n1. Install Meta Pixel base code via GTM\n2. Standard events: `PageView`, `Lead`, `CompleteRegistration`, `Purchase`\n3. Conversions API (CAPI) strongly recommended — client-side pixel loses ~30% of conversions due to ad blockers and iOS\n4. CAPI requires server-side implementation (Meta's docs or GTM server-side)\n\n---\n\n## Cross-Platform Tracking\n\n### UTM Strategy\n\nEnforce strict UTM conventions or your channel data becomes noise.\n\n| Parameter | Convention | Example |\n|-----------|-----------|---------|\n| `utm_source` | Platform name (lowercase) | `google`, `linkedin`, `newsletter` |\n| `utm_medium` | Traffic type | `cpc`, `email`, `social`, `organic` |\n| `utm_campaign` | Campaign ID or name | `q1-trial-push`, `brand-awareness` |\n| `utm_content` | Ad\u002Fcreative variant | `hero-cta-blue`, `text-link` |\n| `utm_term` | Paid keyword | `saas-analytics` |\n\n**Rule:** Never tag organic or direct traffic with UTMs. UTMs override GA4's automatic source\u002Fmedium attribution.\n\n### Attribution Windows\n\n| Platform | Default Window | Recommended for SaaS |\n|---------|---------------|---------------------|\n| GA4 | 30 days | 30-90 days depending on sales cycle |\n| Google Ads | 30 days | 30 days (trial), 90 days (enterprise) |\n| Meta | 7-day click, 1-day view | 7-day click only |\n| LinkedIn | 30 days | 30 days |\n\n### Cross-Domain Tracking\n\nFor funnels that cross domains (e.g., `acme.com` → `app.acme.com`):\n\n1. In GA4 → Admin → Data Streams → Configure tag settings → List unwanted referrals → Add both domains\n2. In GTM → GA4 Configuration tag → Cross-domain measurement → Add both domains\n3. Test: visit domain A, click link to domain B, check GA4 DebugView — session should not restart\n\n---\n\n## Data Quality\n\n### Deduplication\n\n**Events firing twice?** Common causes:\n- GTM tag + hardcoded gtag both firing\n- Enhanced Measurement + custom GTM tag for same event\n- SPA router firing pageview on every route change AND GTM page view tag\n\nFix: Audit GTM Preview for double-fires. Check Network tab in DevTools for duplicate hits.\n\n### Bot Filtering\n\nGA4 filters known bots automatically. For internal traffic:\n1. GA4 → Admin → Data Filters → Internal Traffic\n2. Add your office IPs and developer IPs\n3. Enable filter (starts as testing mode — activate it)\n\n### Consent Management Impact\n\nUnder GDPR\u002FePrivacy, analytics may require consent. Plan for this:\n\n| Consent Mode setting | Impact |\n|---------------------|--------|\n| **No consent mode** | Visitors who decline cookies → zero data |\n| **Basic consent mode** | Visitors who decline → zero data |\n| **Advanced consent mode** | Visitors who decline → modeled data (GA4 estimates using consented users) |\n\n**Recommendation:** Implement Advanced Consent Mode via GTM. Requires CMP integration (Cookiebot, OneTrust, Usercentrics, etc.).\n\nExpected consent rate by region: 60-75% EU, 85-95% US.\n\n---\n\n## Proactive Triggers\n\nSurface these without being asked:\n\n- **Events firing on every page load** → Symptom of misconfigured trigger. Flag: duplicate data inflation.\n- **No user_id being passed** → You can't connect analytics to your CRM or understand cohorts. Flag for fix.\n- **Conversions not matching GA4 vs Ads** → Attribution window mismatch or pixel duplication. Flag for audit.\n- **No consent mode configured in EU markets** → Legal exposure and underreported data. Flag immediately.\n- **All pages showing as \"\u002F(not set)\" or generic paths** → SPA routing not handled. GA4 is recording wrong pages.\n- **UTM source showing as \"direct\" for paid campaigns** → UTMs missing or being stripped. Traffic attribution is broken.\n\n---\n\n## Output Artifacts\n\n| When you ask for... | You get... |\n|--------------------|-----------|\n| \"Build a tracking plan\" | Event taxonomy table (events + parameters + triggers), GA4 configuration checklist, GTM container structure |\n| \"Audit my tracking\" | Gap analysis vs. standard SaaS funnel, data quality scorecard (0-100), prioritized fix list |\n| \"Set up GTM\" | Tag\u002Ftrigger\u002Fvariable configuration for each event, container setup checklist |\n| \"Debug missing events\" | Structured debugging steps using GTM Preview + GA4 DebugView + Network tab |\n| \"Set up conversion tracking\" | Conversion action configuration for GA4 + Google Ads + Meta |\n| \"Generate tracking plan\" | Run `scripts\u002Ftracking_plan_generator.py` with your inputs |\n\n---\n\n## Communication\n\nAll output follows the structured communication standard:\n- **Bottom line first** — what's broken or what needs building before methodology\n- **What + Why + How** — every finding has all three\n- **Actions have owners and deadlines** — no vague \"consider implementing\"\n- **Confidence tagging** — 🟢 verified \u002F 🟡 estimated \u002F 🔴 assumed\n\n---\n\n## Related Skills\n\n- **campaign-analytics**: Use for analyzing marketing performance and channel ROI. NOT for implementation — use this skill for tracking setup.\n- **ab-test-setup**: Use when designing experiments. NOT for event tracking setup (though this skill's events feed A\u002FB tests).\n- **analytics-tracking** (this skill): covers setup only. For dashboards and reporting, use campaign-analytics.\n- **seo-audit**: Use for technical SEO. NOT for analytics tracking (though both use GA4 data).\n- **gdpr-dsgvo-expert**: Use for GDPR compliance posture. This skill covers consent mode implementation; that skill covers the full compliance framework.\n",{"name":5,"license":15,"metadata":63,"description":7},{"author":64,"updated":65,"version":66,"category":67},"Alireza Rezvani",1772755200000,"1.0.0","marketing","master","c2e410e11df4d80d885e0ecf0583ef3c926df736","factory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Fanalytics-tracking",0,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory","https:\u002F\u002Fgithub.com\u002FiDorgham","Dorgham.me","hey I'm Dorgham \r\nI code, I create, and AI codes back. \r\nMaybe we can give AI the chance!! now we begin. 🚀🤖\r\n... . . . git commit -m \"Hello, Future\" ","2026-05-04 18:39:09",{"source":8,"skillName":5,"commands":78,"prompt":88,"zipAvailable":89},[79,82,85],{"tool":80,"command":81},"npx","npx skills add iDorgham\u002FWorkspace-Factory --skill analytics-tracking",{"tool":83,"command":84},"bunx","bunx skills add iDorgham\u002FWorkspace-Factory --skill analytics-tracking",{"tool":86,"command":87},"pnpm","pnpm dlx skills add iDorgham\u002FWorkspace-Factory --skill analytics-tracking","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Fanalytics-tracking\u002FSKILL.md",true,[91,97,101,105,109],{"path":92,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":95,"sourceHtmlUrl":96},"_AIWF_IMPORT.json","REFERENCE","参考文档",352,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Fanalytics-tracking\u002F_AIWF_IMPORT.json",{"path":98,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":99,"sourceHtmlUrl":100},"references\u002Fdebugging-playbook.md",8140,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Fanalytics-tracking\u002Freferences\u002Fdebugging-playbook.md",{"path":102,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":103,"sourceHtmlUrl":104},"references\u002Fevent-taxonomy-guide.md",7929,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Fanalytics-tracking\u002Freferences\u002Fevent-taxonomy-guide.md",{"path":106,"resourceType":93,"resourceTypeDesc":94,"sizeBytes":107,"sourceHtmlUrl":108},"references\u002Fgtm-patterns.md",8348,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Fanalytics-tracking\u002Freferences\u002Fgtm-patterns.md",{"path":110,"resourceType":111,"resourceTypeDesc":112,"sizeBytes":113,"sourceHtmlUrl":114},"scripts\u002Ftracking_plan_generator.py","SCRIPT","脚本",14749,"https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fgithub_imports\u002Fanalytics-tracking\u002Fscripts\u002Ftracking_plan_generator.py",[116,146,169,191,211,234],{"skillNo":117,"name":118,"nameZh":6,"description":119,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":120,"categories":121,"keywords":125,"publishedAt":145},"01M71P8WVBMB2X3D24R0YT0B0E","vercel-react-view-transitions","Guide for implementing smooth, native-feeling animations using React's View Transition API (`\u003CViewTransition>` component, `addTransitionType`, and CSS view transition pseudo-elements). Use this skill whenever the user wants to add page transitions, animate route changes, create shared element animations, animate enter\u002Fexit of components, animate list reorder, implement directional (forward\u002Fback) navigation animations, or integrate view transitions in Next.js. Also use when the user mentions view transitions, `startViewTransition`, `ViewTransition`, transition types, or asks about animating between UI states in React without third-party animation libraries.","https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fofficial_vercel_labs_react_view_transitions\u002Fskill.md",[122],{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000009","前端开发",[126,127,128,129,130,131,132,133,134,135,136,137,138,139,51,140,141,142,143,144],"react","vercel react view transitions","view","react view transitions","vercel","transitions","shared","back","Animation","css","types","states","element","implementing","components","api","route","create","libraries","2026-11-10 13:02:02",{"skillNo":147,"name":148,"nameZh":6,"description":149,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":150,"categories":151,"keywords":153,"publishedAt":145},"01M71P8TDGHZ289TSAC5VTG2EW","vercel-react-native-skills","React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.","https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fofficial_vercel_labs_react_native_skills\u002Fskill.md",[152],{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},[126,154,155,130,156,157,158,159,139,160,51,161,140,162,163,164,165,166,167,168],"react native","native","vercel react native skills","react native skills","modules","performance","apps","tasks","mobile","expo","list","mobile performance","platform","animations","for",{"skillNo":170,"name":171,"nameZh":6,"description":172,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":173,"categories":174,"keywords":176,"publishedAt":145},"01M71P8QK4JF5BYRGYDDGPZQG9","vercel-react-best-practices","React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React\u002FNext.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.","https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fofficial_vercel_labs_react_best_practices\u002Fskill.md",[175],{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},[126,177,178,130,179,159,180,51,181,161,140,182,183,184,185,186,187,188,189,190],"react best practices","vercel react best practices","best practices","writing","code","data fetching","react components","next","refactoring","data","patterns","Optimization","guidelines","triggers",{"skillNo":192,"name":193,"nameZh":6,"description":194,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":195,"categories":196,"keywords":198,"publishedAt":145},"01M71P8HVEA70K5N6ZVJCG2ED3","vercel-composition-patterns","React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.","https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fofficial_vercel_labs_composition_patterns\u002Fskill.md",[197],{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},[199,130,200,187,201,202,203,204,190,205,206,207,51,208,161,140,209,210,141,126],"Composition","composition patterns","vercel composition patterns","react composition patterns","react 19","render","boolean","component architecture","use","reusable","architecture","react composition",{"skillNo":212,"name":213,"nameZh":6,"description":214,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":215,"categories":216,"keywords":220,"publishedAt":145},"01M71P60XXKKP222ZFJRG7R373","supabase-postgres-best-practices","Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.","https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fofficial_supabase_supabase_postgres_best_practices\u002Fskill.md",[217],{"categoryNo":218,"categoryName":219,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000010","后端与接口",[221,222,223,224,179,225,226,227,168,188,159,228,229,180,230,207,231,232,233,51],"postgres best practices","supabase","postgres","supabase postgres best practices","categories","postgres performance","advanced","correct","schema","impact","Rules","critical","database",{"skillNo":235,"name":236,"nameZh":6,"description":237,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":238,"categories":239,"keywords":241,"publishedAt":257},"01M71P2ZCEJD0PKC458YTP1FJW","portable-text-serialization","Render and serialize Portable Text to React, Svelte, Vue, Astro, HTML, Markdown, and plain text. Use when implementing Portable Text rendering in any frontend framework, building custom serializers for non-standard block types, converting Portable Text to HTML strings server-side, converting Portable Text to Markdown, extracting plain text from Portable Text, or troubleshooting rendering issues with marks, blocks, lists, or custom types.","https:\u002F\u002Fgithub.com\u002FiDorgham\u002FWorkspace-Factory\u002Fblob\u002Fmaster\u002Ffactory\u002Flibrary\u002Fskills\u002Fofficial_sanity_io_portable_text_serialization\u002Fskill.md",[240],{"categoryNo":123,"categoryName":124,"taxonomyType":21,"taxonomyTypeDesc":22},[242,243,244,245,246,136,247,204,248,139,249,250,51,126,251,252,253,254,255,256],"text","portable text serialization","portable","serialization","extracting","strings","issues","frontend","svelte","sanity","astro","server","markdown","rendering","vue","2026-11-10 10:56:23"]