Tag Manager Tools
24 tools for Google Tag Manager container management
Google Tag Manager Tools
24 MCP tools for managing GTM containers, workspaces, tags, triggers, variables, and versions. 14 stable tools plus 10 beta tools for advanced container management.
OAuth Scopes Required
tagmanager.readonly- Read containers, tags, triggers, variablestagmanager.edit.containers- Edit container configurationtagmanager.edit.containerversions- Create and manage versions
Note: Publishing versions requires manual approval in GTM UI for safety.
Stable Tools (14)
Account & Container Management (4 tools)
gtm_list_accounts
List all GTM accounts you have access to.
gtm_list_containers
List containers for a specific account. Returns container ID, name, path, and public ID. Use gtm_list_workspaces to find available workspaces for each container.
gtm_list_workspaces
List all workspaces in a container. Use this to find the active workspace path needed by other tools.
gtm_get_container
Get details for a specific container.
Tag Management (5 tools)
gtm_list_tags
List all tags in a workspace with pagination support.
gtm_get_tag
Get detailed configuration for a specific tag.
gtm_create_tag
Create a new tag (GA4, Google Ads, Custom HTML, etc.).
gtm_update_tag
Update an existing tag's configuration.
gtm_delete_tag
Delete a tag from the workspace.
Trigger & Variable Management (2 tools)
gtm_list_triggers
List all triggers in a workspace.
gtm_list_variables
List all variables in a workspace.
Version Management (2 tools)
gtm_list_versions
List all versions of a container.
gtm_create_version
Create a new version from the current workspace state.
Audit & Analysis (1 tool)
gtm_audit_container
Comprehensive container audit checking for:
- Deprecated UA tags
- Missing Consent Mode v2
- Naming convention violations
- Unused triggers/variables
Beta Tools (10)
These tools are fully functional but in beta. They require the tagmanager:edit scope.
Container & Workspace Creation (2 tools)
gtm_create_container BETA
Create a new GTM container in an account.
| Parameter | Type | Required | Description |
|---|---|---|---|
accountId | string | Yes | GTM account path (e.g., accounts/123456) |
name | string | Yes | Container display name |
usageContext | string[] | Yes | Platform: WEB, ANDROID, IOS, AMP, SERVER |
domainName | string[] | No | Domain names for the container |
notes | string | No | Container notes |
gtm_create_workspace BETA
Create a new workspace in a container for isolated changes.
| Parameter | Type | Required | Description |
|---|---|---|---|
containerPath | string | Yes | Container path (e.g., accounts/123456/containers/789) |
name | string | Yes | Workspace display name |
description | string | No | Workspace description |
Trigger CRUD (3 tools)
gtm_create_trigger BETA
Create a new trigger in a workspace.
| Parameter | Type | Required | Description |
|---|---|---|---|
workspacePath | string | Yes | Workspace path |
name | string | Yes | Trigger display name |
type | string | Yes | Trigger type (see supported types below) |
customEventFilter | Condition[] | No | Conditions for custom event triggers |
filter | Condition[] | No | Conditions that must all be true |
autoEventFilter | Condition[] | No | Auto-event tracking conditions |
eventName | Parameter | No | Event name (for Custom Event / Timer) |
interval | Parameter | No | Interval in ms (Timer triggers) |
limit | Parameter | No | Max trigger count (Timer triggers) |
parentFolderId | string | No | Parent folder ID |
Supported trigger types: PAGEVIEW, DOM_READY, WINDOW_LOADED, CLICK, LINK_CLICK, FORM_SUBMISSION, CUSTOM_EVENT, HISTORY_CHANGE, TIMER, ELEMENT_VISIBILITY, SCROLL_DEPTH, YOUTUBE_VIDEO, TRIGGER_GROUP, ALWAYS
gtm_update_trigger BETA
Update an existing trigger. Fetches the current configuration and merges your changes.
| Parameter | Type | Required | Description |
|---|---|---|---|
triggerPath | string | Yes | Trigger path |
name | string | No | New trigger name |
type | string | No | New trigger type |
customEventFilter | Condition[] | No | Updated conditions |
filter | Condition[] | No | Updated filter conditions |
gtm_delete_trigger BETA
Delete a trigger from the workspace.
| Parameter | Type | Required | Description |
|---|---|---|---|
triggerPath | string | Yes | Full trigger path |
Variable CRUD (3 tools)
gtm_create_variable BETA
Create a new variable in a workspace.
| Parameter | Type | Required | Description |
|---|---|---|---|
workspacePath | string | Yes | Workspace path |
name | string | Yes | Variable display name |
type | string | Yes | Variable type (see supported types below) |
parameter | Parameter[] | No | Type-specific parameters |
parentFolderId | string | No | Parent folder ID |
Supported variable types: v (Data Layer), d (DOM Element), c (Constant), k (1st Party Cookie), j (JavaScript Variable), jsm (Custom JavaScript), aev (Auto-Event Variable), gas (Google Analytics Settings), remm (Regex Table), smm (Lookup Table)
gtm_update_variable BETA
Update an existing variable. Fetches the current configuration and merges your changes.
| Parameter | Type | Required | Description |
|---|---|---|---|
variablePath | string | Yes | Variable path |
name | string | No | New variable name |
type | string | No | New variable type |
parameter | Parameter[] | No | Updated parameters |
gtm_delete_variable BETA
Delete a variable from the workspace.
| Parameter | Type | Required | Description |
|---|---|---|---|
variablePath | string | Yes | Full variable path |
Built-in Variables & Folders (2 tools)
gtm_enable_built_in_variables BETA
Enable built-in variables in a workspace.
| Parameter | Type | Required | Description |
|---|---|---|---|
workspacePath | string | Yes | Workspace path |
type | string[] | Yes | Variable types to enable |
Supported types: PAGE_URL, PAGE_HOSTNAME, PAGE_PATH, REFERRER, EVENT, CLICK_ELEMENT, CLICK_CLASSES, CLICK_ID, CLICK_TARGET, CLICK_URL, CLICK_TEXT, FORM_ELEMENT, FORM_CLASSES, FORM_ID, FORM_TARGET, FORM_URL, FORM_TEXT, CONTAINER_ID, DEBUG_MODE, RANDOM_NUMBER, HTML_ID
gtm_create_folder BETA
Create a folder in a workspace for organizing tags, triggers, and variables.
| Parameter | Type | Required | Description |
|---|---|---|---|
workspacePath | string | Yes | Workspace path |
name | string | Yes | Folder display name |
notes | string | No | Folder notes |
Common Use Cases
List All Tags
Ask Claude:
Show me all tags in my GTM containerResponse includes:
- Tag name and ID
- Tag type (GA4, Google Ads, Custom HTML, etc.)
- Firing triggers
- Status (enabled/disabled)
Create GA4 Event Tag
Ask Claude:
Create a GA4 event tag that fires on button clicks
Event name: button_click
Measurement ID: G-XXXXXXXXXXClaude will:
- Create the tag with correct parameters
- Set up trigger configuration
- Return the tag ID for reference
Audit Container for Issues
Ask Claude:
Audit my GTM container for deprecated tags
and Consent Mode issuesAudit checks:
- ❌ Universal Analytics tags (deprecated)
- ⚠️ Missing Consent Mode v2 on GA4/Ads tags
- ℹ️ Naming convention violations
- ℹ️ Unused triggers and variables
Create Version & Preview
Ask Claude:
Create a new GTM version with name "Add newsletter tracking"
and description "Added event tag for newsletter signups"Important: Versions are created but NOT published automatically. You must review and publish in GTM UI.
Tag Types Supported
Tracking Tags
- Google Analytics 4 - Event tracking, page views, conversions
- Google Ads - Conversion tracking, remarketing
- Floodlight - Campaign Manager conversion tracking
Marketing Tags
- Facebook Pixel - Meta conversion tracking
- LinkedIn Insight - LinkedIn campaign tracking
- Twitter Universal - Twitter conversion tracking
Custom Tags
- Custom HTML - Any JavaScript code
- Custom Image - Image pixel tags
Safety Features
No Automatic Publishing
The gtm_publish_version tool was intentionally removed for safety. All versions must be:
- Created via
gtm_create_version - Reviewed in GTM UI
- Manually published after verification
This prevents accidental deployment of broken tracking.
Workspace Isolation
Use gtm_list_workspaces to discover available workspaces. All changes are scoped to a specific workspace:
- ✅ Changes don't affect live site until published
- ✅ You can preview changes before deploying
- ✅ Rollback is possible if issues found
- ✅ Use
gtm_create_workspaceto isolate changes in a dedicated workspace
Audit Before Changes
Run gtm_audit_container before making changes to understand current state.
Examples
Example 1: Add Conversion Tracking
Task: Add GA4 conversion event for newsletter signups
1. List current tags
2. Create new GA4 event tag:
- Event name: newsletter_signup
- Measurement ID: G-XXXXXXXXXX
- Trigger: Form submission (email signup form)
3. Create version "Add newsletter conversion"
4. Preview in GTM
5. Publish manuallyExample 2: Migrate from UA to GA4
Task: Audit container and migrate UA tags to GA4
1. Audit container (find all UA tags)
2. For each UA tag:
- Note the trigger configuration
- Create equivalent GA4 tag
- Disable (don't delete) UA tag
3. Create version "UA to GA4 migration"
4. Test thoroughly in preview mode
5. Publish after validationExample 3: Clean Up Unused Tags
Task: Find and remove unused tags
1. List all tags
2. List all triggers
3. Audit for unused resources
4. Delete unused tags (or disable for safety)
5. Create version "Cleanup unused tags"Limitations
API limitations:
- 10 queries per second (QPS)
- 100 tags per workspace (GTM limit)
- Version history limited to 3 months
Best Practices
✅ Do:
- Audit before making changes
- Use descriptive tag names (e.g., "GA4 - Newsletter Signup")
- Test in preview mode before publishing
- Create versions for every logical change
- Document changes in version descriptions
❌ Don't:
- Delete tags without disabling first (test impact)
- Make many rapid changes (risk of errors)
- Skip audit step
- Publish without previewing
Troubleshooting
"Permission denied" error:
- Verify you've connected Google with Tag Manager scope
- Check if you have edit access to the container
Tags not appearing:
- Ensure you're querying the correct workspace path
- Verify the workspace exists
Audit fails:
- Check container access permissions
- Verify workspace path format
See full troubleshooting guide