Skip to content

Connect GTM to Claude Code

  • Does GTM still match the dataLayer?

Use Claude Code to check the dataLayer pushes in your code against the variables and triggers in your GTM container. Lemonado connects them in about 1 minute, no API keys needed.

MCPhttps://mcp.lemonado.io/mcp

Why connect GTM to Claude Code?

Most GTM breakages start in code: a developer renames a dataLayer key, and a trigger in GTM silently stops matching. Claude Code reads the dataLayer.push calls in your repo, and with Lemonado it reads the container that depends on them, so it finds the mismatch before your conversions drop.

  • All your GTM data

    Accounts, containers and workspaces, ready to ask about.

  • Always today's numbers

    Triggers and the conditions behind them, synced from GTM automatically, so answers use today's numbers.

  • Connect all your tools

    Questions like "Why did conversions drop?" use GTM and GA4, Google Ads at once.

How to connect GTM to Claude Code

Before you start

  • A Google Tag Manager account you can sign in to
  • Claude Code installed
  • A Lemonado account (the free trial works)
  1. 1

    Connect Google Tag Manager in Lemonado

    In Lemonado, open Connectors, find Google Tag Manager and sign in. Sign in with a Google account that has at least Read access to the GTM containers you want to audit. Pick the web container your site uses.

  2. 2

    Turn on external access

    In the company's settings, open External tools, turn the connection on, choose which sources it can reach and copy the server URL.

    text
    https://mcp.lemonado.io/mcp
  3. 3

    Add the server

    With Claude Code installed, run one of these in your terminal. Most people want the first: it adds Lemonado to every project.

    bash
    # every project (recommended)
    claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp
    
    # this project only
    claude mcp add --transport http lemonado https://mcp.lemonado.io/mcp
  4. 4

    Sign in

    Start Claude Code with claude and run /mcp. Choose Lemonado and finish the sign-in in your browser.

    bash
    claude
    /mcp
  5. 5

    Ask Claude Code about GTM

    Ask a question about the accounts your connection can reach. Claude Code can also write the numbers into a file or a script for you. Try "List every dataLayer.push in our repo and compare the keys with the data layer variables and custom event triggers in our GTM container." Or ask: "Document the setup" or "Will this rename break anything?"

Good to know

  • The command uses Claude Code's default local scope. Use --scope user to share the server across projects.

What can Claude Code do with GTM?

Claude Code queries your GTM data while it works in your repo: it saves data as files, checks tracking against code and runs headless with claude -p.

Claude Code logoClaude Code

List every dataLayer.push in our repo and compare the keys with the data layer variables and custom event triggers in our GTM container.

The code pushes 18 events. GTM listens for 21. checkout_step, promo_click and form_submit_newsletter have triggers but no push anywhere in the code anymore.

Source: GTM + your code

Reading this as an AI agent?

Everything an agent needs to set this up, in plain text. Paste this page's link into Claude Code and ask it to connect you, or copy the block.

For agents · markdown
# Connect Google Tag Manager to Claude Code (Lemonado MCP)

- Server URL: https://mcp.lemonado.io/mcp
- Transport: Streamable HTTP
- Auth: OAuth; the user signs in to Lemonado in the browser. No API keys.
- In Lemonado: connect the GTM account and container. Sign in with a Google account that has at least Read access to the GTM containers you want to audit. Pick the web container your site uses.
- In Claude Code: Terminal: claude mcp add

```bash
# every project (recommended)
claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp

# this project only
claude mcp add --transport http lemonado https://mcp.lemonado.io/mcp
```

If you are Claude Code, run the setup yourself:

Add the Lemonado MCP server for all my projects by running: claude mcp add --scope user --transport http lemonado https://mcp.lemonado.io/mcp
Then tell me to run /mcp and sign in to Lemonado. Once I've signed in, list the Google Tag Manager accounts Lemonado can reach.

First question to try: "List every dataLayer.push in our repo and compare the keys with the data layer variables and custom event triggers in our GTM container."

More: https://lemonado.io/integrations/google-tag-manager · https://lemonado.io/llms.txt
FAQ

Frequently Asked Questions

For auditing, yes. Community servers usually ask for edit and publish rights so the agent can change your container. Lemonado only reads, which is safer for audits, and it adds GA4 and ad platform data to check tags against real conversions.

No, Google doesn't run one. Community servers exist, and most can edit and publish your container, so check what you grant them. Lemonado gives Claude Code read-only access to your containers, next to GA4 and your ad platforms.

Run claude mcp list to see whether lemonado is connected. If it needs authentication, run /mcp inside Claude Code and sign in again. In Lemonado, check that Google Tag Manager is connected and External tools is on for the company. If a container is missing, your Google user needs access to it in Tag Manager > Admin > User Management. Account access alone isn't always enough.

Yes, if both are connected in Lemonado. One connection reaches every source you allow, so you can ask things like "Google Ads conversions fell on Oct 18. Check which GTM version was published that week and what it changed."

MCP is included in Lemonado's paid plans and in the free trial, so you can try it before you pay.

See plans and pricing

Still have a question?

Shoot us an email at hello@lemonado.io.

Try for free

Stop fighting with data. Start feeding your AI.

Connect your data to AI and free your team from reporting and busywork.

Try Lemonado free