Metrifyr
Tools Reference

Tag Manager Tools

13 tools for Google Tag Manager container management (Beta)

Google Tag Manager Tools (Beta)

13 MCP tools for managing GTM containers, tags, triggers, variables, and versions.

⚠️ Beta Status: Tag Manager tools are in beta pending Google OAuth verification. All functionality works, but requires manual OAuth approval.

OAuth Scopes Required

  • tagmanager.readonly - Read containers, tags, triggers, variables
  • tagmanager.edit.containers - Edit container configuration
  • tagmanager.edit.containerversions - Create and manage versions

Note: Publishing versions requires manual approval in GTM UI for safety.

Tools Overview

Account & Container Management (3 tools)

gtm_list_accounts List all GTM accounts you have access to.

gtm_list_containers List containers for a specific account.

gtm_get_container Get details for a specific container.

Tag Management (5 tools)

gtm_list_tags List all tags in a workspace with pagination support.

gtm_get_tag Get detailed configuration for a specific tag.

gtm_create_tag Create a new tag (GA4, Google Ads, Custom HTML, etc.).

gtm_update_tag Update an existing tag's configuration.

gtm_delete_tag Delete a tag from the workspace.

Trigger & Variable Management (2 tools)

gtm_list_triggers List all triggers in a workspace.

gtm_list_variables List all variables in a workspace.

Version Management (2 tools)

gtm_list_versions List all versions of a container.

gtm_create_version Create a new version from the current workspace state.

Audit & Analysis (1 tool)

gtm_audit_container Comprehensive container audit checking for:

  • Deprecated UA tags
  • Missing Consent Mode v2
  • Naming convention violations
  • Unused triggers/variables

Common Use Cases

List All Tags

Ask Claude:

Show me all tags in my GTM container

Response includes:

  • Tag name and ID
  • Tag type (GA4, Google Ads, Custom HTML, etc.)
  • Firing triggers
  • Status (enabled/disabled)

Create GA4 Event Tag

Ask Claude:

Create a GA4 event tag that fires on button clicks
Event name: button_click
Measurement ID: G-XXXXXXXXXX

Claude will:

  1. Create the tag with correct parameters
  2. Set up trigger configuration
  3. Return the tag ID for reference

Audit Container for Issues

Ask Claude:

Audit my GTM container for deprecated tags
and Consent Mode issues

Audit checks:

  • ❌ Universal Analytics tags (deprecated)
  • ⚠️ Missing Consent Mode v2 on GA4/Ads tags
  • ℹ️ Naming convention violations
  • ℹ️ Unused triggers and variables

Create Version & Preview

Ask Claude:

Create a new GTM version with name "Add newsletter tracking"
and description "Added event tag for newsletter signups"

Important: Versions are created but NOT published automatically. You must review and publish in GTM UI.

Tag Types Supported

Tracking Tags

  • Google Analytics 4 - Event tracking, page views, conversions
  • Google Ads - Conversion tracking, remarketing
  • Floodlight - Campaign Manager conversion tracking

Marketing Tags

  • Facebook Pixel - Meta conversion tracking
  • LinkedIn Insight - LinkedIn campaign tracking
  • Twitter Universal - Twitter conversion tracking

Custom Tags

  • Custom HTML - Any JavaScript code
  • Custom Image - Image pixel tags

Safety Features

No Automatic Publishing

The gtm_publish_version tool was intentionally removed for safety. All versions must be:

  1. Created via gtm_create_version
  2. Reviewed in GTM UI
  3. Manually published after verification

This prevents accidental deployment of broken tracking.

Workspace Isolation

All changes are made to the default workspace. This ensures:

  • ✅ Changes don't affect live site until published
  • ✅ You can preview changes before deploying
  • ✅ Rollback is possible if issues found

Audit Before Changes

Run gtm_audit_container before making changes to understand current state.

Examples

Example 1: Add Conversion Tracking

Task: Add GA4 conversion event for newsletter signups

1. List current tags
2. Create new GA4 event tag:
   - Event name: newsletter_signup
   - Measurement ID: G-XXXXXXXXXX
   - Trigger: Form submission (email signup form)
3. Create version "Add newsletter conversion"
4. Preview in GTM
5. Publish manually

Example 2: Migrate from UA to GA4

Task: Audit container and migrate UA tags to GA4

1. Audit container (find all UA tags)
2. For each UA tag:
   - Note the trigger configuration
   - Create equivalent GA4 tag
   - Disable (don't delete) UA tag
3. Create version "UA to GA4 migration"
4. Test thoroughly in preview mode
5. Publish after validation

Example 3: Clean Up Unused Tags

Task: Find and remove unused tags

1. List all tags
2. List all triggers
3. Audit for unused resources
4. Delete unused tags (or disable for safety)
5. Create version "Cleanup unused tags"

Limitations

Beta limitations:

  • Manual OAuth approval required
  • Some users may not see GTM tools until approved
  • Publishing requires GTM UI (by design for safety)

API limitations:

  • 10 queries per second (QPS)
  • 100 tags per workspace (GTM limit)
  • Version history limited to 3 months

Best Practices

Do:

  • Audit before making changes
  • Use descriptive tag names (e.g., "GA4 - Newsletter Signup")
  • Test in preview mode before publishing
  • Create versions for every logical change
  • Document changes in version descriptions

Don't:

  • Delete tags without disabling first (test impact)
  • Make many rapid changes (risk of errors)
  • Skip audit step
  • Publish without previewing

Troubleshooting

"Permission denied" error:

  • Verify you've connected Google with Tag Manager scope
  • Check if you have edit access to the container

Tags not appearing:

  • Ensure you're querying the correct workspace path
  • Verify the workspace exists

Audit fails:

  • Check container access permissions
  • Verify workspace path format

See full troubleshooting guide

Next Steps

On this page

Tag Manager Tools | Metrifyr Docs | Metrifyr