skills/gtm-performance-audit/SKILL.md
Automatically audit Google Tag Manager implementations for performance impact when user mentions GTM, tag manager, tracking tags, marketing tags, or asks about tag performance. Analyzes container configuration, measures tag execution timing, identifies blocking tags, audits custom HTML safety, evaluates trigger efficiency, and maps tag impact to Core Web Vitals. Invoke when user says "GTM is slow", "too many tags", "tag manager performance", "tracking tags impact", or asks about marketing tag overhead.
npx skillsauth add kanopi/cms-cultivator gtm-performance-auditInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
Analyze Google Tag Manager implementations for performance impact using Chrome DevTools MCP.
Tag managers are powerful but can silently degrade performance. Every tag has a cost.
Activate this skill when the user:
Before auditing, determine the audit mode:
User asks about GTM performance
|
v
URL provided? → NO → Ask for target URL (STOP until answered)
|
YES
|
v
Proceed autonomously (no further permission prompts needed)
|
v
Phase 1: Baseline Performance (before GTM analysis)
|
v
Phase 2: GTM Container Analysis
|
v
Phase 3: Issue Detection (14 checks)
|
v
Phase 4: Report Generation
Before starting the audit, gather from the user:
Measure page performance using the single-pass audit collector script — one evaluate_script call replaces all individual measurement scripts.
Read: agents/gtm-specialist/scripts/gtm-audit-collector.js
mcp__chrome-devtools__navigate_page(url="<target-url>")
Wait for the page to fully load, then execute:
mcp__chrome-devtools__evaluate_script(function="<full content of gtm-audit-collector.js>")
This single call returns a structured JSON object containing:
<head> scripts with blocking/async/defer statusRun these only if the collector output is insufficient for a specific check:
Console errors (check for GTM JS errors):
mcp__chrome-devtools__list_console_messages()
Raw network waterfall (for precise HAR timing):
mcp__chrome-devtools__list_network_requests()
Deep CPU profiling (comprehensive depth mode only):
mcp__chrome-devtools__performance_start_trace(reload=true, autoStop=true)
mcp__chrome-devtools__performance_stop_trace()
Parse the exported JSON to extract:
Infer container details from network data:
// Use mcp__chrome-devtools__evaluate_script
() => {
if (typeof dataLayer === 'undefined') return { error: 'No dataLayer found' };
return {
eventCount: dataLayer.length,
events: dataLayer.map(item => ({
event: item.event || 'push',
keys: Object.keys(item)
})),
totalSize: JSON.stringify(dataLayer).length
};
}
Run all 14 check categories:
What: GTM container loaded with sync instead of async
Impact: Blocks HTML parsing, delays LCP
Check: Look for <script src="...gtm.js"> without async or defer
Fix: Ensure GTM snippet uses async loading pattern
What: Tags that block the main thread for >50ms Impact: Increases INP, degrades interactivity Check: Profile main thread during tag execution Fix: Defer non-critical tags, use tag sequencing
What: Tags or container >100KB compressed Impact: Increases load time, wastes bandwidth Check: Measure transfer sizes of GTM resources Fix: Remove unused tags, optimize custom HTML, consider server-side
What: JavaScript execution blocks main thread Impact: Poor INP, delayed interaction response Check: Use performance trace to measure long tasks Fix: Break up long-running tag scripts, use Web Workers where possible
What: Tags fire on all pages when only needed on specific pages Impact: Unnecessary processing and network requests Check: Analyze trigger conditions vs. page types Fix: Add page path or event conditions to triggers
What: Triggers using expensive DOM selectors or all-pages rules Impact: Excessive event listener overhead Check: Review trigger configurations for broad matching Fix: Use specific CSS selectors, limit to relevant pages
What: Same tracking pixel or analytics tag firing multiple times Impact: Inflated metrics, wasted resources, double-counting Check: Compare tag endpoints and parameters Fix: Remove duplicates, consolidate similar tags
What: Tags with no active triggers (paused or misconfigured) Impact: Container bloat, maintenance burden Check: Cross-reference tags with their trigger assignments Fix: Remove or archive orphaned tags
What: Variables using DOM lookups or complex JavaScript on every evaluation Impact: Repeated expensive computations Check: Review variable types and computation cost Fix: Cache values in dataLayer, use simpler variable types
What: Third-party scripts injected by tags without async/defer Impact: Render-blocking, delays page load Check: Inspect Custom HTML tags for script injection patterns Fix: Add async attribute to injected scripts
What: Custom HTML tags with inline scripts that could use built-in tag types Impact: Security risk, harder to maintain, potentially blocking Check: Analyze Custom HTML content for convertible patterns Fix: Convert to built-in tag templates where possible
What: Tags that could run server-side instead of client-side Impact: Reduces client-side JavaScript, improves performance Check: Identify tags sending data to first-party or server endpoints Fix: Migrate eligible tags to server-side GTM container
What: Tags firing before consent is granted Impact: Privacy violations, regulatory risk Check: Verify consent mode integration and tag firing sequence Fix: Implement Google Consent Mode, add consent triggers
What: Critical tags delayed by non-essential tags in the sequence Impact: Important data collection delayed Check: Review tag priority settings and sequencing Fix: Set proper priority values, use tag sequencing groups
## GTM Performance Audit Summary
**Container**: GTM-XXXXXXX
**URL Tested**: https://example.com
**Date**: YYYY-MM-DD
### Key Metrics
- Container Size: XXX KB (compressed)
- Total Tags: NN (XX active, YY paused)
- GTM Load Time: XXXms
- Main Thread Blocking: XXXms
- Estimated CWV Impact: [Low/Medium/High]
### Quick Wins
1. [Quick win with estimated impact]
2. [Quick win with estimated impact]
3. [Quick win with estimated impact]
Each finding should include:
| Tag Name | Type | Trigger | Size | Exec Time | Status |
|----------|------|---------|------|-----------|--------|
| GA4 | Google Analytics | All Pages | 45KB | 120ms | Active |
| Meta Pixel | Custom HTML | All Pages | 32KB | 85ms | Active |
| Hotjar | Custom HTML | Page View | 28KB | 200ms | Active |
Show timing of GTM-related requests:
0ms 100ms 200ms 300ms 400ms 500ms
|--------|--------|--------|--------|--------|
[==GTM Container (45KB)==]
[====GA4 (32KB)====]
[==Meta Pixel==]
[====Hotjar (28KB)====]
[=LinkedIn=]
## Remediation Checklist
### Critical (Do This Week)
- [ ] Remove duplicate GA4 tag (saves ~120ms)
- [ ] Add async to Custom HTML script injections
### High Priority (Do This Sprint)
- [ ] Add page path conditions to 5 all-pages tags
- [ ] Convert 3 Custom HTML tags to built-in templates
- [ ] Remove 4 orphaned tags (saves ~15KB)
### Medium Priority (Plan for Next Sprint)
- [ ] Evaluate server-side GTM for conversion tags
- [ ] Implement consent mode v2
- [ ] Optimize dataLayer push frequency
### Low Priority (Backlog)
- [ ] Consolidate similar event triggers
- [ ] Review variable caching strategy
This skill requires Chrome DevTools MCP. Tools used:
mcp__chrome-devtools__evaluate_script - Execute JavaScript for timing, dataLayer, resource analysismcp__chrome-devtools__list_network_requests - Capture GTM network waterfallmcp__chrome-devtools__list_console_messages - Check for GTM errorsmcp__chrome-devtools__navigate_page - Navigate to target URLmcp__chrome-devtools__take_snapshot - Get page structure for tag detectionmcp__chrome-devtools__performance_start_trace - Start performance profilingmcp__chrome-devtools__performance_stop_trace - Stop profiling and get resultsmcp__chrome-devtools__new_page - Open fresh tab for clean measurementCommon GTM Integration:
google_tag module (most common)html.html.twig injection/admin/config/services/google-tagCheck for:
drush config:get google_tag.settingshook_google_tag_snippets_alter()Common GTM Integration:
header.php injectionfunctions.php via wp_head actionCheck for:
This Skill: Focused GTM analysis during conversation
/audit-gtm Command: Comprehensive GTM performance audit
tools
Strategist-focused site audit for discovery and pre-discovery. Given a site URL and optional qualitative research data, navigates the site via CoWork, audits against all 21 UX Laws from lawsofux.com, reviews content hierarchy, synthesises qualitative data, runs Lighthouse, and produces two deliverables — a Project Knowledge Summary (Markdown for Claude Desktop Projects) and a polished, iterable HTML Artifact for client sharing. Use when a strategist, UX lead, or PM asks for a discovery audit, UX laws audit, content hierarchy review, pre-discovery site review, "audit this site for strategy", "strategist audit", "UX audit", or pastes a site URL with discovery context. Not for developer audits — use accessibility-audit, performance-audit, or live-site-audit for those.
development
Provide story point estimation guidance with hour calculations for software development tasks. Uses Fibonacci sequence (1, 2, 3, 5, 8, 13, 21, 34+) and converts story points to hours. Includes platform-specific adjustments and velocity calculations.
tools
Perform a full QA review of a Teamwork task by reading the task and all its comments for context, extracting the multi-dev URL, generating dynamic validation steps tailored to the task type, and using CoWork browser automation to execute those steps on the multi-dev environment. Produces a structured validation report with pass/fail per step, screenshots, internal notes, and a client-facing summary — all shown in chat. Use this skill whenever the user asks to QA, test, validate, or review a Teamwork task or multi-dev environment — even if they just say "can you QA this?" or paste a Teamwork link. Also triggers for phrases like "run QA on", "check the multi-dev", "validate this task", "test the dev link", or "review the ticket". Works across Drupal/CMS updates, WordPress/plugin updates, bug fixes, new feature development, and general web development tasks.
tools
Generate a client-facing project heartbeat / status update message for a Kanopi project, ready to be posted as a Teamwork message. Use this skill whenever the user asks to write, draft, generate, or send a project update, heartbeat, status update, or progress report to a client. Also triggers when the user says things like "time for a project update", "draft the heartbeat", "write up the update for [project]", or "it's been two weeks, let's send an update". Always use this skill — even if the user doesn't say "heartbeat" — whenever the intent is to summarise recent project activity for a client audience.