aimonk2025/google-tag-manager-automation
Overview
This skill performs a comprehensive analytics audit of a website codebase to locate trackable elements and assess analytics readiness. I act as a senior frontend engineer with GA4 expertise to prioritize tracking work and produce an actionable audit report. The output highlights gaps, patterns, and clear next steps for implementing Google Tag Manager and event tracking.
How this skill works
I scan the project for framework indicators (package.json) and locate component files (.tsx, .jsx, .vue) in app/, pages/, components/, and src/. I parse components to find clickable elements (buttons, links, forms, media, and custom interactive elements), detect existing tracking (dataLayer pushes, gtag, analytics calls), and evaluate DOM structure for analytics readiness. Results are categorized (CTA, navigation, form, pricing, auth, demo, outbound, media), scored for coverage, and bundled into audit-report.json with prioritized recommendations.
When to use it
- Before implementing GTM or GA4 tracking on a site
- When you want a list of what can and should be tracked
- To validate existing tracking coverage and patterns
- Prior to a tagging sprint to prioritize engineering work
- To prepare a codebase for server-side or client-side tracking
Best practices
- Prioritize P0 items: CTAs and form submissions for conversion visibility
- Standardize IDs/classes for analytics (js-track/js-cta style) before adding events
- Use semantic elements (<button>, <a>, <form>) and ARIA attributes for reliable selectors
- Avoid ad-hoc tracking in many handlers—centralize pushes to dataLayer or a tracking helper
- Keep tracking consistent across similar components and document naming conventions
Example use cases
- Scan a Next.js app to list untracked CTAs and add recommended identifiers
- Audit a React codebase to quantify dataLayer usage and gaps before GTM implementation
- Identify form elements missing submission tracking and propose event parameter schemas
- Evaluate media embeds (YouTube/Vimeo) for play/pause tracking opportunities
- Prepare a B2B site for funnel measurement by prioritizing demo/request CTAs
FAQ
No. I focus on business-critical interactions (CTAs, forms, navigation) and skip decorative or redundant elements to avoid noise.
What does the audit deliver?
A JSON audit-report with metadata, categorized elements, tracking coverage, identified issues, and prioritized P0–P2 recommendations plus concrete next steps.