- Automated GTM container detection and validation - DataLayer event validation against GA4 specs - Form tracking analysis and interaction simulation - E-commerce checkout flow analysis - Multi-platform support (GA4, Meta, LinkedIn, Google Ads, Kakao, Naver) - Notion database export with detailed reporting - Korean market considerations 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
GTM Audit Tool
Automated Google Tag Manager audit toolkit powered by Playwright.
Features
- Container Detection: Verify GTM installation, position, and duplicates
- DataLayer Validation: Event structure, types, sequence checking
- Form Tracking: Form discovery, field analysis, event verification
- E-commerce Checkout: Full funnel flow simulation and validation
- Multi-Platform: GA4, Meta Pixel, LinkedIn, Google Ads, Kakao, Naver
- Notion Integration: Export audit results to Notion database for tracking
Installation
# Clone or download
cd gtm-audit-claude-code
# Install dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright install chromium
Usage
# Full audit
python gtm_audit.py --url "https://yoursite.com" --journey full
# Specific container validation
python gtm_audit.py --url "https://yoursite.com" --container "GTM-XXXXXX"
# Form tracking only
python gtm_audit.py --url "https://yoursite.com/contact" --journey form
# E-commerce checkout
python gtm_audit.py --url "https://yoursite.com/cart" --journey checkout
Options
| Option | Description | Default |
|---|---|---|
--url |
Target URL (required) | - |
--container |
Expected GTM container ID | None |
--journey |
Audit type: pageview, scroll, form, checkout, datalayer, full | full |
--output |
Output file path | gtm_audit_report.json |
--timeout |
Page load timeout (ms) | 30000 |
--headless |
Run browser headless | True |
--notion |
Export results to Notion database | False |
--notion-database |
Custom Notion database ID | OurDigital GTM Audit Log |
--notion-detailed |
Add detailed content to Notion page | False |
Output
Generates JSON report with:
- Container status
- DataLayer events and validation issues
- Form analysis and tracking readiness
- Checkout flow analysis
- Network requests by destination
- Recommendations and checklist
Notion Integration
Export audit results directly to Notion for team collaboration and historical tracking.
# Set Notion API token
export NOTION_TOKEN="secret_xxxxx"
# Export to Notion (default database)
python gtm_audit.py --url "https://yoursite.com" --notion
# Export with detailed content (issues, recommendations, checklist)
python gtm_audit.py --url "https://yoursite.com" --notion --notion-detailed
The audit creates a new row in the Notion database with:
- Site name and URL
- Audit date and unique ID
- GTM status and container IDs
- Tags fired (GA4, Meta, etc.)
- Issue counts and overall status
- Summary of findings
Using with Claude Code
This project includes a CLAUDE.md file optimized for use with Claude Code.
# In your terminal
claude
# Then ask Claude to run audits
> Run a GTM audit on https://example.com
> Check the form tracking on https://example.com/contact
> Analyze the checkout flow issues in the latest report
Documentation
See docs/ folder for:
- GA4 event specifications
- E-commerce dataLayer schemas
- Form tracking patterns
- Checkout flow sequences
- Common issues and fixes
License
MIT