google-tagmanager
Google Tag Manager
Overview
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.
When to Use This Skill
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.
Quick Start
- Create a GTM account at tagmanager.google.com
- Create a container (Web, iOS, Android, or Server)
- Install the container snippet - see setup.md
- Configure tags, triggers, and variables
- Test in Preview mode - see debugging.md
- Publish
Basic Tag Configuration
// Example: GA4 Configuration Tag
Tag Type: Google Analytics: GA4 Configuration
Measurement ID: G-XXXXXXXXXX
Trigger: All Pages
See tags.md for comprehensive tag documentation.
Data Layer Push
window.dataLayer = window.dataLayer || [];
dataLayer.push({
'event': 'custom_event',
'category': 'engagement',
'action': 'button_click',
'label': 'CTA Button'
});
See datalayer.md for data layer patterns.
Core Concepts
Tags are snippets of code that execute on your site (e.g., GA4, Google Ads, Facebook Pixel).
Triggers define when tags fire (e.g., page views, clicks, form submissions).
Variables capture dynamic values for use in tags and triggers (e.g., page URL, click text, data layer values).
User Action --> Trigger Fires --> Tag Executes --> Data Sent
^ |
| v
+--- Variables provide values -------+
Common Workflows
GA4 Page View Tracking
- Create GA4 Configuration tag with Measurement ID
- Set trigger to "All Pages"
- Test in Preview mode, verify in GA4 DebugView
- Publish
Form Submission Tracking
- Create Form Submission trigger
- Create GA4 Event tag (
form_submit) with form ID/name as parameter - Test in Preview mode and publish
E-commerce Tracking
- Implement data layer with e-commerce events - see datalayer.md
- Create data layer variables and GA4 Event tags for each event
- Map variables to event parameters
- Test complete purchase flow and publish
Debug Tag Not Firing
- Enable Preview mode and perform the action
- Check "Tags Not Fired" section and review trigger conditions
- Verify data layer values, fix conditions, and retest
- See debugging.md for detailed workflows
Technical Constraints
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 for details and workarounds.
RE2 Regex: GTM uses RE2 regex - no lookahead, lookbehind, or backreferences. See best-practices.md for supported patterns.
Quick Reference
Built-in Variables to Enable
- Page URL, Page Path, Page Hostname
- Click Element, Click Classes, Click ID, Click URL, Click Text
- Form Element, Form ID, Form Classes
- Scroll Depth Threshold, Scroll Direction
Common Trigger Types
Page View, Click (All Elements / Just Links), Form Submission, Custom Event, History Change (SPAs), Timer, Scroll Depth
Essential Data Layer Events
// Page view
dataLayer.push({ 'event': 'page_view' });
// User login
dataLayer.push({ 'event': 'login', 'method': 'Google' });
// Purchase
dataLayer.push({
'event': 'purchase',
'ecommerce': {
'transaction_id': 'T12345',
'value': 99.99,
'currency': 'AUD',
'items': [...]
}
});
Reference Files
| Topic | Reference File |
|---|---|
| Container setup | setup.md |
| Tag configuration | tags.md |
| Trigger configuration | triggers.md |
| Variable configuration | variables.md |
| Data layer | datalayer.md |
| Debugging | debugging.md |
| Best practices, naming, performance, security | best-practices.md |
| Custom templates | custom-templates.md |
| API automation | api.md |
External Resources
More from henkisdabro/wookstar-claude-code-plugins
tampermonkey
Write and debug Tampermonkey userscripts for browser automation, page modification, and web enhancement. Use whenever the user mentions userscripts, Tampermonkey, Greasemonkey, Violentmonkey, or wants to write a script that runs on a website - even if they don't say 'userscript' explicitly. Also trigger for: injecting JavaScript or CSS into web pages, modifying website behaviour, hiding page elements, form auto-fill, scraping page data, intercepting requests, detecting URL changes in SPAs, adding keyboard shortcuts to websites, tab audio control, or TypeScript userscripts. Covers all header tags (@match, @grant, @require, @run-in), GM_* synchronous APIs, GM.* promise-based APIs (recommended for new scripts), batch storage (GM.getValues/setValues v5.3+), binary data support (v5.4+), TypeScript setup via @types/tampermonkey, security sandboxing, and cross-browser compatibility (Chrome, Firefox, Edge). Do NOT use for Selenium/Puppeteer automation, browser extensions (WebExtensions/MV3), or server-side scripts.
95google-apps-script
Comprehensive guide for Google Apps Script development covering all built-in services (SpreadsheetApp, DocumentApp, GmailApp, DriveApp, CalendarApp, FormApp, SlidesApp), triggers, authorization, error handling, and performance optimization. Use when automating Google Sheets operations, creating Google Docs, managing Gmail/email, working with Google Drive files, automating Calendar events, implementing triggers (time-based, event-based), building custom functions, creating add-ons, handling OAuth scopes, optimizing Apps Script performance, working with UrlFetchApp for API calls, using PropertiesService for persistent storage, or implementing CacheService for temporary data. Covers batch operations, error recovery, and JavaScript ES6+ runtime.
74shopify-theme-dev
Complete theme development guide including file structure, JSON templates, sections, snippets, settings schema, and Online Store 2.0 architecture. Use when creating Shopify themes, organizing theme files, building sections and blocks, working with .json template files, configuring settings_schema.json, creating snippets, or implementing theme customization features.
23shopify-developer
Complete Shopify development reference for Liquid templating, theme development (OS 2.0), GraphQL Admin API, Storefront API, custom app development, Shopify Functions, Hydrogen, performance optimisation, and debugging. Use when working with .liquid files, creating theme sections and blocks, writing GraphQL queries or mutations for Shopify, building Shopify apps with CLI and Polaris, implementing cart operations via Ajax API, optimising Core Web Vitals for Shopify stores, debugging Liquid or API errors, configuring settings_schema.json, accessing Shopify objects (product, collection, cart, customer), using Liquid filters, creating app extensions, working with webhooks, migrating from Scripts to Functions, or building headless storefronts with Hydrogen and React Router 7. Covers API version 2026-01.
17google-analytics
Comprehensive Google Analytics 4 guide covering property setup, events, custom events, recommended events, custom dimensions, user tracking, audiences, reporting, BigQuery integration, gtag.js implementation, GTM integration, Measurement Protocol, DebugView, privacy compliance, and data management. Use when working with GA4 implementation, tracking, analysis, or any GA4-related tasks.
14google-ads-scripts
Expert guidance for Google Ads Script development including AdsApp API, campaign management, ad groups, keywords, bidding strategies, performance reporting, budget management, automated rules, and optimization patterns. Use when automating Google Ads campaigns, managing keywords and bids, creating performance reports, implementing automated rules, optimizing ad spend, working with campaign budgets, monitoring quality scores, tracking conversions, pausing low-performing keywords, adjusting bids based on ROAS, or building Google Ads automation scripts. Covers campaign operations, keyword targeting, bid optimization, conversion tracking, error handling, and JavaScript-based automation in Google Ads editor.
12