GTM Copilot - Develop & Manage GTM Configurations

VerifiedCaution

Comprehensive skill for developing, managing, importing, and exporting Google Tag Manager configurations using bundled scripts and API.

Sby Skills Guide Bot
DevelopmentIntermediate
8/12/2026
Claude Code
#google-tag-manager#analytics#oauth2#json-config#api-automation

Recommended for

Automated summary

This skill drives the full Google Tag Manager development cycle: OAuth2 authentication, exporting a workspace's configuration to local JSON files, letting the agent edit them, then re-importing to synchronize the changes into the container.

Strengths

  • Export / local edit / import loop that lets you change tags, triggers and variables in bulk without clicking through the GTM UI
  • The import step automatically resolves name-based references to numeric IDs and writes the official fingerprint values back into the local JSON
  • Ships audit checkpoints plus sample web and server-side container configurations under resources/
  • Self-contained package with Python scripts, an API client module and a .env template for credentials

Limitations

  • Requires pre-existing GTM OAuth2 credentials (client ID, secret, refresh token) generated first through the auth script
  • Works against a single workspace URL targeted by argument, with no documented handling of multiple accounts or containers at once
  • SKILL.md is partially truncated, so the audit workflow details and import error handling are not fully spelled out
When to use it

Use it to audit or batch-refactor the tags, triggers and variables of a GTM container through versionable JSON files.

When not to use it

Avoid it for tweaking a single tag, which is faster in the GTM interface, or when you lack API access to the container.

Security analysis

Caution
Quality score82/100

The skill is transparent about what it does: OAuth-authenticated reads and writes against the Google Tag Manager API using bundled Python scripts invoked through run_command. There is no destructive, obfuscated, or clearly exfiltrating behavior in the instructions, and it includes an explicit guardrail against modifying or importing without user instruction. However, it does run third-party code with live API credentials and can mutate production container configurations, so it belongs in 'caution' rather than 'safe' pending inspection of the bundled scripts.

Findings
  • •Skill instructs the agent to execute bundled Python scripts (auth.py, export.py, import.py) via run_command, which executes third-party code with network access to the Google Tag Manager API.
  • •Requires long-lived OAuth credentials (GTM_CLIENT_ID, GTM_CLIENT_SECRET, GTM_REFRESH_TOKEN) stored in a .env file; the agent is directed to read/load project environment configuration, so credential handling should be reviewed.
  • •The import workflow mutates live GTM containers (creating/updating tags, triggers, variables), which is a production-impacting write operation and warrants explicit user confirmation.
  • •Scripts, helpers, and JSON resources are bundled but not shown in the SKILL.md; actual behavior of gtm_client.py / authentication.py cannot be verified from this file alone.
  • •No evidence of obfuscation, base64 payloads, curl|sh installs, destructive filesystem commands, or exfiltration to non-GTM endpoints.
How this analysis is made

Examples

Bulk add a consent-aware pageview tag
Export my GTM workspace at https://tagmanager.google.com/#/container/accounts/123/containers/456/workspaces/7, add a GA4 page_view tag that fires on all pages only after consent, wire the needed variables and triggers, then import it back.
Audit container configuration
Export the GTM container from this workspace URL and audit the tags, triggers and variables against resources/documents/audit_checkpoints.md, then list the issues by severity.
Fix a broken trigger condition
In the exported GTM JSON under tmp/, the 'purchase' trigger fires on the wrong event name — correct the condition, keep the existing fingerprint, and re-import so the change is synced.

name: gtm-copilot description: A comprehensive skill for developing, managing, importing, and exporting Google Tag Manager configurations - GTM Copilot license: MIT compatibility: "python >= 3.x" metadata: version: 0.2.0 author: SEM Technology homepage: https://github.com/sem-technology/gtm-copilot disable-model-invocation: false allowed-tools:

  • run_command
  • list_dir
  • view_file
  • grep_search
  • codebase_search

GTM Copilot Skill

This skill supports the entire Google Tag Manager (GTM) development workflow. All necessary tools and documentation are bundled within this skill directory.

Directory Structure (Bundled Resources)

This skill is configured as a self-contained package. Agents must always use relative paths within this skill directory.

  • SKILL.md: Skill definition (this file)
  • .env.example: Template for environment variable settings
  • LICENSE.txt: License information
  • scripts/: Folder containing all program code
    • bin/: Executable scripts (auth.py, export.py, import.py)
    • gtm_client.py: Core implementation of the GTM API client
    • authentication.py: Authentication module
    • helpers/: Utilities and client logic
  • resources/: Folder for supplemental documents and sample data
    • documents/: Documents for GTM Copilot
      • audit_checkpoints.md: Detailed audit criteria for GTM configurations
    • server_container/: Configuration for Server-side GTM
      • tags.json
      • triggers.json
      • variables.json
      • built_in_variables.json
    • web_container/: Configuration for Web GTM
      • tags.json
      • triggers.json
      • variables.json
      • built_in_variables.json

Configuration

Environment variables are loaded from the .env file located in the project root.

  • GTM_CLIENT_ID: OAuth 2.0 Client ID for GTM API access.
  • GTM_CLIENT_SECRET: OAuth 2.0 Client Secret for GTM API access.
  • GTM_REFRESH_TOKEN: OAuth 2.0 Refresh Token for automatic token renewal.
  • GTM_EXPORT_ROOT_PATH: Environment variable to specify the root directory for GTM files.
    • Placeholder: Supports [[GTM_ID]] for dynamic path resolution based on the container ID.
    • Resolution Priority: CLI Argument > Env Var > Default (tmp/[[GTM_ID]]).

Command Details

1. auth (Authentication Setup)

Performs OAuth2 authentication to access the GTM API.

  • Execution: python ./scripts/bin/auth.py
  • Role: Input Client ID/Secret and generate a refresh token.

2. export (State Extraction)

Exports existing GTM configurations as local JSON files.

  • Execution: python ./scripts/bin/export.py --url <GTM_WORKSPACE_URL>
  • Output: The path defined by --output or GTM_EXPORT_ROOT_PATH (defaults to ./tmp/GTM-XXXXXX/).
  • Role: Save the current state of tags, triggers, and variables as a snapshot for editing.

3. import (Change Synchronization)

Updates the GTM container based on local JSON files.

  • Execution: python ./scripts/bin/import.py --url <GTM_WORKSPACE_URL>
  • Input: The path defined by --directory or GTM_EXPORT_ROOT_PATH (defaults to ./tmp/GTM-XXXXXX/).
  • Role:
    • Create new components
    • Update existing components (only if changes detected)
    • Automatically resolve ID references (from name-based to numeric IDs)

Workflow

Development Workflow

  1. Export: Run scripts/bin/export.py to get the latest GTM state.
  2. Implementation (AI Work): Modify the JSON files under tmp/.
    • Add new tags
    • Change trigger conditions
    • Fix variable definitions
  3. Import: Run scripts/bin/import.py to synchronize changes.
    • After sync, official IDs and fingerprint values are written back to local JSONs.

Audit Workflow

  1. Export: Run scripts/bin/export.py to get the latest GTM state.
  2. Audit:
    • The agent uses the view_file tool to read resources/documents/audit_checkpoints.md to understand the audit criteria.
    • The agent then analyzes the exported JSON files in tmp/ based on those criteria.
  3. Report: The agent provides a summary of findings (issues, risks, and recommendations) to the user.

Crucial: The agent must not modify any tags, triggers, or variables, nor perform any import operations, unless specifically instructed to do so by the user.

Notes on JSON File Generation & Editing

  • Name-based References (Recommended):
    • When specifying firing triggers for tags, you can use the "Trigger Name" instead of a numeric ID. This is especially useful for tags referencing newly created triggers that don't have IDs yet.
    • Use the {{Variable Name}} format to reference variables.
  • Dependency Resolution:
    • If a new tag references a new trigger, the import script automatically detects the dependency and creates the trigger first.
  • Change Detection:
    • The script compares content hashes and skips API calls if there are no actual changes.
  • Implementation References:
    • Use the JSON files in the resources/server_container/ or resources/web_container/ directories as references for correct schemas and parameter structures.
    • Important: Available tags, triggers, and variables differ significantly between Server and Web containers. Ensure you reference the correct directory for your specific container type when implementing new components.

From the file to a first result

The download contains exactly the content displayed on this page. This copy may differ from the latest version in the source repository.

View the source and supporting files

This download contains SKILL.md only. Any scripts, references, templates and dependencies are not included. Get the required files from the source, preserving their directory structure, before continuing.

1. Download the file

Download SKILL.md

From the root of a test project, save the file as .skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj/SKILL.md, or use the command below. This folder is for inspecting the skill before installation.

Command for macOS/Linux or WSL: requires a POSIX shell and curl. On Windows without WSL, use the download button and create the folder manually.

mkdir -p '.skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj' && curl --fail --show-error --location 'https://skills-guides.com/api/skills/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj/download' --output '.skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj/SKILL.md.part' && mv '.skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj/SKILL.md.part' '.skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj/SKILL.md'

2. Check prerequisites

Read SKILL.md before using it. If it references scripts or external services, inspect them and prepare the required access in your test environment.

Environment declared by the author: python >= 3.x

No recognized prerequisites section in this file. This does not mean it is self-contained: libraries, tools and access requirements may be mentioned elsewhere in the content or source repository.

The platforms on this page are catalog indications. The paths below follow tool documentation; they do not prove this skill has been run in those tools. No minimum tool version is confirmed for this listing.

3. Load the skill

After inspection, copy the complete folder into your project using one of the commands below, then open a new tool session. The command stops if a folder with the same name already exists: compare the files before replacing it.

Claude Code
test -f '.skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj/SKILL.md' && test -s '.skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj/SKILL.md' && mkdir -p '.claude/skills' && test ! -e '.claude/skills/gtm-copilot' && cp -R '.skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj' '.claude/skills/gtm-copilot'

OpenSkills

OpenSkills must already be installed. The local install/read procedure is checked with OpenSkills 1.5.0, which requires Node.js ≥ 20.6.0. Catalog slugs are not resolved automatically.

Official OpenSkills installation
openskills install './.skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj'

openskills read 'gtm-copilot-develop-manage-gtm-configurations-mspm3ckj'

Reading should display the installed file content and its base directory. It does not run the skill or install its dependencies.

For an agent that reads AGENTS.md, then sync the index. This command changes AGENTS.md: review the diff before using it.

openskills sync

Manual method or another tool: attach SKILL.md to a conversation, or open it in an agent that can read files. Include any required supporting resources. No universal folder is recognized by every tool.

4. Try a first task

Use a short, synthetic input: an API endpoint, a small document or an interface brief. In a new conversation, attach the file or give the agent its path, then adapt this request:

Read .skill-downloads/gtm-copilot-develop-manage-gtm-configurations-mspm3ckj/SKILL.md and apply its instructions to this example: [describe a test input]. Identify any missing files, dependencies or access. Produce the result requested by the skill without inventing data or running unreviewed scripts.

Expected result: output matching the skill instructions, or a precise list of missing prerequisites. A read confirmation alone does not validate a first use. If an external resource is unavailable, that path remains untested.

Related skills