Skip to content

sem-technology/gtm-copilot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GTM Copilot

This project focuses on building programs and prompts to automate Google Tag Manager (GTM) implementation tasks using AI.

How it Works

  1. Extraction: Using the Google Tag Manager API, the tool retrieves existing components such as tags, triggers, and variables, and saves them in JSON format.
  2. AI-Powered Modification: AI is used to update the JSON files, performing the actual tag implementation logic within the files.
  3. Synchronization: Once the implementation (JSON editing) is complete, the changes are synced back to Google Tag Manager using the API.

Architecture

To ensure portability and ease of setup, this project is implemented using only the Python standard library. No external dependencies (such as requests or google-auth) are required.

  • Programming Language: Python 3.x (Standard Library only)

Setup (Agent Skills)

To use GTM Copilot as an AI Agent skill, follow these steps:

  1. Download: Clone this repository into your agent's skill directory.

    For Claude Code:

    # User-level
    git clone https://github.com/sem-technology/gtm-copilot.git ~/.claude/skills/gtm-copilot
    # Project-level
    git clone https://github.com/sem-technology/gtm-copilot.git .claude/skills/gtm-copilot

    For Gemini (including Antigravity):

    # User-level
    git clone https://github.com/sem-technology/gtm-copilot.git ~/.agent/skills/gtm-copilot
    # Project-level
    git clone https://github.com/sem-technology/gtm-copilot.git .agent/skills/gtm-copilot
  2. Authentication:

    • Copy .env.example to .env in the skill directory.
    • Run the authentication script to generate your refresh token:
      python scripts/bin/auth.py
    • Follow the prompts to authorize and update the values in your .env file.
  3. Usage: Once placed and authenticated, your AI Agent will automatically recognize the tools defined in SKILL.md and can start automating your GTM workflow.

Configuration

Environment Variables

You can customize the behavior of GTM Copilot using environment variables. These should be defined in a .env file located in the project root directory (or the skill directory):

  • GTM_CLIENT_ID: The OAuth 2.0 Client ID obtained from the Google Cloud Console.
  • GTM_CLIENT_SECRET: The OAuth 2.0 Client Secret obtained from the Google Cloud Console.
  • GTM_REFRESH_TOKEN: The OAuth 2.0 Refresh Token generated by running auth.py. Used for automatic access token renewal.
  • GTM_EXPORT_ROOT_PATH: Defines the root directory for exporting and importing GTM configurations.
    • Placeholder: Supports [[GTM_ID]], which is automatically replaced by the container's public ID (e.g., GTM-XXXXXX).
    • Default: tmp/[[GTM_ID]]
    • Priority: Command-line arguments > Environment variable > Default path.

Updating

To update the skill to the latest version, navigate to the skill directory and run:

# User-level (example)
cd ~/.agent/skills/gtm-copilot
git pull origin main

For more information on Agent Skills, please refer to agentskills.io.

About

AI-powered automation for Google Tag Manager deployments.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages