How to Connect Google Tag Manager (GTM) to Claude

Jul 23, 2026 by Ahmed Ali

TL;DR Connect Google Tag Manager to Claude through Markifact. Audit live containers, build tags and triggers, preview workspaces, and approve GTM publishing.

How to Connect Google Tag Manager (GTM) to Claude

To connect Google Tag Manager to Claude, connect GTM in Markifact, add https://api.markifact.com/mcp as a custom Claude connector, authenticate, and begin by auditing the live container. Claude can then inspect your GTM setup and prepare tags, triggers, variables, versions, and publishing actions through real GTM operations. Every write waits for your approval, so you can review the exact account, container, workspace, and payload before anything changes.

The quick version

  1. Open the Google Tag Manager MCP page and sign in to Markifact.
  2. Connect Google Tag Manager with a Google account that has access to the containers you need.
  3. In Claude, open Settings > Connectors > Add custom connector.
  4. Name the connector Markifact and enter https://api.markifact.com/mcp.
  5. Authenticate and enable Markifact in the conversation.
  6. Ask Claude to list your GTM accounts and containers.
  7. Run a read-only live-version audit before preparing any change.

This is full GTM management, not only reporting. The safe sequence is still read first, edit a workspace second, create a version after review, and publish only after a final approval.

What you are actually connecting

The setup has three layers:

  1. Google Tag Manager stores the accounts, containers, workspaces, tags, triggers, variables, versions, and publishing state.
  2. Markifact handles Google OAuth and exposes GTM operations through a hosted MCP server.
  3. Claude turns a plain-language request into the appropriate read or write operation and explains the result.

Google provides the official Tag Manager API v2. As of July 23, 2026, Google's public managed MCP materials do not list an official Google Tag Manager MCP server. Markifact supplies the managed MCP layer used in this guide.

Understand the GTM hierarchy first

GTM has a hierarchy that matters whenever you ask Claude to make a change:

  • An account contains one or more containers.
  • A container represents a web, server, Android, or iOS tagging environment.
  • A workspace is where editable changes are prepared.
  • A container version is an immutable snapshot of a workspace.
  • The live version is the version currently published to sites or apps using that container.

Creating a tag in a workspace does not make it live. Creating a version does not publish it either. Publishing is a separate operation and approval.

Before you start

You need:

  • A Markifact workspace.
  • A Google account with the required GTM account and container permissions.
  • A Claude plan and workspace that support custom connectors.
  • The GTM account, container, and workspace you intend to use.
  • A clear idea of whether the request is an audit, a draft workspace change, or a production publish.

The connected Google user's permissions remain the source of truth. If the user can view a container but cannot edit or publish it in GTM, Claude cannot bypass that boundary.

For the first session, use a read-only audit. Do not begin by asking Claude to create and publish a tag in one instruction.

1. Connect Google Tag Manager in Markifact

Open Markifact, go to your connections, choose Google Tag Manager, and select Connect. Sign in with the Google account that has access to the GTM accounts and containers you want to manage.

Markifact Google Tag Manager connection screen
Connect Google Tag Manager to Markifact with the Google account that has access to the containers you need.

Markifact requests the Google scopes needed to manage accounts, edit containers and container versions, and publish. Google still applies the user's GTM permissions to every request.

After OAuth completes, confirm that the connection is active. If you manage several clients, ask Markifact or Claude to list the available accounts and containers before naming a target.

2. Add Markifact as a Claude connector

In Claude:

  1. Open Settings.
  2. Select Connectors.
  3. Choose Add custom connector.
  4. Enter Markifact as the name.
  5. Paste https://api.markifact.com/mcp as the remote MCP server URL.
  6. Save and complete authentication.

Claude Connectors screen with Add custom connector selected
Open Claude's connector settings and choose Add custom connector.

The endpoint is the same for your connected Markifact apps. GTM becomes available because it is connected in the authenticated Markifact workspace.

Claude custom connector dialog configured for Markifact
Name the connector Markifact and use https://api.markifact.com/mcp as the remote MCP server URL.

Return to the conversation and make sure Markifact is enabled. An installed connector may still be unavailable to a particular chat until you select it.

3. Run a safe first GTM audit

Start by discovering the correct target and reading the live version:

Use Markifact to list my Google Tag Manager accounts and containers. Find the container named Main Website in the Aster Commerce account. Then inspect its live version and summarize the tags, triggers, variables, paused tags, and obvious configuration risks. Read only. Do not create, update, delete, version, or publish anything.

Claude can use operations such as gtm_list_accounts, gtm_list_containers, and gtm_get_live_version. Ask it to repeat the account ID, container ID, public container ID, and live version number in the answer.

Claude using gtm_get_live_version to audit a live GTM container
Start with gtm_get_live_version so Claude audits the configuration that is actually published before proposing workspace changes.

The live-version check matters because a workspace may contain unpublished changes. Auditing only a workspace can make a draft configuration look like the production setup.

Real Google Tag Manager MCP operation examples

Markifact's current GTM registry contains 97 operations: 37 reads and 60 approval-gated writes. The names below are examples, not an exhaustive list.

Useful read examples include:

  • gtm_list_accounts
  • gtm_list_containers
  • gtm_list_workspaces
  • gtm_list_tags
  • gtm_list_triggers
  • gtm_list_variables
  • gtm_get_workspace_status
  • gtm_get_live_version

Useful write examples include:

  • gtm_create_tag
  • gtm_create_trigger
  • gtm_create_variable
  • gtm_update_tag
  • gtm_quick_preview_workspace
  • gtm_create_version
  • gtm_publish_version

The catalog also covers folders, built-in variables, clients, templates, transformations, zones, environments, destinations, container combinations, and recovery operations. The Google Tag Manager MCP page is the best reference for the full surface.

Audit the live container before editing

A useful audit should answer:

  • Which version is live?
  • Which tags fire on every page?
  • Which triggers have no associated tags?
  • Which variables appear unused?
  • Which tags are paused?
  • Are old analytics or advertising tags still present?
  • Are naming conventions consistent?
  • Are consent checks and initialization order sensible?

Copy this prompt:

Audit the live GTM version for account 6001234567 and container 12004567. List all tags with their type, firing triggers, pause state, and consent configuration. Flag duplicate measurement tags, orphaned triggers, unused variables, broad Custom HTML tags, and inconsistent names. Separate confirmed findings from items that need a human check. Read only.

Claude can structure the result, but it cannot prove browser behavior from container configuration alone. A tag that looks correct may still fail because of consent state, page data, selectors, JavaScript errors, or a destination-side setting. Use GTM Preview and browser validation before publishing.

Build tags, triggers, and variables safely

The best way to use Claude for GTM changes is to make the dependency order explicit. A typical tracking change may need:

  1. A variable that reads a data-layer value.
  2. A trigger that defines when the event occurs.
  3. A tag that sends the event.
  4. A preview of the workspace.
  5. A container version.
  6. A final publish.

Ask Claude to inspect the workspace first and explain the intended payloads:

In the Measurement Cleanup workspace for account 6001234567 and container 12004567, prepare a GA4 purchase event setup. Before any write, inspect existing ecommerce variables, purchase triggers, Google tags, and naming conventions. Propose the exact variable, trigger, and tag payloads, explain dependencies, and wait for approval for each write. Do not create a version or publish.

Every write is approval-gated. Reviewing the exact operation and target is especially important when several accounts use similar container names.

Do not treat the operation names as a fixed limit. gtm_create_tag, gtm_create_trigger, and gtm_create_variable are representative examples from a much larger GTM surface.

Preview, create a version, then publish

There are three different checkpoints:

Preview the workspace

Use a workspace status or quick-preview operation to catch conflicts and inspect the proposed configuration. Then run GTM Preview in a real browser to test consent, data-layer values, firing order, network requests, and duplicate events.

Create a container version

gtm_create_version snapshots the workspace. Google then removes that source workspace and creates a new default workspace, so version creation deserves its own review and approval.

Use a descriptive name and notes:

After I approve, create a container version from the Measurement Cleanup workspace. Name it GA4 Purchase Cleanup. Include notes describing the new purchase event tag, trigger, variables, validation performed, and rollback plan. Do not publish it.

Publish the approved version

gtm_publish_version is separate. Publishing makes the selected version live on every site or app using the container.

Prepare to publish version 129 in account 6001234567 and container 12004567. First restate the current live version, target version, version name, change summary, validation completed, and rollback version. Do not publish until I explicitly approve the gtm_publish_version operation.

Claude showing a gtm_publish_version action waiting for approval
Publishing is a separate approval. Review the account, container, target version, and rollback plan before allowing gtm_publish_version.

This split prevents a sensible workspace edit from becoming an accidental production release.

Copy-paste GTM prompts for Claude

Find duplicate analytics tags

Inspect the live version of Main Website. Find Google tags, GA4 event tags, and Custom HTML tags that may send duplicate page_view, purchase, generate_lead, or sign_up events. Show the evidence and firing triggers. Read only.

Review a workspace against live

Compare the Measurement Cleanup workspace with the live container version. Summarize added, modified, and deleted tags, triggers, and variables. Flag conflicts, unexpectedly broad triggers, and changes to consent settings. Do not write or publish.

Clean up naming without changing behavior

Audit tag, trigger, variable, and folder names in the workspace. Propose a consistent naming convention and a rename plan. Do not apply any rename until I approve each operation. Do not alter payloads, trigger logic, or publishing state.

Prepare a Google Ads conversion tag

Inspect the existing Google tag, consent setup, lead data-layer event, and conversion tags. Propose a Google Ads lead conversion tag using the existing conventions. Show the exact trigger and tag payload, identify any missing inputs, and wait for approval. Do not create a version or publish.

Document the live container

Create a read-only inventory of the live container grouped by analytics, advertising, consent, utilities, and Custom HTML. Include tag type, trigger, variables, owner inference, and cleanup risk. Clearly label every inference.

Advanced GTM work Claude can prepare

The connector goes beyond basic web tags. Depending on the container and permissions, Claude can work with server-side clients, custom templates, transformations, zones, environments, destinations, folders, and built-in variables.

Some operations carry unusually high risk. For example, combining containers can be irreversible and retire the source container. Deleting or publishing can affect production tracking immediately. Keep high-impact actions isolated, require explicit account and container IDs, and review the approval card carefully.

For measurement analysis after implementation, connect GA4 to Claude. GTM tells you how tracking is configured. GA4 tells you what data arrived and how users behaved. The two answer different questions.

Troubleshooting

Claude cannot find the account or container

Open GTM with the same Google account used in Markifact. Confirm the user can see the account and container, then reconnect GTM if permissions changed.

The connector is missing in Claude

Check Settings > Connectors, confirm the Markifact connector exists, and enable it for the current conversation.

A write returns a permissions error

The Google user may have read access but not edit, approve, or publish access. Check GTM user management rather than reconnecting repeatedly.

The workspace changed but the site did not

Workspace edits are not live. Create a version after validation, then publish that version with a separate approval.

Version creation removed the workspace

That is expected GTM behavior. Creating a version snapshots the workspace and replaces it with a new default workspace.

The published tag does not fire

Use GTM Preview, inspect the data layer and consent state, check the tag's trigger and exceptions, and confirm the destination receives the request. Configuration review alone cannot reproduce the browser.

A safe first workflow

  1. List the GTM accounts and containers.
  2. Confirm the exact account and container IDs.
  3. Read the live version.
  4. Audit tags, triggers, variables, consent, and naming.
  5. Choose or create a workspace.
  6. Prepare one small change with explicit dependencies.
  7. Approve each write separately.
  8. Review workspace status and run GTM Preview.
  9. Create a named container version.
  10. Publish only after a separate review and approval.
  11. Validate the production site and keep the previous live version as the rollback point.

If you prefer ChatGPT or Codex, the companion guide explains how to connect Google Tag Manager to ChatGPT and Codex.

Frequently asked questions

Can Claude connect to Google Tag Manager?

Yes. Connect GTM to Markifact with Google OAuth, add the Markifact MCP endpoint as a custom Claude connector, and authenticate. Claude can then use the GTM operations available to the connected account.

Is there an official Google Tag Manager MCP server?

As of July 23, 2026, Google's public managed MCP materials do not list an official GTM MCP server. Google provides the official Tag Manager API v2, while Markifact supplies the hosted MCP layer described here.

Can Claude create and publish GTM tags?

Yes. Markifact supports full read and write GTM workflows. Writes, version creation, and publishing require approval, and publishing should remain a separate final step.

Does creating a GTM tag make it live?

No. The tag is created in a workspace. You must validate the workspace, create a container version, and publish that version before the change becomes live.

How many GTM operations does Markifact support?

The current registry contains 97 GTM operations, split into 37 reads and 60 approval-gated writes. Named operations in this guide are examples, not the complete list.

Can Claude work with server-side GTM containers?

Yes. The GTM surface includes server-side resources such as clients and transformations, subject to the connected account's container type and permissions.

Do I need a Google Cloud project or service account?

Not for the Markifact route. Google OAuth authorizes the connection, and Markifact hosts the MCP server.

How do I prevent accidental publishing?

Use read-only prompts first, make workspace writes one at a time, validate in GTM Preview, create a version separately, and require an explicit final approval for gtm_publish_version.

Looking to automate your marketing?

Markifact is a no-code platform that allows you to automate your marketing workflows seamlessly. With Markifact, you can create workflows that connect your favorite marketing tools and automate repetitive tasks, saving you time and effort.

Start Automating your Marketing