$npx -y skills add LeoYeAI/openclaw-marketing-skills --skill analytics-trackingWhen the user wants to set up, improve, or audit analytics tracking and measurement. Also use when the user mentions "set up tracking," "GA4," "Google Analytics," "conversion tracking," "event tracking," "UTM parameters," "tag manager," "GTM," "analytics implementation," "trackin
| 1 | # Analytics Tracking |
| 2 | |
| 3 | You are an expert in analytics implementation and measurement. Your goal is to help set up tracking that provides actionable insights for marketing and product decisions. |
| 4 | |
| 5 | ## Initial Assessment |
| 6 | |
| 7 | **Check for product marketing context first:** |
| 8 | If `.agents/product-marketing-context.md` exists (or `.agents/product-marketing-context.md` in older setups), read it before asking questions. Use that context and only ask for information not already covered or specific to this task. |
| 9 | |
| 10 | Before implementing tracking, understand: |
| 11 | |
| 12 | 1. **Business Context** - What decisions will this data inform? What are key conversions? |
| 13 | 2. **Current State** - What tracking exists? What tools are in use? |
| 14 | 3. **Technical Context** - What's the tech stack? Any privacy/compliance requirements? |
| 15 | |
| 16 | --- |
| 17 | |
| 18 | ## Core Principles |
| 19 | |
| 20 | ### 1. Track for Decisions, Not Data |
| 21 | - Every event should inform a decision |
| 22 | - Avoid vanity metrics |
| 23 | - Quality > quantity of events |
| 24 | |
| 25 | ### 2. Start with the Questions |
| 26 | - What do you need to know? |
| 27 | - What actions will you take based on this data? |
| 28 | - Work backwards to what you need to track |
| 29 | |
| 30 | ### 3. Name Things Consistently |
| 31 | - Naming conventions matter |
| 32 | - Establish patterns before implementing |
| 33 | - Document everything |
| 34 | |
| 35 | ### 4. Maintain Data Quality |
| 36 | - Validate implementation |
| 37 | - Monitor for issues |
| 38 | - Clean data > more data |
| 39 | |
| 40 | --- |
| 41 | |
| 42 | ## Tracking Plan Framework |
| 43 | |
| 44 | ### Structure |
| 45 | |
| 46 | ``` |
| 47 | Event Name | Category | Properties | Trigger | Notes |
| 48 | ---------- | -------- | ---------- | ------- | ----- |
| 49 | ``` |
| 50 | |
| 51 | ### Event Types |
| 52 | |
| 53 | | Type | Examples | |
| 54 | |------|----------| |
| 55 | | Pageviews | Automatic, enhanced with metadata | |
| 56 | | User Actions | Button clicks, form submissions, feature usage | |
| 57 | | System Events | Signup completed, purchase, subscription changed | |
| 58 | | Custom Conversions | Goal completions, funnel stages | |
| 59 | |
| 60 | **For comprehensive event lists**: See [references/event-library.md](references/event-library.md) |
| 61 | |
| 62 | --- |
| 63 | |
| 64 | ## Event Naming Conventions |
| 65 | |
| 66 | ### Recommended Format: Object-Action |
| 67 | |
| 68 | ``` |
| 69 | signup_completed |
| 70 | button_clicked |
| 71 | form_submitted |
| 72 | article_read |
| 73 | checkout_payment_completed |
| 74 | ``` |
| 75 | |
| 76 | ### Best Practices |
| 77 | - Lowercase with underscores |
| 78 | - Be specific: `cta_hero_clicked` vs. `button_clicked` |
| 79 | - Include context in properties, not event name |
| 80 | - Avoid spaces and special characters |
| 81 | - Document decisions |
| 82 | |
| 83 | --- |
| 84 | |
| 85 | ## Essential Events |
| 86 | |
| 87 | ### Marketing Site |
| 88 | |
| 89 | | Event | Properties | |
| 90 | |-------|------------| |
| 91 | | cta_clicked | button_text, location | |
| 92 | | form_submitted | form_type | |
| 93 | | signup_completed | method, source | |
| 94 | | demo_requested | - | |
| 95 | |
| 96 | ### Product/App |
| 97 | |
| 98 | | Event | Properties | |
| 99 | |-------|------------| |
| 100 | | onboarding_step_completed | step_number, step_name | |
| 101 | | feature_used | feature_name | |
| 102 | | purchase_completed | plan, value | |
| 103 | | subscription_cancelled | reason | |
| 104 | |
| 105 | **For full event library by business type**: See [references/event-library.md](references/event-library.md) |
| 106 | |
| 107 | --- |
| 108 | |
| 109 | ## Event Properties |
| 110 | |
| 111 | ### Standard Properties |
| 112 | |
| 113 | | Category | Properties | |
| 114 | |----------|------------| |
| 115 | | Page | page_title, page_location, page_referrer | |
| 116 | | User | user_id, user_type, account_id, plan_type | |
| 117 | | Campaign | source, medium, campaign, content, term | |
| 118 | | Product | product_id, product_name, category, price | |
| 119 | |
| 120 | ### Best Practices |
| 121 | - Use consistent property names |
| 122 | - Include relevant context |
| 123 | - Don't duplicate automatic properties |
| 124 | - Avoid PII in properties |
| 125 | |
| 126 | --- |
| 127 | |
| 128 | ## GA4 Implementation |
| 129 | |
| 130 | ### Quick Setup |
| 131 | |
| 132 | 1. Create GA4 property and data stream |
| 133 | 2. Install gtag.js or GTM |
| 134 | 3. Enable enhanced measurement |
| 135 | 4. Configure custom events |
| 136 | 5. Mark conversions in Admin |
| 137 | |
| 138 | ### Custom Event Example |
| 139 | |
| 140 | ```javascript |
| 141 | gtag('event', 'signup_completed', { |
| 142 | 'method': 'email', |
| 143 | 'plan': 'free' |
| 144 | }); |
| 145 | ``` |
| 146 | |
| 147 | **For detailed GA4 implementation**: See [references/ga4-implementation.md](references/ga4-implementation.md) |
| 148 | |
| 149 | --- |
| 150 | |
| 151 | ## Google Tag Manager |
| 152 | |
| 153 | ### Container Structure |
| 154 | |
| 155 | | Component | Purpose | |
| 156 | |-----------|---------| |
| 157 | | Tags | Code that executes (GA4, pixels) | |
| 158 | | Triggers | When tags fire (page view, click) | |
| 159 | | Variables | Dynamic values (click text, data layer) | |
| 160 | |
| 161 | ### Data Layer Pattern |
| 162 | |
| 163 | ```javascript |
| 164 | dataLayer.push({ |
| 165 | 'event': 'form_submitted', |
| 166 | 'form_name': 'contact', |
| 167 | 'form_location': 'footer' |
| 168 | }); |
| 169 | ``` |
| 170 | |
| 171 | **For detailed GTM implementation**: See [references/gtm-implementation.md](references/gtm-implementation.md) |
| 172 | |
| 173 | --- |
| 174 | |
| 175 | ## UTM Parameter Strategy |
| 176 | |
| 177 | ### Standard Parameters |
| 178 | |
| 179 | | Parameter | Purpose | Example | |
| 180 | |-----------|---------|---------| |
| 181 | | utm_source | Traffi |