Google Tag Manager
About
Integrates Google Tag Manager to automate GTM configuration and component creation through natural language prompts.
Details
- Author
- neep305
- Categories
- Developer Tools, Marketing, Other
Jump to
Setup
Install Google Tag Manager in your MCP client (Claude Desktop, Cursor, Windsurf, and others).
Repository: https://github.com/neep305/mcp-for-gtm
Follow the installation instructions in the repository README, then restart your MCP client.
Integrates Google Tag Manager to automate GTM configuration and component creation through natural language prompts.
A Model Context Protocol (MCP) server that integrates Google Tag Manager with Claude, enabling automated GTM configuration and component creation through natural language prompts.
- GTM API Integration: Full Google Tag Manager API integration for creating and managing tags, triggers, and variables
- Component Templates: Pre-built templates for common tracking scenarios (GA4, Facebook Pixel, conversion tracking)
- Workflow Automation: Complete workflow creation for different site types (ecommerce, lead generation, content sites)
- Claude Integration: Natural language interface for GTM configuration through Claude
# Install uv if not already installed curl -LsSf https://astral.sh/uv/install.sh | sh source $HOME/.local/bin/env # Install dependencies uv sync
- Go to theGoogle Cloud Console
- Create a new project or select existing one
- Enable the Tag Manager API:
- Go to "APIs & Services" > "Library"
- Search for "Tag Manager API"
- Click "Enable"
- Go to "APIs & Services" > "Credentials"
- Click "Create Credentials" > "OAuth 2.0 Client IDs"
- Choose "Desktop application"
- Download the JSON file and save it ascredentials.jsonin this directory
Add the MCP server configuration to your Claude config:
{ "mcpServers": { "gtm": { "command": "python", "args": ["/path/to/mcp-for-gtm/server.py"], "env": { "GTM_CREDENTIALS_FILE": "/path/to/mcp-for-gtm/credentials.json", "GTM_TOKEN_FILE": "/path/to/mcp-for-gtm/token.json" } } } }
- create_gtm_tag: Create individual GTM tags
- create_gtm_trigger: Create GTM triggers
- create_gtm_variable: Create GTM variables
- list_gtm_containers: List all containers for an account
- get_gtm_container: Get container details
- publish_gtm_version: Publish a container version
- create_ga4_setup: Complete Google Analytics 4 setup with config tag and common events
- create_facebook_pixel_setup: Facebook Pixel tracking setup
- create_form_tracking: Form submission tracking setup
- generate_gtm_workflow: Generate complete workflows for different site types
Create a complete GA4 setup for my website with measurement ID G-XXXXXXXXXX in GTM account 123456 and container 7890123
Generate a complete ecommerce tracking workflow with GA4 measurement ID G-XXXXXXXXXX and Facebook Pixel ID 123456789
Set up form tracking for the contact form with selector #contact-form in my GTM container
Create a custom GTM tag for tracking video plays with the following parameters: event_name = "video_play", video_title = "{{Video Title}}", video_duration = "{{Video Duration}}"
Thegenerate_gtm_workflowtool supports three main workflow types:
- ecommerce: Enhanced ecommerce tracking with purchase, cart, and product interaction events
- lead_generation: Form submissions, CTA clicks, and conversion tracking
- content_site: Content engagement, newsletter signups, and social sharing
On first run, the server will open a browser window for OAuth authentication. Grant the necessary permissions to access your GTM account. The authentication token will be saved for future use.
mcp-for-gtm/ ├── server.py # Main MCP server ├── gtm_client.py # GTM API client ├── gtm_components.py # Component templates and workflow builder ├── requirements.txt # Python dependencies ├── config.json # MCP server configuration ├── credentials.json # Google OAuth credentials (you provide) ├── token.json # Generated auth token (auto-created) └── README.md # This file
- Ensurecredentials.jsonis properly configured from Google Cloud Console
- Check that Tag Manager API is enabled in your Google Cloud project
- Verify you have the necessary permissions in your GTM account
- Make sure your Google account has edit permissions for the GTM container
- Ensure the GTM account and container IDs are correct
- Check your GTM account and container IDs
- Verify that the workspace exists (default workspace ID is used)
- Check rate limits if you're making many requests
# Using uv uv run python test_server.py # Or directly with python python test_server.py
# Using the convenience script ./run_server.sh # Or manually with uv uv run python server.py # Or with system python python server.py
The project includes development dependencies for code quality:
# Format code with black uv run black . # Check with flake8 uv run flake8 . # Type checking with mypy uv run mypy . # Run tests with pytest uv run pytest
Feel free to submit issues and enhancement requests!
This is a web browser that enables your coding agent, such as Claude Code, to visit websites on your behalf and assist you in identifying bugs or creating UI test cases.
A collection of MCP servers for growth and analytics, including a server for Google Analytics.
A managed AI marketing agent that plugs into all your AI tools. Ask about your marketing in natural language — get synthesized insights from GA4, Google Ads, Search Console, WooCommerce, and more.
Read-only, multi-tenant access to Google Analytics 4, Google Ads, Search Console and Meta Ads: one connector per client plus a master connector spanning every client of an agency.
Access the Google Analytics Data API to retrieve and analyze website traffic data.
MCP server for Google Analytics 4 — reports, realtime, and admin (Rust)
A read-only MCP server for querying live Google Analytics data using LLMs. Powered by CData.
Connect Google Search Console to Claude or ChatGPT via Two Minute Reports MCP. Analyze top-performing queries, pages, and SEO trends to grow search visibility.
Manage Google Tag Manager accounts, containers, and tags via its API, with built-in Google OAuth.
Open-source Rust MCP server for Google Ads, GA4, Search Console, and CRM attribution data.
Connect AI assistants to live Meta Ads, GA4, and Search Console data. 100% local, machine-locked encryption, no cloud relay.
Sign in to leave a review
Use Google, GitHub, or an email account so ratings stay tied to real people.
No reviews posted yet.





