Google Tag Manager
Connect Google Tag Manager to Claude, ChatGPT or Cursor via MCP. List accounts and containers, then inspect or edit tags in a workspace.
Example questions
Try asking your AI client
-
Which Google Tag Manager accounts and containers can I access?
-
Resolve GTM-XXXXXX to a numeric container ID, then list tags in the default workspace.
-
Which triggers fire the GA4 configuration tag, and is that tag paused?
-
Write a draft paused HTML debug tag for Amalie - do not publish the container.
-
Create a workspace version named Launch review, but do not publish it until I confirm.
Overview
Manage Google Tag Manager accounts, containers, and workspace tags from AI clients. This Google Tag Manager MCP integration lets marketing agents list containers, inspect tags and triggers, and apply workspace edits without opening the GTM UI for every change.
Common use cases
- Container discovery - list accounts and containers the connected Google account can access.
- Workspace inspection - read tags, triggers, variables, and folders before changing a container.
- Safe edits - create or update tags in a workspace, then create a version only when you are ready.
- Public ID lookup - resolve a
GTM-XXXXpublic id to the numeric container ID other tools need. - Private gateway - combine Google Tag Manager with GA4, Search Console, and other integrations in one agent workflow.
Prerequisites
- A Google account with access to at least one Google Tag Manager account
- A stackgate.ai account
Getting credentials
- Open Integrations → Google Tag Manager.
- Click Activate, then Connect with Google OAuth.
- Choose Standard access (Read and Write, including publish) or pick specific tools.
- Grant Tag Manager access on the Google consent screen (
tagmanager.readonlyfor Read; Write also requeststagmanager.edit.containers,tagmanager.edit.containerversions, andtagmanager.publish).
Using with AI clients
- Dedicated endpoint:
POST /mcp/google-tag-manager - Private gateway:
google-tag-manager__*tools
Example prompts:
- Which GTM accounts and containers can I access?
- Resolve GTM-XXXXXX to a numeric container ID in account 123456.
- List tags in the default workspace and show which triggers fire the GA4 configuration tag.
- Create a paused HTML tag in workspace 1, but do not publish.
Troubleshooting
- Empty account list - verify the Google account has access in tagmanager.google.com.
- Permission denied / 403 - reconnect to refresh OAuth scopes, and confirm the numeric account and container IDs.
- GTM-XXXX rejected - other tools need
containerId. Callresolve_containerwith the public id first. - Fingerprint mismatch - re-fetch the tag, trigger, or variable and retry the update with the latest fingerprint.
- Hub quota / 429 - stackgate.ai limits shared Google Cloud project usage (default 40 calls per user per day). Retry after UTC midnight.
- Upstream quota / 403 - Google limits the hub project to 10,000 requests per day and 0.25 QPS. Wait and retry, and keep calls sequential.
- Auth errors - reconnect Google Tag Manager from My Integrations to refresh tokens.
Available tools
-
list_accounts
List Google Tag Manager accounts the connected Google account can access.
-
get_account
Get a Google Tag Manager account by numeric account ID.
-
list_containers
List containers in a GTM account. Use containerId from the response, not publicId (GTM-XXXX).
-
get_container
Get a GTM container by numeric account and container IDs.
-
resolve_container
Resolve a GTM-XXXX public container id (or numeric container_id) to the numeric containerId used by other tools.
-
list_workspaces
List workspaces in a GTM container.
-
get_workspace
Get a GTM workspace by ID.
-
list_tags
List tags in a GTM workspace.
-
get_tag
Get a GTM tag, including parameters, triggers, and fingerprint.
-
list_triggers
List triggers in a GTM workspace.
-
get_trigger
Get a GTM trigger by ID.
-
list_variables
List variables in a GTM workspace.
-
get_variable
Get a GTM variable by ID.
-
list_folders
List folders in a GTM workspace.
-
get_folder
Get a GTM folder by ID.
-
create_tag
Create a tag in a GTM workspace. Use numeric trigger IDs from list_triggers.
-
update_tag
Update a GTM tag. Send fingerprint from get_tag to avoid overwriting newer edits.
-
create_trigger
Create a trigger in a GTM workspace.
-
update_trigger
Update a GTM trigger. Send fingerprint from get_trigger when available.
-
create_variable
Create a variable in a GTM workspace.
-
update_variable
Update a GTM variable. Send fingerprint from get_variable when available.
-
list_version_headers
List container version headers (id, name, published) for a GTM container.
-
get_version
Get a full GTM container version by version ID.
-
create_version
Create a container version from the current workspace. This removes the workspace after the version is created.
-
publish_version
Publish a GTM container version to the live environment. Only use when the user explicitly asks to go live.
-
get_container_snippet
Get the web install snippet and publicId (GTM-XXXX) for a container.
MCP endpoint:
https://stackgate.ai/mcp/google-tag-manager
(HTTP) or via the
private gateway.