By the end of this guide, you will have a fully implemented GTM container with your key tracking tags, triggers, and variables - audited for errors, tested in GTM Preview mode, and documented in a stakeholder report. The whole process takes 2 to 4 hours, compared to 3 to 5 days with the traditional developer workflow.
You will need the following before running this guide:
The GTM Automation skill is a set of instructions that tells Claude Code how to work with Google Tag Manager. It gives Claude Code knowledge of GTM best practices, tag types, trigger logic patterns, and the output format for audit reports, implementation plans, and stakeholder reports.
To add the skill to your Claude Code session, run the following command in your terminal from your project directory:
claude --skill gtm-automationAlternatively, you can use the Tag Manager Engine - a web interface on marketers.wiki that has the GTM skill pre-loaded and guides you through each step of this workflow automatically.
Once the skill is loaded, Claude Code will confirm it is ready and ask for your first instruction. You are ready to move to the audit.
The audit is the foundation of the whole workflow. It maps your existing container - every tag, trigger, variable, and the relationships between them - and surfaces every issue before you touch anything.
Make sure your GTM container export JSON is in your working directory. Then run this prompt in Claude Code:
You are a Google Tag Manager specialist. I have my GTM container
exported at ./gtm-container-export.json.
Run a full audit of this container and produce a structured report
covering:
1. TAGS - List every tag, its type, its trigger assignment, and
flag any issues (no trigger assigned, firing on wrong pages,
duplicate conversion tags, hardcoded values that should be
dynamic variables).
2. TRIGGERS - List every trigger. Flag triggers that are unused,
triggers with overlapping conditions, and triggers using
page URL rules that are fragile (e.g. "contains /thank-you"
which breaks if the URL changes).
3. VARIABLES - List every variable. Flag dataLayer variables that
are referenced in tags but not defined, and variables that are
defined but not used anywhere.
4. NAMING CONVENTIONS - Identify any inconsistencies in dataLayer
variable names (camelCase vs snake_case vs PascalCase). List
every variable with its current name and the recommended
standardised name.
5. PRIORITY ISSUES - Top 5 most critical issues with impact
explanation for each.
Format as a structured markdown report. Include a summary table
at the top showing total counts and total issues found.Claude Code reads the container JSON and produces the report in under 2 minutes for most containers. A typical output includes a summary table, the priority issues list, and a complete inventory of every container element with status flags.
What the audit output looks like:
Example output (excerpt)
Save this report. You will reference it in the next steps and include it in the final stakeholder report.
This is the approval gate - the most important step in the workflow. Claude Code will not make any changes to your GTM container until you have explicitly approved its implementation plan.
After reviewing the audit report, provide Claude Code with your tracking requirements and ask it to produce an implementation plan:
Based on the audit findings and the following tracking requirements,
produce a full implementation plan. Do not make any changes yet.
Tracking requirements:
- GA4 configuration tag on all pages
- GA4 purchase event with transaction_id, value, currency, items
- GA4 add_to_cart event with product_id, product_name, value
- GA4 form_submit event on all contact forms
- Google Ads conversion tag on /thank-you pages (conversion label: XXXXX)
- Meta Pixel base code on all pages
- Meta Pixel Purchase event on /order-confirmation with value and currency
For each item, specify:
- Tag name (following [Platform] - [Event] naming convention)
- Tag type and configuration
- Trigger to create or reuse
- Variables needed (new or existing)
- Any dependencies or order of implementation
Present the plan as a table I can review before you proceed.Claude Code will return a structured table showing every tag it plans to create or modify, the trigger logic, and the variables required. Review this carefully.
What to check in the implementation plan:
When you are satisfied, respond with "Approved - proceed with implementation." If you want changes, describe them and Claude Code will update the plan before proceeding. You can cycle through this as many times as needed.
Important: Never skip this step. Reviewing the plan before implementation is what keeps Claude Code's output aligned with your actual requirements. It takes 5-10 minutes and saves you from having to undo incorrect implementations.
With the plan approved, Claude Code creates every tag, trigger, and variable in the order specified in the implementation plan.
If you have GTM API access configured, Claude Code pushes the changes directly to a new workspace in your GTM container. If not, it generates an updated container JSON that you can import via GTM Container Settings -> Import Container.
For each item in the implementation plan, Claude Code will:
Implementation of a 10-15 tag setup typically takes 5 to 15 minutes. Claude Code outputs a change log as it works, so you can see exactly what has been created.
When implementation is complete, Claude Code will confirm the total number of tags, triggers, and variables created, and flag any items it was not able to implement automatically (these are usually edge cases that need manual configuration).
Never publish a GTM container without testing in Preview mode first. Claude Code produces a testing checklist that tells you exactly what to do in GTM Preview mode to verify every tag is working correctly.
Ask Claude Code for the testing checklist:
Based on the implementation we just completed, produce a GTM Preview
mode testing checklist.
For each tag, specify:
1. Which URL to visit or which action to perform in the browser
2. Which tag name should appear in the GTM Preview panel as "Fired"
3. Which variables should be populated in the dataLayer (with example
expected values)
4. What to check in the GA4 DebugView or browser network tab to
confirm the event fired correctly
Format as a numbered checklist I can work through in order.Open GTM Preview mode (Submit -> Preview in GTM), visit your site, and work through the checklist. For each tag:
Document your test results - pass or fail for each tag. If a tag fails, describe the issue to Claude Code and it will diagnose and fix it. Re-test after any fix before moving to the next tag.
Once every tag has passed testing, you can publish the GTM workspace. In GTM, click Submit, add a version name (e.g. "AI implementation - [date]") and a brief description, then Publish.
The final step is generating a tracking implementation report. This document captures everything that happened in the workflow - the audit findings, the implementation decisions, and the test results - in a format that non-technical stakeholders can read.
Ask Claude Code to write the report:
Based on everything we have done in this session - the audit,
the implementation plan, the implementation itself, and the test
results - write a tracking implementation report.
The report should include:
1. Executive summary (3-4 sentences: what was done, what was found,
what is now live)
2. Audit findings summary (table of issues found, with status:
fixed / not in scope / to be addressed)
3. Implementation summary (table of all tags implemented, their
status, and what they track)
4. Testing summary (table of all tags tested, pass/fail result,
and any notes)
5. What is now live (plain-language description of what data is
now being collected and where it goes)
6. Recommended next steps (any items flagged during audit that
were not addressed in this implementation)
Write it for a non-technical audience. Avoid jargon. Use plain
language throughout. Format as a clean markdown document.The report Claude Code produces covers everything from the initial audit findings to the final published state of the container. It is ready to share with clients, managers, or the wider team without any editing.
Save the report to your project folder alongside the original audit findings. This becomes your documentation for the implementation and a reference point for future changes to the container.
These are the three most common ways marketers get tripped up when running this workflow for the first time.
Skipping the audit
It is tempting to jump straight to implementation when you know what tags you need. The audit exists to surface problems you do not know about - undefined variables, conflicting triggers, duplicate tags. Skipping the audit means you implement on top of a broken foundation. This always creates more work later.
Not reviewing the strategy before implementation
The implementation plan is Claude Code's interpretation of your requirements. It is very good, but it is not perfect. Review the plan carefully before approving. Pay particular attention to trigger logic - a tag that fires on the wrong trigger can inflate your conversion data by orders of magnitude. Five minutes of review saves hours of debugging.
Testing in production
Always use GTM Preview mode for testing. Preview mode lets you test your changes against the live site without publishing them - the tags fire in your browser session only. Publishing before testing means errors go live immediately and can corrupt your data for the entire period until they are fixed. Never skip the test step.
For a new container with a clear tracking requirements document, the full workflow - audit, plan, implement, test, report - typically takes 2 to 4 hours. This compares to 3 to 5 days for the same work done manually with developer involvement. The audit step alone takes under 5 minutes. The time varies based on the size of your container and the number of tags you are implementing.
For auditing only, you can export your GTM container as JSON and give it to Claude Code - no API needed. For implementation (writing tags back to GTM), you need GTM API access via a Google Cloud project with the Tag Manager API enabled. The Tag Manager Engine handles this API configuration automatically, so you do not have to set it up manually.
Claude Code implements whatever tags are in your tracking requirements document. It does not add tags you have not asked for. Common implementations include GA4 configuration, GA4 event tags (page_view, purchase, add_to_cart, form_submit, etc.), Google Ads conversion and remarketing tags, Meta Pixel, and LinkedIn Insight. You control the scope entirely.
Yes. The workflow is designed for existing containers as well as new ones. The audit step is particularly valuable for containers that have been managed by multiple people over time - it surfaces conflicts, duplicates, and errors that are easy to miss in manual review. Claude Code is careful to preserve existing working tags and only modify what needs to be changed.
The Tag Manager Engine runs all 6 steps - audit, standardise, plan, implement, test, report - in a guided interface. The GTM skill is pre-loaded. No configuration required.