Major refactoring of ourdigital-custom-skills with new numbering system: ## Structure Changes - Each skill now has code/ (Claude Code) and desktop/ (Claude Desktop) versions - New progressive numbering: 01-09 General, 10-19 SEO, 20-29 GTM, 30-39 OurDigital, 40-49 Jamie ## Skill Reorganization - 01-notion-organizer (from 02) - 10-18: SEO tools split into focused skills (technical, on-page, local, schema, vitals, gsc, gateway) - 20-21: GTM audit and manager - 30-32: OurDigital designer, research, presentation - 40-41: Jamie brand editor and audit ## New Files - .claude/commands/: Slash command definitions for all skills - CLAUDE.md: Updated with new skill structure documentation - REFACTORING_PLAN.md: Migration documentation - COMPATIBILITY_REPORT.md, SKILLS_COMPARISON.md: Analysis docs ## Removed - Old skill directories (02-05, 10-14, 20-21 old numbering) - Consolidated into new structure with _archive/ for reference 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
4.8 KiB
Common GTM Issues & Fixes
Container Issues
GTM Not Firing
Symptoms: No GTM requests in network tab Causes:
- Script blocked by ad blocker
- Script placed after closing body tag
- JavaScript error before GTM loads
- Consent management blocking GTM
Fix:
<!-- Place immediately after opening <head> tag -->
<script>(function(w,d,s,l,i){...})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
Multiple Containers Conflict
Symptoms: Duplicate events, inconsistent data Causes:
- Legacy container not removed
- Different teams installed separate containers
- Theme/plugin auto-installed GTM
Fix:
- Audit all containers in source
- Consolidate to single container
- Use GTM environments for staging/prod
Container ID Mismatch
Symptoms: Tags not firing, wrong property receiving data Causes:
- Dev/staging container on production
- Copy-paste error during installation
Fix: Verify container ID matches GTM account
DataLayer Issues
DataLayer Not Initialized
Symptoms: First push events lost Code Error:
// Wrong - GTM loads before dataLayer exists
<script>GTM snippet</script>
dataLayer.push({...});
Fix:
// Correct - Initialize dataLayer first
<script>window.dataLayer = window.dataLayer || [];</script>
<script>GTM snippet</script>
Case Sensitivity Issues
Symptoms: Triggers not matching Example:
// DataLayer pushes "AddToCart"
dataLayer.push({ event: "AddToCart" });
// But GTM trigger looks for "addToCart" - won't match!
Fix: Standardize event naming (recommend lowercase with underscores)
Wrong Data Types
Symptoms: Calculations wrong in GA4, missing data Example:
// Wrong - price as string
dataLayer.push({ ecommerce: { value: "29.99" }});
// Correct - price as number
dataLayer.push({ ecommerce: { value: 29.99 }});
Timing Issues
Symptoms: Events fire before data available Cause: DataLayer push happens after tag fires
Fix: Use "Custom Event" trigger instead of "Page View"
Tag Issues
Tag Not Firing
Checklist:
- ✓ Trigger conditions met?
- ✓ Trigger enabled?
- ✓ Tag not paused?
- ✓ No blocking triggers active?
- ✓ Consent mode not blocking?
Debug Steps:
- GTM Preview > Check Tags Fired
- Verify trigger shows green check
- Check Variables tab for expected values
Duplicate Tag Firing
Symptoms: Events counted 2x in GA4 Causes:
- Multiple triggers on same action
- Page re-renders triggering again
- SPA virtual pageviews firing multiple times
Fix:
- Add "Once per event" tag firing option
- Use trigger groups to control firing
- Add conditions to prevent re-firing
Wrong Parameters Sent
Symptoms: Data appears in wrong fields in GA4 Debug:
- GTM Preview > Tags > Show fired tag
- Check "Values" sent with tag
- Compare with expected parameters
E-commerce Issues
Missing Transaction ID
Symptoms: Duplicate purchases counted
Fix: Ensure unique transaction_id generated server-side
Items Array Empty
Symptoms: Revenue tracked but no products
Check: ecommerce.items array populated
Value Mismatch
Symptoms: Revenue doesn't match actual Causes:
- Tax/shipping included inconsistently
- Currency conversion issues
- Discount applied incorrectly
Purchase Event Fires Multiple Times
Symptoms: Same order tracked 2-3x Causes:
- Page refresh on confirmation
- Browser back button
- Email link revisit
Fix:
// Check if already tracked
if (!sessionStorage.getItem('purchase_' + transaction_id)) {
dataLayer.push({ event: 'purchase', ... });
sessionStorage.setItem('purchase_' + transaction_id, 'true');
}
Consent Mode Issues
Tags Blocked by Consent
Symptoms: Tags show "Blocked by consent" in Preview Fix:
- Verify consent mode implementation
- Check default consent state
- Test with consent granted
Consent Not Updating
Symptoms: Tags stay blocked after user accepts
Fix: Verify gtag('consent', 'update', {...}) fires on accept
SPA (Single Page App) Issues
Pageviews Not Tracking Navigation
Symptoms: Only initial pageview tracked Cause: No page reload on route change
Fix: Implement History Change trigger or custom event:
// On route change
dataLayer.push({
event: 'virtual_pageview',
page_path: newPath,
page_title: newTitle
});
Events Fire on Old Page Data
Symptoms: Wrong page_path in events Fix: Update page variables before event push
Performance Issues
Tags Slowing Page Load
Symptoms: High LCP, slow TTI Causes:
- Too many synchronous tags
- Large third-party scripts
- Tags in wrong firing sequence
Fix:
- Use tag sequencing
- Load non-critical tags on Window Loaded
- Defer marketing tags