← 返回
开发者工具 Key 中文

Google Tag Manager

Manage Google Tag Manager containers, tags, triggers, variables, and versions via the GTM API v2. Use when the user wants to list, create, update, delete, or...
通过 GTM API v2 管理 Google Tag Manager 容器、标签、触发器、变量和版本。适用于用户需要列出、创建、更新、删除或…等操作。
simonfunk
开发者工具 clawhub v1.0.0 1 版本 100000 Key: 需要
★ 0
Stars
📥 1,102
下载
💾 7
安装
1
版本
#latest

概述

Google Tag Manager Skill

Interact with the GTM API v2 to manage containers, workspaces, tags, triggers, variables, and versions.

Authentication

The GTM API uses OAuth2 via a Google Cloud service account.

Setup

  1. Enable Tag Manager API in Google Cloud Console
  2. Create a service account with key (JSON)
  3. Grant the service account access in GTM (Admin → User Management → add service account email)
  4. Set env vars:
    • GOOGLE_APPLICATION_CREDENTIALS=/path/to/service-account.json
    • GTM_ACCOUNT_ID=123456
    • GTM_CONTAINER_ID=789012

Script

All operations use scripts/gtm.sh. Run without args to see usage:

scripts/gtm.sh <command> [args...]

Commands

CommandDescription
----------------------
accountsList all GTM accounts
containers [accountId]List containers in account
workspacesList workspaces in container
tags [workspaceId]List tags in workspace (default: latest)
tag [workspaceId]Get a specific tag
create-tag [workspaceId]Create a tag from JSON
update-tag [workspaceId]Update a tag
delete-tag [workspaceId]Delete a tag
triggers [workspaceId]List triggers
trigger [workspaceId]Get a specific trigger
create-trigger [workspaceId]Create a trigger from JSON
update-trigger [workspaceId]Update a trigger
delete-trigger [workspaceId]Delete a trigger
variables [workspaceId]List variables
variable [workspaceId]Get a specific variable
create-variable [workspaceId]Create a variable from JSON
update-variable [workspaceId]Update a variable
delete-variable [workspaceId]Delete a variable
built-in-vars [workspaceId]List enabled built-in variables
enable-built-in [workspaceId]Enable built-in variable(s)
versionsList container version headers
version Get a specific version
version-liveGet the live (published) version
create-version [workspaceId] [name] [notes]Create version from workspace
publish Publish a container version

Workspace Resolution

Most commands accept an optional workspaceId. If omitted, the script auto-resolves to the Default Workspace (the first workspace returned by the API — typically "Default Workspace").

Common Recipes

Create a Google Ads Conversion Tag

See references/recipes.md for JSON templates for:

  • Google Ads Conversion Tracking tag
  • GA4 Event tag
  • Custom Event trigger (dataLayer)
  • Cross-domain tracking linker

Workflow: Add Tag → Create Version → Publish

# 1. Create trigger
scripts/gtm.sh create-trigger trigger.json

# 2. Create tag referencing the trigger
scripts/gtm.sh create-tag tag.json

# 3. Create version from workspace
scripts/gtm.sh create-version "" "v1.2 - Added conversion tag"

# 4. Publish
scripts/gtm.sh publish <versionId>

API Reference

For full resource schemas and trigger types, see references/api-reference.md.

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-29 07:39 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

data-analysis

PostHog

simonfunk
使用 PostHog REST API 交互。捕获事件、评估功能开关、用 HogQL 查询、管理用户、洞察、仪表板、实验…
★ 0 📥 1,406
developer-tools

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 67 📥 180,060
developer-tools

Gog

steipete
Google Workspace 命令行工具,支持 Gmail、日历、云端硬盘、通讯录、表格和文档。
★ 921 📥 185,777