Help us improve
Share bugs, ideas, or general feedback.
From cms-cultivator
Audits Google Tag Manager performance, analyzing container config, tag timing, blocking tags, and Core Web Vitals. Activates on GTM, tag manager, or tag performance mentions.
npx claudepluginhub kanopi/claude-toolbox --plugin cms-cultivatorHow this skill is triggered — by the user, by Claude, or both
Slash command
/cms-cultivator:gtm-performance-auditThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Analyze Google Tag Manager implementations for performance impact using Chrome DevTools MCP.
Guides Google Tag Manager setup, tags, triggers, variables, data layer implementation, debugging, custom templates, and API automation for web, apps, and servers.
Installs and manages GTM containers: dataLayer, tags, consent mode, migration from gtag.js. Centralizes Google tags with privacy compliance.
Diagnoses and fixes Core Web Vitals (LCP, INP, CLS) issues using CoreDash real user monitoring data and Chrome browser tools. For web performance, page speed, or slow pages.
Share bugs, ideas, or general feedback.
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