gtm-tag-architect
gtm-tag-architect
一个面向 Google Antigravity 和 Claude Code 的公开、生产就绪插件,可通过 MCP 连接到 Google Tag Manager。
它提供交互式 /setup 命令,与开发者/营销人员就其网站进行访谈,诊断容器缺陷(重复项、缺失触发器、Consent Mode v2 违规),并生成优化的跟踪分类体系和 dataLayer 契约。
功能特性
/setup交互式命令: 引导你完成 3 阶段的访谈与审计工作流。深度容器诊断: 审计重复的 GA4/Meta 代码、孤立触发器、未经用户同意的营销像素以及阻塞渲染的脚本。
自动修复: 对代码进行去重,并在所有代码上强制执行 Google Consent Mode v2。
行业跟踪矩阵: 为电商、SaaS/PLG 和 B2B 线索生成提供预构建的分类操作手册。
开发者
dataLayer.d.ts生成器: 为 React、Next.js 和原生应用生成类型化事件契约和辅助 push 函数。双模式 MCP 服务器: 既可在线连接 Google Tag Manager REST API v2 运行,也可离线审计本地导出的容器 JSON 文件。
Related MCP server: mcp-gtm-ga4
安装与配置
适用于 Google Antigravity
将此仓库克隆或放置到你的工作区或全局自定义目录中:
# In your project's .agents/plugins/ or ~/.gemini/config/plugins/
git clone https://github.com/jarnielcataluna/gtm-tag-architect.gitAntigravity 将自动发现该插件,提供 /setup 斜杠命令,并注册 mcp_config.json 中定义的 MCP 服务器。
适用于 Claude Code / 独立 MCP
在你的 claude_desktop_config.json 或项目 MCP 设置中注册服务器:
{
"mcpServers": {
"gtm-tag-architect": {
"command": "node",
"args": ["/path/to/gtm-tag-architect/bin/gtm-mcp.js"]
}
}
}用法
运行 /setup 命令
在 Antigravity 或 Claude Code 中:
/setup智能体会就以下内容对你进行访谈:
网站类型与行业(电商、SaaS、线索生成、内容)
所需像素(GA4、Meta、LinkedIn、Google Ads、PostHog)
隐私要求(GDPR / Consent Mode v2)
然后它会执行诊断审计,并为你显示一个操作菜单,用于修复缺陷、应用同意规则或导出干净的 dataLayer.d.ts。
测试与本地审计
你可以针对随附的测试夹具运行离线诊断测试工具:
npm install
npm run audit-fixture许可证
MIT
Available Tools
5 toolsgtm_add_tag_recipeB
Adds a pre-configured tag recipe (GA4 Core, Meta Pixel, PostHog, or LinkedIn) to the container workspace.
Inputs: recipe (required), pixelId, containerPath, measurementId.
gtm_apply_consent_modeA
Configures Google Consent Mode v2 on all analytics and marketing tags (requiring ad_storage, ad_user_data, and analytics_storage).
Inputs: defaultState, containerPath.
gtm_audit_containerA
Runs a deep diagnostic audit on a Google Tag Manager container. Identifies duplicate tags, missing triggers, unconsented tracking (Consent Mode v2), and heavy blocking scripts.
Inputs: containerPath.
gtm_deduplicate_tagsA
Deduplicates GA4 configuration and Meta Pixel tags in the GTM container, consolidating firing triggers and pruning duplicate base tags.
Inputs: containerPath.
gtm_generate_datalayer_typesA
Generates production TypeScript type definitions and helper push functions for developers (E-commerce, SaaS, or Lead Gen).
Inputs: industry (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 5 tools
Each tool targets a distinct action in the GTM workflow—audit, deduplicate, apply consent, add recipe, generate types—so an agent can usually pick the right one. Minor overlap exists where audit surfaces duplicates and consent gaps that deduplicate and apply_consent_mode then fix, but the strong action verbs keep the boundaries clear.
All tool names follow the identical `gtm_<verb>_<object>` snake_case pattern with perfect consistency. The `gtm_` prefix scopes everything to the domain, and every verb is a single lowercase action word.
Five tools is a well-scoped surface for a GTM tag-management assistant. Each tool addresses a distinct stage of the tag lifecycle—audit, cleanup, compliance, templating, and developer handoff—without feature bloat.
The core architecture workflow is well covered: audit, deduplicate, configure consent, add standard tags, and generate TypeScript datalayer helpers. Publication/preview submission and tag removal are missing, so agents may need workarounds, but the primary setup path is fully covered.
Maintenance
Related MCP Connectors
Hosted Google Tag Manager MCP server, with each action switched on or off per account.
Hosted MCP server for marketing analytics: plan tracking, draft GTM tags, audit tags. Free in beta
Hosted MCP server for GA4, Google Ads and Search Console. Google OAuth, nothing to install.
Hosted Google Analytics 4 MCP server, with each action switched on or off per account.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAn MCP Server that provides a conversational interface to Google Tag Manager API, allowing users to manage tags, triggers, variables, and containers through natural language.-
- AlicenseAqualityBmaintenanceMCP server for Google Tag Manager and GA4, enabling tag management, consent auditing, workspace versioning, and analytics reporting through natural language.11321 npm3MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Google Tag Manager API v2, enabling programmatic management of accounts, containers, workspaces, tags, triggers, variables, and version workflows.34 npm16MIT
- AlicenseAqualityFmaintenanceAn MCP server for the Google Tag Manager API v2 that enables AI assistants to query GTM accounts, containers, tags, triggers, variables, and unpublished changes.241Apache 2.0