🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
OurDigital GTM Manager
Comprehensive Google Tag Manager management toolkit powered by Playwright.
Note
: For lightweight audit-only functionality, see 13-ourdigital-gtm-audit.
Features
- Audit Mode: Validate GTM installations, dataLayer events, forms, and checkout flows
- Inject Mode: Generate custom HTML tags for dataLayer pushes
- 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
Installation
cd ourdigital-gtm-manager
# Install dependencies
pip install -r requirements.txt
# Install Playwright browsers
playwright install chromium
Audit Mode
Analyze existing GTM implementations:
# Full audit
python gtm_manager.py audit --url "https://yoursite.com" --journey full
# Specific container validation
python gtm_manager.py audit --url "https://yoursite.com" --container "GTM-XXXXXX"
# Form tracking only
python gtm_manager.py audit --url "https://yoursite.com/contact" --journey form
# Audit and generate missing tags
python gtm_manager.py audit --url "https://yoursite.com" --generate-tags
# Export to Notion
python gtm_manager.py audit --url "https://yoursite.com" --notion
Audit Options
| Option | Description | Default |
|---|---|---|
--url |
Target URL (required) | - |
--container |
Expected GTM container ID | None |
--journey |
pageview, scroll, form, checkout, datalayer, full | full |
--output |
Output file path | gtm_audit_report.json |
--generate-tags |
Generate missing dataLayer tags | False |
--notion |
Export to Notion database | False |
Inject Mode
Generate GTM custom HTML tags when you can't modify source code directly:
# List available event types
python gtm_manager.py inject --list-events
# Generate all ecommerce tags
python gtm_manager.py inject --preset ecommerce --output ./tags
# Generate specific events
python gtm_manager.py inject --event purchase --event add_to_cart
# Generate from audit report
python gtm_manager.py inject --from-audit gtm_audit_report.json
# Generate with DOM scraping code
python gtm_manager.py inject --event view_item --scrape
Inject Options
| Option | Description | Default |
|---|---|---|
--event |
Event type(s) to generate | - |
--preset |
ecommerce, engagement, all | - |
--from-audit |
Generate from audit report | - |
--output |
Output directory | ./gtm_tags |
--format |
html or json | html |
--currency |
Currency code | KRW |
--scrape |
Generate DOM scraping code | False |
--list-events |
Show available events | - |
Supported Events
Ecommerce: view_item, add_to_cart, remove_from_cart, view_cart, begin_checkout, add_shipping_info, add_payment_info, purchase
Forms: form_submit, form_start, generate_lead
Engagement: scroll, file_download, search, outbound_click, share
Video: video_start, video_progress, video_complete
User: login, sign_up, page_view
Notion Integration
# Set Notion API token
export NOTION_TOKEN="secret_xxxxx"
# Export audit to Notion
python gtm_manager.py audit --url "https://yoursite.com" --notion --notion-detailed
Using with Claude Code
This project includes a CLAUDE.md file optimized for Claude Code.
claude
# Then ask Claude:
> Run a GTM audit on https://example.com
> Generate ecommerce dataLayer tags for my site
> Check the checkout flow and create missing tags
Documentation
See docs/ folder for:
- GA4 event specifications
- E-commerce dataLayer schemas
- Form tracking patterns
- Checkout flow sequences
- Common issues and fixes
License
MIT