Loading...
Loading...
Comprehensive analytics audit of website codebase to identify trackable elements and assess analytics readiness. Use when users want to "audit my analytics", "scan for trackable elements", "find what I can track", "analyze my website for tracking opportunities", or before implementing GTM tracking. Scans HTML/JSX/TSX/Vue for all clickable elements (buttons, links, forms, etc.), identifies existing tracking code, evaluates DOM structure for analytics, and provides recommendations. Acts as senior frontend engineer with GA4 expertise.
npx skill4agent add aimonk2025/google-tag-manager-automation gtm-analytics-audit.tsx.jsx.vueapp/**/*.tsxpages/**/*.tsxcomponents/**/*.{tsx,jsx,vue}src/**/*.{tsx,jsx,vue}<button>...</button>
<button onClick={...}>
<Button>...</Button> (component)<a href="...">
<Link href="..."> (Next.js/React Router)
<router-link to="..."> (Vue)<form onSubmit={...}>
<form action="..."><video controls>
<audio controls>
<iframe> (YouTube, Vimeo embeds)<div onClick={...}>
<span role="button">
Elements with cursor: pointerwindow.dataLayer.push({...})
dataLayer.push({...})onClick={() => {
// Track event
window.dataLayer.push({...})
// Or analytics.track(...)
}}id="cta_hero_get_started"id="button1"class="js-track js-cta js-click"class="btn primary"<button><div onClick>aria-label="..."audit-report.json{
"metadata": {
"auditDate": "2026-02-11T10:30:00Z",
"framework": "Next.js 16.1.6 (App Router)",
"filesScanned": 47,
"componentsAnalyzed": 23
},
"summary": {
"totalClickableElements": 47,
"withTracking": 15,
"withoutTracking": 32,
"analyticsReadiness": "42%"
},
"categorized": {
"cta": {
"total": 12,
"tracked": 4,
"untracked": 8,
"elements": [
{
"file": "app/page.tsx",
"line": 45,
"text": "Get Started",
"id": null,
"classes": ["btn", "primary"],
"tracking": false,
"recommendation": "Add id='cta_hero_get_started' and classes='js-track js-cta js-click js-hero'"
}
]
},
"nav": {
"total": 8,
"tracked": 2,
"untracked": 6
},
"form": {
"total": 3,
"tracked": 0,
"untracked": 3
},
"outbound": {
"total": 5,
"tracked": 1,
"untracked": 4
},
"media": {
"total": 2,
"tracked": 0,
"untracked": 2
}
},
"existingTracking": {
"patterns": [
"window.dataLayer.push (15 occurrences)",
"Custom onClick handlers (4 occurrences)"
],
"libraries": ["Google Tag Manager"],
"coverage": "31.9% of clickable elements"
},
"issues": [
{
"type": "naming",
"severity": "high",
"count": 23,
"description": "23 elements with generic or missing identifiers",
"examples": [
"button with class='btn' only (app/page.tsx:45)",
"link with no id or analytics classes (components/Navbar.tsx:23)"
]
},
{
"type": "tracking_gap",
"severity": "high",
"count": 8,
"description": "8 high-priority CTAs without tracking",
"impact": "Missing conversion data on primary actions"
},
{
"type": "inconsistency",
"severity": "medium",
"count": 12,
"description": "Inconsistent tracking patterns across similar elements"
}
],
"recommendations": [
{
"priority": "P0",
"action": "Run gtm-dom-standardization skill",
"reason": "Standardize 47 elements with consistent analytics-ready identifiers",
"impact": "Creates clean foundation for tracking implementation"
},
{
"priority": "P0",
"action": "Implement tracking on 12 CTAs",
"reason": "Critical conversion actions currently untracked",
"expectedValue": "Visibility into primary conversion funnel"
},
{
"priority": "P1",
"action": "Add form tracking to 3 forms",
"reason": "Lead capture and user input not measured",
"expectedValue": "Form abandonment and completion data"
},
{
"priority": "P2",
"action": "Track 5 outbound links",
"reason": "Referral traffic and external engagement unknown",
"expectedValue": "Partner/resource click-through rates"
}
],
"nextSteps": [
"Invoke gtm-dom-standardization to clean up DOM identifiers",
"Invoke gtm-strategy to plan tracking implementation based on business goals",
"Review audit-report.json with stakeholders to prioritize tracking"
]
}=== GTM Analytics Audit Complete ===
Framework: Next.js 16.1.6 (App Router)
Files Scanned: 47 files
Components Analyzed: 23 components
--- Summary ---
Total Clickable Elements: 47
✓ With Tracking: 15 (31.9%)
✗ Without Tracking: 32 (68.1%)
--- Element Breakdown ---
CTAs: 12 total (4 tracked, 8 untracked)
Navigation: 8 total (2 tracked, 6 untracked)
Forms: 3 total (0 tracked, 3 untracked)
Outbound Links: 5 total (1 tracked, 4 untracked)
Media: 2 total (0 tracked, 2 untracked)
--- Key Issues ---
⚠ 23 elements with generic/missing identifiers
⚠ 8 high-priority CTAs without tracking
⚠ 3 forms without tracking
⚠ Inconsistent tracking patterns
--- Existing Tracking ---
✓ Google Tag Manager detected
✓ 15 dataLayer.push() calls found
△ Coverage: 31.9% of clickable elements
--- Recommendations ---
P0 (Critical):
1. Standardize DOM identifiers across 47 elements
→ Invoke gtm-dom-standardization skill
2. Implement tracking on 12 CTAs
→ Critical for conversion funnel visibility
P1 (Important):
3. Add form tracking (3 forms)
→ Capture lead generation and form abandonment
P2 (Nice-to-have):
4. Track outbound links (5 links)
→ Measure partner/resource engagement
--- Next Steps ---
✓ Audit report saved to: audit-report.json
→ Next: Invoke gtm-dom-standardization to prepare DOM for tracking
→ Then: Invoke gtm-strategy to plan tracking implementation
Ready to standardize your DOM? Invoke gtm-dom-standardization skill.references/naming-conventions.mdexamples/sample.md