Enables the automated creation and configuration of Facebook Pixel tracking setups within a Google Tag Manager container.
Provides tools for the automated setup of Google Analytics 4 (GA4) configurations, including configuration tags and common event tracking workflows.
Allows for programmatic management of tags, triggers, and variables, as well as container publishing and the generation of complete tracking workflows for different site types.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Google Tag Manager MCP ServerSet up GA4 tracking for my website with measurement ID G-ABC123456"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Google Tag Manager MCP Server
A Model Context Protocol (MCP) server that integrates Google Tag Manager with Claude, enabling automated GTM configuration and component creation through natural language prompts.
Features
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
Setup
1. Install Dependencies
Option A: Using uv (Recommended)
Option B: Using pip
2. Google Cloud Console Setup
Go to the Google 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"
3. Create Service Account Credentials
Go to "APIs & Services" > "Credentials"
Click "Create Credentials" > "OAuth 2.0 Client IDs"
Choose "Desktop application"
Download the JSON file and save it as
credentials.jsonin this directory
4. Configure Claude
Add the MCP server configuration to your Claude config:
Available Tools
Basic GTM Operations
create_gtm_tag: Create individual GTM tagscreate_gtm_trigger: Create GTM triggerscreate_gtm_variable: Create GTM variableslist_gtm_containers: List all containers for an accountget_gtm_container: Get container detailspublish_gtm_version: Publish a container version
Workflow Tools
create_ga4_setup: Complete Google Analytics 4 setup with config tag and common eventscreate_facebook_pixel_setup: Facebook Pixel tracking setupcreate_form_tracking: Form submission tracking setupgenerate_gtm_workflow: Generate complete workflows for different site types
Usage Examples
1. Set up Google Analytics 4 tracking
2. Generate ecommerce tracking workflow
3. Create form tracking
4. Create custom components
Workflow Types
The generate_gtm_workflow tool supports three main workflow types:
ecommerce: Enhanced ecommerce tracking with purchase, cart, and product interaction eventslead_generation: Form submissions, CTA clicks, and conversion trackingcontent_site: Content engagement, newsletter signups, and social sharing
Authentication
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.
File Structure
Troubleshooting
Authentication Issues
Ensure
credentials.jsonis properly configured from Google Cloud ConsoleCheck that Tag Manager API is enabled in your Google Cloud project
Verify you have the necessary permissions in your GTM account
Permission Errors
Make sure your Google account has edit permissions for the GTM container
Ensure the GTM account and container IDs are correct
API Errors
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
Development
Running Tests
Running the Server
Development Dependencies
The project includes development dependencies for code quality:
Contributing
Feel free to submit issues and enhancement requests!