$npx -y skills add henkisdabro/wookstar-claude-plugins --skill google-tagmanagerComprehensive Google Tag Manager guide covering container setup, tags, triggers, variables, data layer, debugging, custom templates, and API automation. Use when working with GTM implementation, configuration, dataLayer push design, custom tag/template building, server-side conta
| 1 | # Google Tag Manager |
| 2 | |
| 3 | ## Overview |
| 4 | |
| 5 | Expertise for Google Tag Manager (GTM) covering container setup, tag configuration, triggers, variables, data layer implementation, debugging, custom templates, and API automation. See the reference files below for detailed guidance on each topic. |
| 6 | |
| 7 | ## When to Use This Skill |
| 8 | |
| 9 | Invoke when setting up or configuring GTM containers, tags, triggers, or variables; implementing the data layer; debugging with Preview mode or Tag Assistant; building custom templates; automating via the REST API; or optimising container performance and consent management. |
| 10 | |
| 11 | ## Quick Start |
| 12 | |
| 13 | 1. Create a GTM account at [tagmanager.google.com](https://tagmanager.google.com) |
| 14 | 2. Create a container (Web, iOS, Android, or Server) |
| 15 | 3. Install the container snippet - see [setup.md](references/setup.md) |
| 16 | 4. Configure tags, triggers, and variables |
| 17 | 5. Test in Preview mode - see [debugging.md](references/debugging.md) |
| 18 | 6. Publish |
| 19 | |
| 20 | ### Basic Tag Configuration |
| 21 | |
| 22 | ```text |
| 23 | Example: Google Tag (GA4) |
| 24 | Tag Type: Google Tag |
| 25 | Tag ID: G-XXXXXXXXXX |
| 26 | Trigger: All Pages |
| 27 | ``` |
| 28 | |
| 29 | See [tags.md](references/tags.md) for comprehensive tag documentation. |
| 30 | |
| 31 | ### Data Layer Push |
| 32 | |
| 33 | ```javascript |
| 34 | window.dataLayer = window.dataLayer || []; |
| 35 | dataLayer.push({ |
| 36 | 'event': 'custom_event', |
| 37 | 'category': 'engagement', |
| 38 | 'action': 'button_click', |
| 39 | 'label': 'CTA Button' |
| 40 | }); |
| 41 | ``` |
| 42 | |
| 43 | See [datalayer.md](references/datalayer.md) for data layer patterns. |
| 44 | |
| 45 | ## Core Concepts |
| 46 | |
| 47 | **Tags** are snippets of code that execute on your site (e.g., GA4, Google Ads, Facebook Pixel). |
| 48 | |
| 49 | **Triggers** define when tags fire (e.g., page views, clicks, form submissions). |
| 50 | |
| 51 | **Variables** capture dynamic values for use in tags and triggers (e.g., page URL, click text, data layer values). |
| 52 | |
| 53 | ``` |
| 54 | User Action --> Trigger Fires --> Tag Executes --> Data Sent |
| 55 | ^ | |
| 56 | | v |
| 57 | +--- Variables provide values -------+ |
| 58 | ``` |
| 59 | |
| 60 | ## Common Workflows |
| 61 | |
| 62 | ### GA4 Page View Tracking |
| 63 | |
| 64 | 1. Create Google Tag with your GA4 Measurement ID (formerly the "GA4 Configuration" tag type) |
| 65 | 2. Set trigger to "All Pages" |
| 66 | 3. Test in Preview mode, verify in GA4 DebugView |
| 67 | 4. Publish |
| 68 | |
| 69 | ### Form Submission Tracking |
| 70 | |
| 71 | 1. Create Form Submission trigger |
| 72 | 2. Create GA4 Event tag (`form_submit`) with form ID/name as parameter |
| 73 | 3. Test in Preview mode and publish |
| 74 | |
| 75 | ### E-commerce Tracking |
| 76 | |
| 77 | 1. Implement data layer with e-commerce events - see [datalayer.md](references/datalayer.md) |
| 78 | 2. Create data layer variables and GA4 Event tags for each event |
| 79 | 3. Map variables to event parameters |
| 80 | 4. Test complete purchase flow and publish |
| 81 | |
| 82 | ### Debug Tag Not Firing |
| 83 | |
| 84 | 1. Enable Preview mode and perform the action |
| 85 | 2. Check "Tags Not Fired" section and review trigger conditions |
| 86 | 3. Verify data layer values, fix conditions, and retest |
| 87 | 4. See [debugging.md](references/debugging.md) for detailed workflows |
| 88 | |
| 89 | ## Technical Constraints |
| 90 | |
| 91 | **ES5 Required**: Custom JavaScript Variables and Custom HTML Tags must use ES5 syntax (`var`, `function()`, string concatenation). Custom Templates support some ES6. See [best-practices.md](references/best-practices.md) for details and workarounds. |
| 92 | |
| 93 | **RE2 Regex**: GTM uses RE2 regex - no lookahead, lookbehind, or backreferences. See [best-practices.md](references/best-practices.md) for supported patterns. |
| 94 | |
| 95 | ## Quick Reference |
| 96 | |
| 97 | ### Built-in Variables to Enable |
| 98 | |
| 99 | - Page URL, Page Path, Page Hostname |
| 100 | - Click Element, Click Classes, Click ID, Click URL, Click Text |
| 101 | - Form Element, Form ID, Form Classes |
| 102 | - Scroll Depth Threshold, Scroll Direction |
| 103 | |
| 104 | ### Common Trigger Types |
| 105 | |
| 106 | Page View, Click (All Elements / Just Links), Form Submission, Custom Event, History Change (SPAs), Timer, Scroll Depth |
| 107 | |
| 108 | ### Essential Data Layer Events |
| 109 | |
| 110 | ```javascript |
| 111 | // Page view |
| 112 | dataLayer.push({ 'event': 'page_view' }); |
| 113 | |
| 114 | // User login |
| 115 | dataLayer.push({ 'event': 'login', 'method': 'Google' }); |
| 116 | |
| 117 | // Purchase |
| 118 | dataLayer.push({ |
| 119 | 'event': 'purchase', |
| 120 | 'ecommerce': { |
| 121 | 'transaction_id': 'T12345', |
| 122 | 'value': 99.99, |
| 123 | 'currency': 'AUD', |
| 124 | 'items': [...] |
| 125 | } |
| 126 | }); |
| 127 | ``` |
| 128 | |
| 129 | ## Reference Files |
| 130 | |
| 131 | | Topic | Reference File | |
| 132 | |-------|----------------| |
| 133 | | Container setup | [setup.md](references/setup.md) | |
| 134 | | Tag configuration | [tags.md](references/tags.md) | |
| 135 | | Trigger configuration | [triggers.md](references/triggers.md) | |
| 136 | | Variable configuration | [variables.md](references/variables.md) | |
| 137 | | Data layer | [datalayer.md](references/datalayer.md) | |
| 138 | | Debugging | [debugging.md](references/ |