Skip to main content
AI Automation

How to use AI and MCP to prompt the implementation of GTM Tags in Claude

By August 21, 2025No Comments3 min read

Reading time: 2 min

Manually setting up tags in Google Tag Manager (GTM) can be time-consuming—especially when you’re juggling multiple containers, conversions, and triggers. But what if you could streamline the entire process with a simple AI prompt?

Let’s dive in.


Step 1: Setting Up the MCP for GTM

Before you start prompting AI to build tags for you, there’s a bit of initial setup. You’ll need to implement the MCP for GTM. Think of the MCP as a bridge that allows your AI assistant (e.g., Claude or ChatGPT) to access and modify your GTM environment.

Here’s how to set it up:

  1. Copy the following code snippet:

},
“gtm-mcp-server”: {
“command”: “npx”,
“args”: [
“-y”,
“mcp-remote”,
“https://gtm-mcp.stape.ai/sse”
]
}

  1. Open your Claude configuration
    • Navigate to your developer tab in Claude by pressing Cmd + “,” and click on edit Config
  1. Paste the MCP snippet
    • Open the config file and paste the snippet
    • If you’re using multiple MCPs, just chain them together (Ask Claude to do this for you by pasting the whole code)
  2. Save and relaunch your AI assistant
    After adding the MCP, close the editor and relaunch the environment (e.g., Claude).

Once that’s done, you’re ready to prompt your AI.


Step 2: Test simple prompts to create a Google Ads Tag

Let’s say you want to create a standard Google Ads conversion tag. Here’s an example of a basic prompt:

“Create a Google Ads tag in this container with conversion ID [your_ID] and label [your_label]. Name the tag Test Tag MCP and set the trigger to a page view on the ClickTrust blog.”

After submitting this prompt, the AI takes care of everything:

  • It creates the tag using the specified details.
  • It assigns a page view trigger.
  • It installs the tag into your designated container.

To verify, simply refresh the GTM container. You’ll see the tag live and configured exactly as prompted.

Result: Google Ads tag with the right ID, label, and a blog page view trigger.


Step 3: Modify the trigger with a more advanced prompt

Now let’s do something more dynamic—like triggering the tag on a specific button click rather than a generic page view.

Here’s the prompt:

“Create a trigger based on the click of the ‘Send’ button on the ClickTrust About Us page, and replace the existing trigger in the previous tag.”

What happens next:

  • The AI fetches and analyzes the HTML of the page.
  • It identifies the correct element (in this case, a button with the text ‘Send’).
  • It creates a new form submit trigger based on that element.
  • It replaces the previous page view trigger with this new interaction-based trigger.

Again, after refreshing the GTM container, you’ll see:

  • The trigger has been updated.
  • The tag now fires only when a user clicks the “Send” button on the About Us page.

This interaction-based approach is far more valuable in tracking meaningful actions rather than passive page views.


Why This Matters for PPC and Analytics Teams

For marketers and analysts managing multiple GTM containers across brands or campaigns, this approach offers major benefits:

  • 🕒 Time-saving: Eliminate the need to manually click through the GTM UI for routine tags.
  • 🧠 Accuracy: Minimize human error in tag setup and configuration.
  • 🔄 Scalability: Easily replicate tag implementations across multiple containers with minor prompt tweaks.
  • 💡 Transparency: Prompts and outputs are clearly readable and verifiable—no black-box scripts.

Where to Go From Here

At CLICKTRUST, we’re committed to exploring and sharing the practical ways AI can enhance PPC workflows—without compromising data accuracy or strategy control.

If this workflow caught your interest, we’ve built an entire training around it.

👉 Check out our Generative AI for PPC Training to learn how to use tools like Claude and ChatGPT to streamline campaign setup, tag management, ad copy, and more.

Enrico Cadei

Digital Performance Analyst