Google ad manager

From mvanhorn/printing-press-library · View interactive version

Google ad manager is an AI agent skill from the GitHub repository mvanhorn/printing-press-library. The only REST-native Google Ad Manager CLI: report, search, and manage publisher inventory from the terminal Trigger phrases: `run a GAM report`, `google ad manager revenue by ad unit`, `check line item delivery in ad manager`, `search my ad manager inventory`, `what targeting does this order use`,

How to use this skill

Skill file

Google Ad Manager — Printing Press CLI

Prerequisites: Install the CLI

This skill drives the google-ad-manager-pp-cli binary. You must verify the CLI is installed before invoking any command from this skill. If it is missing, install it first:

  1. Install via the Printing Press installer. It defaults binaries to $HOME/.local/bin on macOS/Linux and %LOCALAPPDATA%\Programs\PrintingPress\bin on Windows:

```bash

npx -y @mvanhorn/printing-press-library install google-ad-manager --cli-only

```

  1. Verify: google-ad-manager-pp-cli --version
  2. Ensure the reported install directory is on $PATH for the agent/runtime that will invoke this skill.

If the npx install fails (no Node, offline, etc.), fall back to a direct Go install (requires Go 1.26.6 or newer). This installs into $GOPATH/bin (default $HOME/go/bin), so add that directory to $PATH instead:

go install github.com/mvanhorn/printing-press-library/library/marketing/google-ad-manager/cmd/google-ad-manager-pp-cli@latest

If --version reports "command not found" after install, the runtime cannot see the binary directory on $PATH. Do not proceed with skill commands until verification succeeds.

Wraps the Ad Manager REST v1 API with a local SQLite mirror, offline full-text search across inventory, targeting, and orders, and one-shot async report orchestration where report run chains create, run, poll, and fetch into a single command. Built for publisher ad-ops who want to observe and manage a GAM360 network without living in the console. Covers reporting, inventory and targeting management (including the writes the REST API supports), and orders, line-item, and PMP visibility; trafficking, forecasting, and creative creation remain in the legacy SOAP API and are intentionally out of scope.

When to Use This CLI

Use for observing and reporting on a Google Ad Manager (publisher) network: pulling revenue and delivery reports, browsing and searching inventory and custom targeting, checking order and line-item status, and inspecting PMP deals, plus the inventory and targeting writes the REST API supports. Ideal when an agent needs real GAM numbers or inventory context without navigating the web console, or when a question spans multiple entity types the UI keeps on separate screens.

Anti-triggers

Do not use this CLI for:

Unique Capabilities

These capabilities aren't available in any other tool for this API.

Async report orchestration

_Reach for this whenever an agent needs actual GAM revenue or delivery numbers; it turns the hardest API workflow into one deterministic step._

```bash

google-ad-manager-pp-cli report run --dimensions AD_UNIT_NAME,DATE --metrics IMPRESSIONS,REVENUE --date-range YESTERDAY --network 123456 --json

```

_Use when the user references a named or standing report they run repeatedly; it replays a known-good definition without rebuilding it._

```bash

google-ad-manager-pp-cli report rerun 988877 --network 123456 --agent

```

_Reach for this to answer what changed or dropped overnight without an analyst manually eyeballing two exports._

```bash

google-ad-manager-pp-cli report watch 988877 --metric 0 --threshold 15 --network 123456 --json

```

_Reach for this to let an agent triage which campaigns are at delivery risk without opening the delivery UI._

```bash

google-ad-manager-pp-cli lineitem pace --order 554433 --date-range MONTH_TO_DATE --network 123456 --agent

```

Offline cross-entity intelligence

_Reach for this to give an agent the complete picture of what a campaign actually touches in one structured object._

```bash

google-ad-manager-pp-cli order graph 554433 --agent --select order.lineItems.id,order.lineItems.name --network 123456

```

_Use to catch what trafficking or another team changed out from under you between two points in time._

```bash

google-ad-manager-pp-cli since --since last-sync --network 123456 --json

```

Inventory hygiene

_Reach for this to orient an agent in the inventory hierarchy before it reasons about placements or subtree revenue._

```bash

google-ad-manager-pp-cli adunits tree --root 21700000 --status ACTIVE --network 123456

```

_Use during inventory cleanups to hand an agent a concrete list of misconfigured or dead units to investigate._

```bash

google-ad-manager-pp-cli inventory orphans --root 21700000 --network 123456 --json

```

Command Reference

ad-breaks — Manage ad breaks

ad-review-center-ads-batch-allow — Manage ad review center ads batch allow

ad-review-center-ads-batch-block — Manage ad review center ads batch block

ad-review-center-ads-search — Manage ad review center ads search

ad-spots — Manage ad spots

ad-spots-batch-create — Manage ad spots batch create

ad-spots-batch-update — Manage ad spots batch update

ad-unit-sizes — Manage ad unit sizes

ad-units — Manage ad units

ad-units-batch-activate — Manage ad units batch activate

ad-units-batch-archive — Manage ad units batch archive

ad-units-batch-create — Manage ad units batch create

ad-units-batch-deactivate — Manage ad units batch deactivate

ad-units-batch-update — Manage ad units batch update

applications — Manage applications

applications-batch-archive — Manage applications batch archive

applications-batch-create — Manage applications batch create

applications-batch-unarchive — Manage applications batch unarchive

applications-batch-update — Manage applications batch update

audience-segments — Manage audience segments

bandwidth-groups — Manage bandwidth groups

browser-languages — Manage browser languages

browsers — Manage browsers

cms-metadata-keys — Manage cms metadata keys

cms-metadata-keys-batch-activate — Manage cms metadata keys batch activate

cms-metadata-keys-batch-deactivate — Manage cms metadata keys batch deactivate

cms-metadata-values — Manage cms metadata values

cms-metadata-values-batch-activate — Manage cms metadata values batch activate

cms-metadata-values-batch-deactivate — Manage cms metadata values batch deactivate

companies — Manage companies

contacts — Manage contacts

contacts-batch-create — Manage contacts batch create

contacts-batch-update — Manage contacts batch update

content — Manage content

content-bundles — Manage content bundles

content-labels — Manage content labels

creative-templates — Manage creative templates

custom-fields — Manage custom fields

custom-fields-batch-activate — Manage custom fields batch activate

custom-fields-batch-create — Manage custom fields batch create

custom-fields-batch-deactivate — Manage custom fields batch deactivate

custom-fields-batch-update — Manage custom fields batch update

custom-targeting-keys — Manage custom targeting keys

custom-targeting-keys-batch-activate — Manage custom targeting keys batch activate

custom-targeting-keys-batch-create — Manage custom targeting keys batch create

custom-targeting-keys-batch-deactivate — Manage custom targeting keys batch deactivate

custom-targeting-keys-batch-update — Manage custom targeting keys batch update

custom-targeting-values — Manage custom targeting values

device-capabilities — Manage device capabilities

device-categories — Manage device categories

device-manufacturers — Manage device manufacturers

entity-signals-mappings — Manage entity signals mappings

entity-signals-mappings-batch-create — Manage entity signals mappings batch create

entity-signals-mappings-batch-update — Manage entity signals mappings batch update

geo-targets — Manage geo targets

labels — Manage labels

labels-batch-activate — Manage labels batch activate

labels-batch-create — Manage labels batch create

labels-batch-deactivate — Manage labels batch deactivate

labels-batch-update — Manage labels batch update

line-items — Manage line items

linked-devices — Manage linked devices

mcm-earnings-fetch — Manage mcm earnings fetch

mobile-carriers — Manage mobile carriers

mobile-device-submodels — Manage mobile device submodels

mobile-devices — Manage mobile devices

name-cancel — Manage name cancel

name-fetch-rows — Manage name fetch rows

name-run — Manage name run

networks — Manage networks

operating-system-versions — Manage operating system versions

operating-systems — Manage operating systems

orders — Manage orders

placements — Manage placements

placements-batch-activate — Manage placements batch activate

placements-batch-archive — Manage placements batch archive

placements-batch-create — Manage placements batch create

placements-batch-deactivate — Manage placements batch deactivate

placements-batch-update — Manage placements batch update

private-auction-deals — Manage private auction deals

private-auctions — Manage private auctions

programmatic-buyers — Manage programmatic buyers

reports — Manage reports

rich-media-ads-companies — Manage rich media ads companies

roles — Manage roles

sites — Manage sites

sites-batch-create — Manage sites batch create

sites-batch-deactivate — Manage sites batch deactivate

sites-batch-submit-for-approval — Manage sites batch submit for approval

sites-batch-update — Manage sites batch update

taxonomy-categories — Manage taxonomy categories

teams — Manage teams

teams-batch-activate — Manage teams batch activate

teams-batch-create — Manage teams batch create

teams-batch-deactivate — Manage teams batch deactivate

teams-batch-update — Manage teams batch update

Finding the right command

When you know what you want to do but not which command does it, ask the CLI directly:

google-ad-manager-pp-cli which "<capability in your own words>"

which resolves a natural-language capability query to the best matching command from this CLI's curated feature index. Exit code 0 means at least one match; exit code 2 means no confident match — fall back to --help or use a narrower query.

Recipes

Yesterday's revenue by ad unit

google-ad-manager-pp-cli report run --dimensions AD_UNIT_NAME,DATE --metrics IMPRESSIONS,REVENUE --date-range YESTERDAY --network 123456 --json

Builds, runs, polls, and fetches the report in one call and emits machine-readable rows.

Expand an order for an agent, narrowed

google-ad-manager-pp-cli order graph 554433 --agent --select order.lineItems.id,order.lineItems.name --network 123456

Returns the order and its line items (goal, type, dates); --select narrows the nested response to the fields an agent needs.

What changed since the last sync

google-ad-manager-pp-cli since --since last-sync --network 123456 --json

Surfaces entities added or changed (by updateTime) since the cutoff; refreshes live when --network is set. It cannot detect removals.

Auth Setup

Authenticate with a Google OAuth2 access token for the admanager scope (or admanager.readonly for read-only use). Set GOOGLE_AD_MANAGER_ACCESS_TOKEN, for example export GOOGLE_AD_MANAGER_ACCESS_TOKEN=$(gcloud auth print-access-token --scopes=https://www.googleapis.com/auth/admanager.readonly), or mint one from a service account reused from your SOAP setup. Every command is scoped to a network code: set GOOGLE_AD_MANAGER_NETWORK_CODE or pass --network <code>. Access tokens are short-lived (about an hour); re-export when you see a 401.

Run google-ad-manager-pp-cli doctor to verify setup.

Agent Mode

Add --agent to any command. Expands to: --json --compact --no-input --no-color --yes.

```bash

google-ad-manager-pp-cli ad-breaks list mock-value --agent --select id,name,status

```

Response envelope

Commands that read from the local store or the API wrap output in a provenance envelope:

{
  "meta": {"source": "live" | "local", "synced_at": "...", "reason": "..."},
  "results": <data>
}

Parse .results for data and .meta.source to know whether it's live or local. A human-readable N results (live) summary is printed to stderr only when stdout is a terminal AND no machine-format flag (--json, --csv, --compact, --quiet, --plain, --select) is set — piped/agent consumers and explicit-format runs get pure JSON on stdout.

Agent Feedback

When you (or the agent) notice something off about this CLI, record it:

google-ad-manager-pp-cli feedback "the --since flag is inclusive but docs say exclusive"
google-ad-manager-pp-cli feedback --stdin < notes.txt
google-ad-manager-pp-cli feedback list --json --limit 10

Entries are stored locally at ~/.local/share/google-ad-manager-pp-cli/feedback.jsonl. They are never POSTed unless GOOGLE_AD_MANAGER_FEEDBACK_ENDPOINT is set AND either --send is passed or GOOGLE_AD_MANAGER_FEEDBACK_AUTO_SEND=true. Default behavior is local-only.

Write what surprised you, not a bug report. Short, specific, one line: that is the part that compounds.

Output Delivery

Every command accepts --deliver <sink>. The output goes to the named sink in addition to (or instead of) stdout, so agents can route command results without hand-piping. Three sinks are supported:

| Sink | Effect |

|------|--------|

| stdout | Default; write to stdout only |

| file:<path> | Atomically write output to <path> (tmp + rename) |

| webhook:<url> | POST the output body to the URL (application/json or application/x-ndjson when --compact) |

Unknown schemes are refused with a structured error naming the supported set. Webhook failures return non-zero and log the URL + HTTP status on stderr.

Named Profiles

A profile is a saved set of flag values, reused across invocations. Use it when a scheduled agent calls the same command every run with the same configuration - HeyGen's "Beacon" pattern.

google-ad-manager-pp-cli profile save briefing --json
google-ad-manager-pp-cli --profile briefing ad-breaks list mock-value
google-ad-manager-pp-cli profile list --json
google-ad-manager-pp-cli profile show briefing
google-ad-manager-pp-cli profile delete briefing --yes

Explicit flags always win over profile values; profile values win over defaults. agent-context lists all available profiles under available_profiles so introspecting agents discover them at runtime.

Exit Codes

| Code | Meaning |

|------|---------|

| 0 | Success |

| 2 | Usage error (wrong arguments) |

| 3 | Resource not found |

| 4 | Authentication required |

| 5 | API error (upstream issue) |

| 7 | Rate limited (wait and retry) |

| 10 | Config error |

Argument Parsing

Parse $ARGUMENTS:

  1. Empty, help, or --help → show google-ad-manager-pp-cli --help output
  2. Starts with install → ends with mcp → MCP installation; otherwise → see Prerequisites above
  3. Anything else → Direct Use (execute as CLI command with --agent)

MCP Server Installation

  1. Install the MCP server:

```bash

go install github.com/mvanhorn/printing-press-library/library/marketing/google-ad-manager/cmd/google-ad-manager-pp-mcp@latest

```

  1. Register with Claude Code:

```bash

claude mcp add google-ad-manager-pp-mcp -- google-ad-manager-pp-mcp

```

  1. Verify: claude mcp list

Direct Use

  1. Check if installed: which google-ad-manager-pp-cli

If not found, offer to install (see Prerequisites at the top of this skill).

  1. Match the user query to the best command from the Unique Capabilities and Command Reference above.
  2. Execute with the --agent flag:

```bash

google-ad-manager-pp-cli <command> [subcommand] [args] --agent

```

  1. If ambiguous, drill into subcommand help: google-ad-manager-pp-cli <command> --help.
Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.