Meta Pixel
Back to Blog
Connection guide6 min readNov 12, 2026By Andrii Pasika· Founder, LoomaScale

How to Connect Claude Code to GTM (Google Tag Manager)

Short answer

To connect Claude Code to GTM, authorize Google Tag Manager in LoomaScale and add its GTM endpoint with claude mcp add. Authenticate from /mcp inside Claude Code, then discover and select a container. Read its published version and workspace status before preparing a tracking change or asking for a draft edit.

Claude Code can use a GTM MCP connection to build an evidence-based tracking change proposal. The useful workflow starts with the current container and a named workspace, rather than an unqualified request to fix tracking. This guide covers connection, verification and a reviewable proposal before any publication.

What do you need before connecting?

Use Claude Code installed on the computer where you will run these commands. Its CLI supports remote HTTP MCP servers and browser OAuth. This route registers an explicit user-scoped server for use across your projects; project-scoped team configuration is a separate choice. You do not need to run a local Google API server.

  • A Google login that can read the intended Tag Manager container.
  • A LoomaScale account with Google Tag Manager connected separately from Analytics or Google Ads.
  • The container you want to inspect, plus a named workspace if you later request a draft change. Editing, creating versions and publishing require their corresponding Google permissions.

How do you connect Claude Code to GTM?

1. Connect GTM in LoomaScale

Create or sign in to your LoomaScale account, then open Connections. Choose Google Tag Manager, sign in with the Google email that has access to the required data, and review the requested permissions. Signing in to LoomaScale with Google is not a substitute for connecting this data source. You can connect this service without connecting an advertising account.

2. Register the remote MCP server in Claude Code

Run this command in your system terminal, outside a Claude Code conversation. User scope makes the connection available across your projects. The URL selects this Google service's tools.

claude mcp add --transport http --scope user loomascale-gtm https://api.loomascale.com/mcp/gtm

If you already use the full LoomaScale agent plugin, check its tools before adding a second connection. The plugin route is documented in the Claude Code setup guide; this article uses direct MCP setup.

3. Authenticate from Claude Code's MCP menu

Open Claude Code and enter /mcp. Select loomascale-gtm and complete its authentication flow in the browser. Use the LoomaScale account with your Google source connected. Return to Claude Code and confirm the server is connected. You can inspect the saved server from the system terminal with claude mcp get loomascale-gtm or claude mcp list. A successful add command saves configuration; it does not prove that the Google account lookup succeeded.

4. Verify access with an actual account lookup

Use LoomaScale to call gtm_list_containers. Show each container's name, public GTM ID and account. Ask me which one to inspect. Read its published version and list its workspaces. Do not edit, create a version or publish anything.

Check that the response identifies your actual container, including its GTM- public ID. Distinguish the published version from each draft workspace before discussing a tracking issue. The container's API account and container IDs are different identifiers from its public GTM- ID; let the tools discover the required values. A successful inventory confirms access to configuration, not that a browser event fires correctly.

How do you prepare a GTM change proposal in Claude Code?

Identify one tracking issue and inspect its dependencies. If repository code emits the relevant event, read that contract too. Ask for the smallest proposed tag, trigger or variable change and a test plan. Before requesting a write, choose the workspace and review its existing changes so the eventual version has a clear scope.

Use LoomaScale for the selected GTM container. Read its published tracking configuration and list available workspaces. For the lead event I describe, compare relevant repository instrumentation with GTM tags and triggers. Produce a proposal containing current configuration, exact proposed fields, affected dependencies and a Tag Assistant test plan. Ask me to choose a workspace before any future edit. For now, change nothing and do not publish.

A proposal should be concrete enough to review without granting a broad instruction to repair everything. Where write tools are available, a draft edit remains separate from version creation and publication. Verify behavior in Preview and inspect the specific version before approval. Container inspection alone cannot certify that the site handles every consent or navigation state.

Which MCP endpoint does this guide use?

https://api.loomascale.com/mcp/gtm

The service-specific endpoint exposes GTM tools and LoomaScale account helpers. The full directory plugin or connector uses https://api.loomascale.com/mcp and can reach all sources you separately connect. Choose the full connection for work across services; use the specific endpoint when you want this source's tool set. An endpoint choice limits exposed tools, not the Google roles your login holds.

What can Claude Code read or change in GTM?

LoomaScale reads containers, tags, triggers, variables, workspaces, versions and tracking-audit findings. Where enabled and authorized, changes go into the workspace you select; creating a version and publishing it are separate operations. Review the exact version before approving publication. Configuration inspection cannot observe a visitor's browser or prove that consent and tags behave correctly on the site. Validate proposed changes in Tag Manager Preview and Tag Assistant before a live release.

Why is the connection or data missing?

If the server needs authentication, open /mcp and sign in again. If tools are missing, check claude mcp list, the source endpoint, and whether an organization policy restricts the server. Restart the session after a configuration change if needed. A Claude web connector and an explicit CLI server can overlap; check the active tools before adding duplicate connections.

A missing container usually calls for checking the Google login, container access and Tag Manager connection. If discovery says accounts are still loading, retry after discovery finishes. If an audit describes different tags from the live site, check whether you requested the published version or a draft workspace. A write-permission error is separate from read access: check the relevant edit, version or publish permission and the feature's availability before reconnecting.

Related connection guides and official references

Use GTM in another assistant

Connect another Google source to Claude Code

Official setup references

Setup references checked on November 12, 2026. Menu labels and workspace policies can change; use the linked vendor guidance for your account. For LoomaScale's supported workflows, see the documentation hub.

FAQ

Does adding the GTM MCP server authorize Claude Code to publish?

Adding and authenticating the server establishes tool access under your account's permissions. It is not an instruction to publish. Start with read-only inspection; workspace edits, creating versions and publishing each require the appropriate access and a deliberate request for the specific action.

Does connecting GTM automatically publish tracking changes?

No. Reading a container and running an audit publish nothing. Authorized edits are workspace changes; a version must be created and the specific version approved before publishing. Test tag behavior in Tag Manager Preview and Tag Assistant before a live release.

Where do I run claude mcp add and /mcp?

Run claude mcp add in your system terminal. Then open Claude Code and enter /mcp inside its conversation interface to inspect the server and authenticate. The user-scoped command in this guide makes the server available across your projects on that computer.

Who wrote this

Andrii Pasika, founder of LoomaScale

Andrii Pasika

Founder, LoomaScale

Andrii founded LoomaScale and wrote the Google Ads MCP server behind it. He runs his own campaigns through it, and mail to team@loomascale.com reaches him.

Connect GTM to Claude Code

Create your LoomaScale account, connect the Google source, and use the verification prompt above to retrieve your own account data.

Start with LoomaScale

Connect your assistant to your ad platform

LoomaScale runs inside the assistant you already use. Pick the pair you work with; each guide takes about five minutes.

ChatGPT
Google Ads

Manage Google Ads campaigns from ChatGPT: search terms, budgets and new campaigns, paused for your review. One-click install from ChatGPT's directory.

Read the integration
Claude
Google Ads

Manage Google Ads from Claude: audits, budget changes and new campaigns, every write inside the spend cap you set. Connect from Claude's directory.

Read the integration
Claude Code
Google Ads

Install the LoomaScale plugin in Claude Code with two commands and audit Google Ads from your terminal: search terms, budgets and pacing, with skills built in.

Read the integration
Codex
Google Ads

Install the LoomaScale plugin in OpenAI Codex with two commands and audit Google Ads from your terminal: search terms, budgets and conversion goals.

Read the integration
ChatGPT
Meta Ads

Manage Facebook and Instagram campaigns from ChatGPT: ad sets, budgets and creatives in one chat. The same one-click install.

Read the integration
Claude
Meta Ads

Manage Facebook and Instagram campaigns from Claude: audits, budget caps and new ad sets, inside the limits you set.

Read the integration
Claude Code
Meta Ads

Run Facebook and Instagram campaign reviews from Claude Code: the same plugin, one sign-in, and skills for waste audits, pacing and creative fatigue.

Read the integration
Codex
Meta Ads

Review Facebook and Instagram campaigns from OpenAI Codex: the same plugin and sign-in, with placement, age and lead-quality checks.

Read the integration
ChatGPT
TikTok Ads

Manage TikTok campaigns from ChatGPT: reports, video watch-through, audience breakdowns, and pauses, budgets and bids on request. The same one-click install.

Read the integration
Claude
TikTok Ads

Manage TikTok campaigns from Claude: audits, video and audience reports, and pauses, budgets and bids inside the spend cap you set.

Read the integration
Manus
Google Ads

Connect Manus to Google Ads through LoomaScale’s MCP server. Analyze campaigns, keywords and search terms, then request changes within your permissions and spend cap.

Read the integration
Slack
Google Ads

Ask Slackbot about Google Ads in any Slack DM: audits, search terms and pacing checks, with changes kept inside your spend cap. Install the app once per workspace.

Read the integration
Manus
Meta Ads

Connect Manus to Meta Ads through LoomaScale’s MCP server. Review Facebook and Instagram campaigns, ad sets, creatives and placements.

Read the integration
Slack
Meta Ads

Ask Slackbot about Facebook and Instagram campaigns in any Slack DM: delivery, pacing and ad-set spend, read live from Meta Ads.

Read the integration