GTM Performance Skills¶
Audit Google Tag Manager implementations for performance impact with flexible argument modes.
Skill¶
gtm-performance-audit [options] — Comprehensive GTM performance audit analyzing container size, tag execution, trigger efficiency, and Core Web Vitals impact
Requirements¶
Required: Chrome DevTools MCP Server
This command requires an active Chrome DevTools MCP connection to perform live page profiling.
Flexible Argument Modes¶
Quick Checks During Development¶
/gtm-performance-audit --quick --url=https://example.com
/gtm-performance-audit --quick --scope=current-pr
/gtm-performance-audit --quick --container-id=GTM-ABC123
Standard Audits (Default)¶
/gtm-performance-audit --url=https://example.com
/gtm-performance-audit --url=https://example.com --with-container-json=./export.json
/gtm-performance-audit --standard --format=json --url=https://example.com
Comprehensive Audits (Pre-Launch)¶
/gtm-performance-audit --comprehensive --url=https://example.com
/gtm-performance-audit --comprehensive --format=summary
/gtm-performance-audit --comprehensive --with-container-json=./container.json
Argument Options¶
Depth Modes¶
--quick- Container size + tag count (~5 min)--standard- Full analysis with CWV mapping (default, ~15 min)--comprehensive- Deep profiling + remediation plan (~30 min)
Scope Control¶
--scope=current-pr- Only GTM-related files changed in current PR--scope=container=<GTM-ID>- Specific GTM container--scope=entire- Full GTM analysis (default)
Output Formats¶
--format=report- Detailed report with tag inventory (default)--format=json- JSON for CI/CD integration--format=summary- Executive summary with key findings
GTM-Specific Options¶
--container-id=<GTM-XXXX>- GTM container ID to audit--with-container-json=<path>- Path to exported container JSON--url=<target-url>- Target URL for live profiling
Legacy Focus Options (Still Supported)¶
For backward compatibility, focus areas without -- prefix still work:
- container - Container size and structure
- tags - Individual tag performance
- triggers - Trigger efficiency
- datalayer - DataLayer analysis
- custom-html - Custom HTML tag audit
- consent - Consent mode compliance
What Gets Audited¶
14-Point Issue Detection¶
- Synchronous script loading - GTM loaded without async
- Blocking tags - Tags blocking main thread >50ms
- Large payloads - Tags or container >100KB
- Main thread blocking - JavaScript execution blocking interactivity
- Missing conditional firing - Tags firing on all pages unnecessarily
- Trigger optimization - Expensive DOM selectors and broad rules
- Duplicate tags - Same tracking pixel firing multiple times
- Orphaned tags - Tags with no active triggers
- Expensive variables - Variables with costly DOM lookups
- Missing async attribute - Third-party scripts without async/defer
- Custom HTML best practices - Inline scripts that could use built-in types
- Server-side candidates - Tags eligible for server-side GTM
- Consent mode gaps - Tags firing before consent granted
- Tag firing order - Critical tags delayed by non-essential tags
CMS-Specific Patterns¶
Drupal¶
google_tagmodule configuration- Template-level GTM injection
- DataLayer hook implementations
- Multiple container detection
WordPress¶
- GTM4WP plugin settings
header.phpmanual injection- WooCommerce enhanced ecommerce overhead
- Google Site Kit conflicts
CI/CD Integration¶
Export results as JSON for automated pipelines:
# GitHub Actions example
- name: Run GTM audit
run: /gtm-performance-audit --standard --format=json --url=${{ env.SITE_URL }} > gtm-results.json
- name: Check container size
run: |
SIZE=$(jq '.container.size_kb' gtm-results.json)
if (( $(echo "$SIZE > 100" | bc -l) )); then
echo "GTM container exceeds 100KB threshold"
exit 1
fi
Common Workflows¶
Pre-Commit (GTM config changes):
PR Review:
Pre-Launch:
/gtm-performance-audit --comprehensive --url=https://example.com --with-container-json=./export.json
Tag Cleanup Sprint:
Related Skills¶
- Performance Audit - General performance audit (Core Web Vitals, assets, queries)
- Live Site Audit - Comprehensive audit (perf + a11y + security + quality)
- Security Audit - Security audit (includes third-party script risks)
See Skills Overview for all available skills.