Loading...
Loading...
Strategic GTM tracking planning with product manager expertise. Use when users need to plan tracking strategy, define what metrics to measure, understand business impact of tracking, create tracking specifications, or need guidance on "what should I track?" questions. Asks discovery questions about business goals, maps objectives to events, defines event taxonomy, and creates structured tracking plans. Trigger on - "plan GTM tracking", "what should I track", "create tracking plan", "define measurement strategy", "GTM strategy".
npx skill4agent add aimonk2025/google-tag-manager-automation gtm-strategygtm-context.mdaudit-report.jsonCheck if audit-report.json exists in the project root.
If audit-report.json EXISTS:
Read it - all element and tracking data is already here. No codebase scanning needed.
Extract:
- metadata.framework → framework and version
- summary → total elements, tracking coverage percentage
- categorized → CTAs, nav, forms, media, outbound counts and element details
- existingTracking.patterns → what is already being tracked
- issues → naming and gap analysis already done
- recommendations → already prioritized
Note: "Using audit-report.json from gtm-analytics-audit"
If audit-report.json NOT FOUND:
Note: "audit-report.json not found - scanning codebase directly. Run gtm-analytics-audit first to skip this step in future runs."
Check package.json:
- React, Next.js, Vue version
- Routing approach (App Router vs Pages Router)
- Existing analytics libraries (GA4, Segment, etc.)
Use Glob to find component files:
- app/**/*.tsx (Next.js App Router)
- pages/**/*.tsx (Next.js Pages Router)
- components/**/*.{tsx,jsx,vue}
Use Grep to find analytics-ready elements:
- class=".*js-track.*"
- id="(cta|nav|form|video)_.*"
- window.dataLayer.pushCount elements by category:
- CTAs (from audit report categorized.cta or js-cta scan)
- Navigation (from audit report categorized.nav or js-nav scan)
- Forms (from audit report categorized.form or js-form scan)
- Media (from audit report categorized.media or video_/audio_ scan)
- Outbound links (from audit report categorized.outbound or js-outbound scan)From audit-report.json existingTracking OR direct scan:
- window.dataLayer.push calls
- analytics.track calls
- Custom tracking implementations
Identify gaps:
- Elements WITH analytics classes but NO dataLayer code
- Elements WITHOUT any tracking[Source: audit-report.json / codebase scan]
Found trackable elements:
✓ 12 buttons/CTAs
✓ 8 navigation links
✓ 3 forms
✓ 1 video player
✓ 5 external links
Existing tracking:
✓ 15 elements already have dataLayer.push()
✗ 17 elements missing tracking code
Framework detected: Next.js 16 (App Router)For each category found, suggest events:
CTAs found (12) → Suggest: cta_click
├─ Parameters: cta_location, cta_type, cta_text, cta_destination
├─ Priority: P0 (Critical - 80% impact)
├─ Business Value: "Measures conversion intent on primary actions"
└─ Reporting Impact: "CTA Performance Dashboard, Conversion Funnel"
Forms found (3) → Suggest: form_submit, form_start, form_error
├─ Parameters: form_name, form_location, form_type
├─ Priority: P0 (Critical)
├─ Business Value: "Captures lead submissions and form abandonment"
└─ Reporting Impact: "Lead Generation Report, Form Completion Funnel"
Navigation found (8) → Suggest: navigation_click
├─ Parameters: nav_location, nav_type, nav_text, nav_destination
├─ Priority: P1 (Important - 15% impact)
├─ Business Value: "Tracks user journey and content discovery"
└─ Reporting Impact: "Navigation Paths, Content Engagement"
Video found (1) → Suggest: video_play, video_progress, video_complete
├─ Parameters: video_title, video_location, video_duration
├─ Priority: P1 (Important)
├─ Business Value: "Measures content engagement"
└─ Reporting Impact: "Video Engagement Report"
Outbound links found (5) → Suggest: outbound_click
├─ Parameters: outbound_location, outbound_destination, outbound_text
├─ Priority: P2 (Nice-to-have - 5% impact)
├─ Business Value: "Tracks referral traffic and external engagement"
└─ Reporting Impact: "Partner Click-Through Rates"Analyze codebase patterns to infer business type:
If found: Pricing tiers + trial CTAs → SaaS
If found: Shopping cart + product pages → E-commerce
If found: Contact forms + content → Lead Generation
If found: Blog + newsletter → Content/Publishing
Based on business type, recommend additional events:
SaaS Pattern:
- trial_start, feature_usage, upgrade_click
- account_created, plan_selected
E-commerce Pattern:
- product_view, add_to_cart, checkout_start
- purchase_complete, product_search
Lead-Gen Pattern:
- form_start, content_download, demo_request
- newsletter_signup, resource_access
Content Pattern:
- article_view, share_click, comment_submit
- newsletter_signup, bookmarkgtm-context.mdI found 12 CTA buttons in your codebase.
Q1: What's your primary business goal for this site?
Options:
a) Lead generation (capture contact info)
b) Direct sales/conversions
c) User engagement/retention
d) Content consumption
e) Product trial signups
[Wait for user response]Based on your answer, ask follow-up questions:
If Lead Generation:
Q2: Which CTAs are most important for lead capture?
→ Examples from scanned code: "Start Free Trial" (hero), "Book Demo" (pricing)
Q3: What defines a qualified lead for your business?
→ Form completion? Specific page visits? Content downloads?
If Direct Sales:
Q2: What's your typical conversion funnel?
→ Landing → Product Page → Cart → Checkout?
Q3: Which micro-conversions matter most?
→ Add to cart? Wishlist? Product compare?
If User Engagement:
Q2: What user actions indicate strong engagement?
→ Feature usage? Time on site? Return visits?
Q3: What behaviors predict retention?
→ Specific features used? Content consumed?For each high-priority element category:
Q: What decisions will [CTA/form/navigation] tracking inform?
Examples:
- "A/B testing button copy"
- "Optimizing placement of CTAs"
- "Identifying drop-off points in funnel"
- "Understanding user journey patterns"
- "Measuring campaign effectiveness"
This ensures every tracked event has actionable business value.If user wants to track EVERYTHING, push back strategically:
"I see you want to track all 47 elements. Let's prioritize:
P0 (Must have - 80% of value):
- 12 CTAs (conversion intent)
- 3 forms (lead capture)
Total: 15 events
P1 (Should have - 15% of value):
- 8 navigation links (user journey)
- 1 video (engagement)
Total: 9 events
P2 (Nice to have - 5% of value):
- 5 outbound links (referral tracking)
Total: 5 events
Recommendation: Start with P0 (15 events). Add P1/P2 after you're using P0 data to make decisions.
Sound good?"
[This prevents analysis paralysis and focuses on high-impact tracking]Based on inferred business model, check for standard events:
E-commerce Standard Tracking:
✓ Product views - NOT FOUND in your codebase
✓ Add to cart - NOT FOUND
✓ Checkout steps - NOT FOUND
✗ CTA clicks - FOUND (12 CTAs)
✗ Navigation - FOUND (8 links)
Analysis:
Your site appears to be lead-gen focused, not e-commerce.
Skip product tracking. Focus on:
- Form tracking (lead capture) - CRITICAL
- CTA tracking (conversion intent) - CRITICAL
- Navigation (user journey) - IMPORTANT
Recommendation: Your tracking plan should prioritize form_submit and cta_click events.Check for common gaps:
Found 3 forms but no form_start tracking:
⚠ Recommendation: Add form_start event to measure abandonment
→ Impact: "Identify which form fields cause drop-off"
Found video but no progress tracking:
⚠ Recommendation: Add video_progress event at 25%, 50%, 75%
→ Impact: "Understand engagement depth, not just play clicks"
Found checkout flow but no step tracking:
⚠ Recommendation: Add checkout_step event for each stage
→ Impact: "Identify exactly where users abandon checkout"Choose naming pattern (present both, recommend one):
Option 1: object_action (Recommended for GA4)
- cta_click, form_submit, video_play
- Pros: Aligns with GA4 conventions, clear hierarchy
- Cons: Slightly longer
Option 2: action_object
- click_cta, submit_form, play_video
- Pros: Action-first mindset
- Cons: Less common in GA4
Recommendation: Use object_action pattern for GA4 compatibility.For each event, define consistent parameters:
Event: cta_click
Parameters:
- cta_location (string) - Where on page: "hero", "pricing", "footer"
→ Source: Extracted from element ID "cta_{location}_action"
- cta_type (string) - Visual style: "primary", "secondary", "text"
→ Source: Inferred from CSS classes or explicit attribute
- cta_text (string) - Button text: "Get Started", "Book Demo"
→ Source: Element innerText
- cta_destination (string) - Target URL/action: "/signup", "#contact"
→ Source: href attribute or onClick destination
Event: form_submit
Parameters:
- form_name (string) - Form identifier: "newsletter_signup", "contact"
→ Source: Form ID attribute
- form_location (string) - Page location: "footer", "hero", "sidebar"
→ Source: Extracted from form ID
- form_type (string) - Purpose: "email_capture", "contact_request"
→ Source: Inferred from fields (email-only = email_capture)gtm-tracking-plan.json{
"metadata": {
"createdDate": "2026-02-11T10:30:00Z",
"businessModel": "SaaS - Lead Generation",
"framework": "Next.js 16.1.6 (App Router)",
"primaryGoal": "Lead generation through trial signups and demo requests"
},
"events": [
{
"name": "cta_click",
"priority": "P0",
"businessValue": "Measures conversion intent on 12 primary CTAs",
"decisionImpact": "A/B test button copy, optimize CTA placement, measure campaign effectiveness",
"parameters": [
{
"name": "cta_location",
"type": "string",
"example": "hero",
"source": "DOM id attribute (cta_{location}_action)",
"required": true
},
{
"name": "cta_type",
"type": "string",
"example": "primary",
"source": "CSS class inference",
"required": false
},
{
"name": "cta_text",
"type": "string",
"example": "Start Free Trial",
"source": "Button innerText",
"required": true
},
{
"name": "cta_destination",
"type": "string",
"example": "/signup",
"source": "href or onClick destination",
"required": true
}
],
"elementsFound": 12,
"elementsTracked": 4,
"gap": 8,
"reportingImpact": [
"CTA Performance Dashboard (by location, type, text)",
"Conversion Funnel Analysis (CTA click → Signup → Trial start)",
"Campaign Attribution (UTM + CTA click data)"
],
"recommendedReports": [
"GA4 Exploration: Top CTAs by conversion rate",
"GA4 Funnel: Homepage → CTA click → Form submit → Signup",
"Custom Dashboard: CTA heatmap by page section"
]
},
{
"name": "form_submit",
"priority": "P0",
"businessValue": "Captures lead submissions across 3 forms",
"decisionImpact": "Measure form completion rate, identify abandonment points, optimize form fields",
"parameters": [
{
"name": "form_name",
"type": "string",
"example": "newsletter_signup",
"source": "Form id attribute",
"required": true
},
{
"name": "form_location",
"type": "string",
"example": "footer",
"source": "Extracted from form id",
"required": true
},
{
"name": "form_type",
"type": "string",
"example": "email_capture",
"source": "Inferred from form fields",
"required": true
}
],
"elementsFound": 3,
"elementsTracked": 0,
"gap": 3,
"reportingImpact": [
"Lead Generation Report (by form, location)",
"Form Completion Funnel (form_start → form_submit)",
"Form Abandonment Analysis"
],
"recommendedReports": [
"GA4 Exploration: Form completion rate by type",
"GA4 Funnel: Form start → Form submit → Success page",
"Custom Alert: Form completion drops below 40%"
]
},
{
"name": "form_start",
"priority": "P0",
"businessValue": "Identifies form abandonment (users who start but don't submit)",
"decisionImpact": "Calculate abandonment rate, identify problematic form fields",
"parameters": [
{
"name": "form_name",
"type": "string",
"example": "contact_form",
"source": "Form id attribute",
"required": true
},
{
"name": "form_location",
"type": "string",
"example": "hero",
"source": "Extracted from form id",
"required": true
}
],
"elementsFound": 3,
"elementsTracked": 0,
"gap": 3,
"reportingImpact": [
"Form Abandonment Rate = (form_start - form_submit) / form_start",
"Time to Complete = form_submit timestamp - form_start timestamp"
]
},
{
"name": "navigation_click",
"priority": "P1",
"businessValue": "Tracks user journey and content discovery patterns",
"decisionImpact": "Optimize menu structure, identify popular pages, understand user paths",
"parameters": [
{
"name": "nav_location",
"type": "string",
"example": "header",
"source": "DOM id or class context",
"required": true
},
{
"name": "nav_type",
"type": "string",
"example": "menu_link",
"source": "Element context (menu vs footer vs breadcrumb)",
"required": false
},
{
"name": "nav_text",
"type": "string",
"example": "Pricing",
"source": "Link innerText",
"required": true
},
{
"name": "nav_destination",
"type": "string",
"example": "/pricing",
"source": "href attribute",
"required": true
}
],
"elementsFound": 8,
"elementsTracked": 2,
"gap": 6,
"reportingImpact": [
"Navigation Paths Report",
"Popular Pages by navigation source",
"User Journey Visualization"
]
},
{
"name": "video_play",
"priority": "P1",
"businessValue": "Measures video engagement and content effectiveness",
"decisionImpact": "Identify engaging video content, optimize video placement",
"parameters": [
{
"name": "video_title",
"type": "string",
"example": "product_demo",
"source": "Video element id or data attribute",
"required": true
},
{
"name": "video_location",
"type": "string",
"example": "hero",
"source": "Extracted from video id",
"required": true
},
{
"name": "video_duration",
"type": "number",
"example": 120,
"source": "Video element duration property",
"required": false
}
],
"elementsFound": 1,
"elementsTracked": 0,
"gap": 1,
"reportingImpact": [
"Video Engagement Report (play rate, completion rate)",
"Correlation: Video play → CTA click → Conversion"
]
}
],
"summary": {
"totalEvents": 5,
"p0Events": 3,
"p1Events": 2,
"p2Events": 0,
"totalElements": 30,
"tracked": 6,
"untracked": 24,
"estimatedImplementationTime": "2-3 hours with gtm-implementation skill"
},
"recommendedReports": [
{
"name": "Conversion Funnel",
"type": "GA4 Funnel Exploration",
"steps": [
"Page View",
"cta_click (hero)",
"form_start (contact)",
"form_submit (contact)",
"Thank You Page View"
],
"businessValue": "Identify drop-off points in conversion path"
},
{
"name": "CTA Performance Dashboard",
"type": "Custom Dashboard",
"metrics": [
"CTA clicks by location",
"CTA clicks by type",
"CTA conversion rate (CTA click → form submit)"
],
"businessValue": "Optimize CTA placement and design"
},
{
"name": "Lead Generation Report",
"type": "GA4 Custom Report",
"metrics": [
"Form submissions by form type",
"Form abandonment rate",
"Time to complete form"
],
"businessValue": "Improve form completion rates"
}
],
"audienceDefinitions": [
{
"name": "High-Intent Visitors",
"criteria": "Users who clicked pricing CTA OR submitted contact form in last 7 days",
"businessValue": "Retarget with case studies, testimonials, urgency messaging",
"estimatedSize": "5-10% of traffic",
"roiPotential": "3-5x higher conversion rate"
},
{
"name": "Demo Requesters",
"criteria": "Users who clicked 'Book Demo' CTA OR submitted demo form",
"businessValue": "High-value audience for sales follow-up",
"estimatedSize": "1-3% of traffic",
"roiPotential": "10-20x higher conversion rate"
},
{
"name": "Feature Page Visitors",
"criteria": "Users who viewed Features page AND clicked 2+ CTAs",
"businessValue": "Engaged visitors researching solution",
"estimatedSize": "8-12% of traffic",
"roiPotential": "2-4x higher conversion rate"
}
],
"nextSteps": [
"Save this file as gtm-tracking-plan.json in project root",
"Invoke gtm-setup skill to configure GTM API access",
"Invoke gtm-implementation skill to implement dataLayer events and create GTM configs"
]
}=== GTM Tracking Strategy Complete ===
Business Model: SaaS - Lead Generation
Primary Goal: Drive trial signups and demo requests
--- Tracking Plan Summary ---
P0 Events (Critical - Implement First):
1. cta_click (12 elements to track)
→ Why: Measures conversion intent on primary actions
→ Decision Impact: A/B test button copy, optimize placement
→ Gap: 8 CTAs missing tracking
2. form_submit (3 elements to track)
→ Why: Captures lead submissions
→ Decision Impact: Measure conversion rate, identify drop-offs
→ Gap: 0 forms currently tracked
3. form_start (3 elements to track)
→ Why: Identifies abandonment (started but didn't submit)
→ Decision Impact: Calculate abandonment rate, optimize fields
→ Gap: 0 forms currently tracked
P1 Events (Important - Implement Second):
4. navigation_click (8 elements to track)
→ Why: Tracks user journey and content discovery
→ Decision Impact: Optimize menu structure, understand paths
→ Gap: 6 navigation links missing tracking
5. video_play (1 element to track)
→ Why: Measures video engagement
→ Decision Impact: Identify engaging content
→ Gap: 1 video missing tracking
--- Recommended GA4 Reports ---
✓ Conversion Funnel: Page View → CTA Click → Form Submit → Signup
✓ CTA Performance Dashboard: Clicks by location, type, conversion rate
✓ Lead Generation Report: Form submissions, abandonment, completion time
--- Recommended Audiences ---
✓ High-Intent Visitors (5-10% of traffic)
→ Criteria: Clicked pricing CTA OR submitted form in last 7 days
→ Use Case: Retarget with case studies, urgency messaging
✓ Demo Requesters (1-3% of traffic)
→ Criteria: Clicked "Book Demo" OR submitted demo form
→ Use Case: High-value audience for sales follow-up
--- Implementation Roadmap ---
✓ Tracking plan saved to: gtm-tracking-plan.json
→ Next: Invoke gtm-setup skill to configure GTM API access
→ Then: Invoke gtm-implementation skill to implement tracking
→ Finally: Invoke gtm-testing skill to validate
Total estimated time: 2-3 hours with automation
Ready to set up GTM API access? Invoke gtm-setup skill.template.mdexamples/sample.md