← Back to Plugins
Tools

Tracking Setup

Organized-AI By Organized-AI 👁 88 views ▲ 0 votes

Three autonomous builder plugins for tracking infrastructure deployment across Google Ads, Meta, and Google Tag Manager. Claude Code plugins with OpenClaw workspace wrappers.

GitHub

Install

npm install -g

README

# OpenClaw Plugin Suite

**Three autonomous Claude Code plugins that deploy full-stack tracking infrastructure โ€” GTM, Google Ads, and Meta โ€” using MCP tools instead of manual UI clicks.**

[![Built with Claude Code](https://img.shields.io/badge/Built%20with-Claude%20Code-blueviolet)](https://claude.ai/claude-code)
[![Organized AI](https://img.shields.io/badge/Organized-AI-blue)](https://github.com/organized-ai)
[![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)

---

## What is OpenClaw?

OpenClaw turns tracking infrastructure deployment into a conversation. Instead of clicking through GTM, Google Ads, and Meta Business Manager UIs, you run a Claude Code plugin that builds your entire tracking stack through MCP server APIs.

Each plugin follows the same pattern: **skill** (knowledge) โ†’ **agent** (autonomy) โ†’ **command** (execution) โ†’ **hook** (safety). Combined with Bowser browser automation for discovery and QA, OpenClaw handles the full lifecycle from site crawl to conversion verification.

### The Three Plugins

| Plugin | What It Builds | MCP Tools Used |
|--------|---------------|----------------|
| `openclaw-gtm` | Tags, triggers, variables, sGTM clients, consent mode, container versioning | GTM MCP (Stape), Stape MCP |
| `openclaw-google-ads` | Conversion actions, remarketing audiences, GAQL audit queries | Google Ads MCP |
| `openclaw-meta` | Pixel tags, CAPI server events, event deduplication, CAPIG gateway | GTM MCP, Stape MCP, Pipeboard Meta MCP |

### The Browser Layer (Bowser)

Phase 6 adds browser automation for tasks that require eyes on the page:

| Agent | Browser Engine | Purpose |
|-------|---------------|---------|
| Discovery Agent | Playwright (headless) | Crawl pages, classify elements, identify tracking opportunities |
| Preview Agent | Chrome MCP (observable) | Validate GTM Preview mode, inspect dataLayer, verify tag firing |
| QA Agent | Either | Run declarative YAML test stories against live conversions |

---

## CLI Tools

OpenClaw includes a full CLI suite built on the [mcporter](https://github.com/steipete/mcporter) pattern โ€” pure bash scripts that wrap MCP server calls into composable commands.

### Installation

```bash
# Install mcporter (required dependency)
npm install -g @nicepkg/mcporter

# Clone the repo and make CLI tools executable
git clone https://github.com/Organized-AI/openclaw-tracking-setup.git
cd openclaw-tracking-setup
chmod +x CLI-TOOLS/openclaw CLI-TOOLS/openclaw-*

# Add to PATH (optional)
export PATH="$PATH:$(pwd)/CLI-TOOLS"
```

### CLI Architecture

```
CLI-TOOLS/
โ”œโ”€โ”€ openclaw              # Main entry point โ€” routes to sub-tools
โ”œโ”€โ”€ openclaw-gtm          # GTM container operations
โ”œโ”€โ”€ openclaw-gads         # Google Ads GAQL queries & conversion audit
โ”œโ”€โ”€ openclaw-meta         # Meta Pixel + CAPI audit & event mapping
โ”œโ”€โ”€ openclaw-stape        # Stape sGTM container management
โ”œโ”€โ”€ openclaw-discover     # Site crawl & tracking opportunity discovery
โ”œโ”€โ”€ openclaw-preview      # GTM Preview mode validation
โ”œโ”€โ”€ openclaw-qa           # YAML test story runner
โ”œโ”€โ”€ lib/
โ”‚   โ”œโ”€โ”€ common.sh         # Shared utilities, colors, logging, mcporter wrapper
โ”‚   โ””โ”€โ”€ gtm-helpers.sh    # GTM MCP helper functions
โ”œโ”€โ”€ config/
โ”‚   โ””โ”€โ”€ mcporter.json     # MCP server definitions
โ”œโ”€โ”€ google-ads/           # Google Ads deployment & credential scripts
โ”‚   โ”œโ”€โ”€ *.sh              # 9 deployment/verification scripts
โ”‚   โ”œโ”€โ”€ oauth-server.py   # Python OAuth callback server
โ”‚   โ”œโ”€โ”€ config/
โ”‚   โ”‚   โ””โ”€โ”€ exec-approvals.json  # Tool authorization (24 read + 11 write)
โ”‚   โ””โ”€โ”€ README.md         # Google Ads CLI documentation
โ””โ”€โ”€ stories/              # QA test story files (YAML)
```

### Environment Variables

```bash
# GTM (required for gtm, meta, preview commands)
export GTM_ACCOUNT_ID="your-account-id"
export GTM_CONTAINER_ID="your-container-id"
export GTM_WORKSPACE_ID="your-workspace-id"

# Stape (required for stape commands)
export STAPE_CONTAINER_ID="your-stape-container-id"

# Google Ads (required for gads commands)
export GOOGLE_ADS_CUSTOMER_ID="your-customer-id"
export GOOGLE_ADS_LOGIN_CUSTOMER_ID="your-login-cid"
```

### Usage

```bash
# Check environment and MCP server connectivity
openclaw env

# โ”€โ”€โ”€ GTM Operations โ”€โ”€โ”€
openclaw gtm audit              # Full container audit (tags + triggers + vars + clients)
openclaw gtm list-tags           # List all tags
openclaw gtm list-triggers       # List all triggers
openclaw gtm list-vars           # List all variables
openclaw gtm list-clients        # List sGTM clients
openclaw gtm status              # Workspace change status
openclaw gtm publish             # Create version and publish (with confirmation)

# โ”€โ”€โ”€ Google Ads โ”€โ”€โ”€
openclaw gads accounts           # List accessible accounts
openclaw gads conversions        # Audit all conversion actions
openclaw gads campaigns          # Campaign performance metrics
openclaw gads query 'SELECT campaign.name FROM campaign'  # Custom GAQL

# โ”€โ”€โ”€ Meta โ”€โ”€โ”€
openclaw meta audit              # Audit Meta/Facebook tags in GTM
openclaw meta pixel-tags         # List Pixel tag configurations
openclaw meta event-map          # GA4 โ†” Meta event mapping table

# โ”€โ”€โ”€ Stape sGTM โ”€โ”€โ”€
openclaw stape containers        # List all Stape containers
openclaw stape get --id ABC123   # Get container details
openclaw stape domains --id X    # List container domains
openclaw stape power-ups --id X  # Check power-up status

# โ”€โ”€โ”€ Site Discovery โ”€โ”€โ”€
openclaw discover https://example.com              # Crawl and identify tracking opportunities
openclaw discover https://example.com --depth 3    # Deeper crawl
openclaw discover https://example.com --format json # JSON output

# โ”€โ”€โ”€ GTM Preview Validation โ”€โ”€โ”€
openclaw preview https://example.com                    # Basic validation
openclaw preview https://example.com --full             # Full validation suite
openclaw preview https://example.com --check-consent    # Consent mode check

# โ”€โ”€โ”€ QA Test Stories โ”€โ”€โ”€
openclaw qa init my-test                  # Create test story template
openclaw qa run stories/my-test.yaml      # Run test story
openclaw qa validate stories/my-test.yaml # Validate YAML syntax
openclaw qa list                          # List available stories
```

### How the CLI Works

Each CLI tool wraps MCP server calls via mcporter. For example, `openclaw gtm list-tags` translates to:

```bash
mcporter call gtm-mcp-server.gtm_tag \
  action:list \
  accountId:$GTM_ACCOUNT_ID \
  containerId:$GTM_CONTAINER_ID \
  workspaceId:$GTM_WORKSPACE_ID
```

The `mcp()` wrapper function in `lib/common.sh` handles mcporter detection, fallback to npx, and JSON output formatting. GTM-specific operations live in `lib/gtm-helpers.sh` as reusable bash functions shared across `openclaw-gtm` and `openclaw-meta`.

---

## Google Ads CLI Tools

The `CLI-TOOLS/google-ads/` directory contains deployment, credential management, and verification scripts for the full 35-tool Google Ads CLI inventory (24 read + 11 write across 9 categories).

### Tool Inventory (35 Tools)

| Category | Read Tools | Write Tools | Total |
|----------|-----------|-------------|-------|
| Campaigns | `list-campaigns`, `get-campaign`, `campaign-performance` | `create-campaign`, `update-campaign`, `pause-campaign` | 6 |
| Ad Groups | `list-ad-groups`, `get-ad-group`, `ad-group-performance` | `create-ad-group`, `update-ad-group` | 5 |
| Ads | `list-ads`, `get-ad`, `ad-performance` | โ€” | 3 |
| Keywords | `list-keywords`, `keyword-performance`, `search-terms` | `add-keywords`, `update-keyword-bids` | 5 |
| Performance | `account-performance`, `daily-performance`, `device-performance`, `geo-performance` | โ€” | 4 |
| Accounts | `list-accounts`, `account-info` | โ€” | 2 |
| Analytics | `auction-insights`, `quality-score`, `change-history` | โ€” | 3 |
| Conversions | `list-conversions`, `conversion-performance` | `create-conversion-action`, `update-conversion` | 4 |
| Shopping | `list-products`, `shopping-performance` | `update-product-group` | 3 |

### Deployment Scripts

| Script | Purpose |
|--------|---------|
| `deploy-google-ads-credentials.sh` | Deploy API credentials (JSON + YAML) to Mac Mini via Tailscale SSH |
| `deploy-google-ads-tools-md.sh` | Deploy TOOLS.md to Mac Mini for agent write authorization |
| `diagnose-google-ads.sh` | Diagnostic check across 4 credential locations |
| `fix-google-ads-credentials.sh` | Interactive credential setup wizard |
| `generate-google-ads-refresh-token.sh` | CLI OAuth flow (copy-paste auth code) |
| `generate-google-ads-token-web.sh` | Web OAuth flow (local HTTP server callback) |
| `monitor-google-ads-cli.sh` | Health monitor with Telegram/email/desktop alerts |
| `setup-google-ads-on-macmini.sh` | Full Mac Mini credential setup (run directly on target) |
| `verify-google-ads-deployment.sh` | 4-layer verification for all 35 tools |
| `verify-tool-deployment.sh` | Generic OpenClaw tool verifier (reusable) |
| `oauth-server.py` | Python OAuth callback server for web flow |

### 4-Layer Verification

The verification scripts follow a layered approach:

1. **Infrastructure** โ€” Binary exists, PATH configured, credential files present
2. **Read Tools** โ€” 14 read tool API tests with live responses
3. **Write Tools** โ€” 11 write tool syntax checks (optional `--write` flag for live API)
4. **Agent Integration** โ€” TOOLS.md references, gateway connectivity, exec-approvals config

### Exec-Approvals

The `config/exec-approvals.json` file controls which CLI subcommands an agent can execute (deny by default). It defines three rules: `allow-google-ads-read` (24 tools), `allow-google-ads-write` (11 tools), and `allow-google-ads-help`.

### Required Environment Variables

```bash
export GOOGLE_ADS_DEVELOPER_TOKEN="your-developer-token"
export GOOGLE_ADS_CLIENT_ID="your-oauth-client-id"
export GOOGLE_ADS_CLIENT_SECRET="your-oauth-client-secret"
export GOOGLE_ADS_REFRESH_TOKEN="your-refresh-token"
export GOOGLE_ADS_LOGIN_CUSTOMER_ID="your-mcc-customer-id"
```

---


... (truncated)
tools

Comments

Sign in to leave a comment

Loading comments...