agentleFS
arcbaslowarcbaslow/google-analytics-agent/skills/ga4-custom-defs/SKILL.md

ga4-custom-defs

Skill0 starsChanged 6 months agoMITView on GitHub

Create or archive GA4 custom dimensions and custom metrics via the Admin API. Use when adding catalog brand/category dimensions for ecomm, exposing a custom event parameter as a reportable field, or cleaning up old definitions to free quota.

The file

We split this skill into the rules it gives an agent

3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 1

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    Before creating, list current definitions to check headroom:

    line 24
  2. Distinctive:

    Must start with a letter

    line 44
  3. Very specific:

    Every Admin write is gated inside ga4_admin.py: it prints a scrubbed proposal and asks y/N for that operation.

    line 60

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

GA4: Custom Dimensions and Metrics

Scope required: analytics.edit.

Limits (standard properties, GA4 360 in parens)

  • Event-scoped custom dimensions: 50 (125)
  • User-scoped custom dimensions: 25 (100)
  • Item-scoped custom dimensions: 10 (25)
  • Custom metrics: 50 (125)

Before creating, list current definitions to check headroom:

python scripts/ga4_admin.py --property X --custom-defs --json

Commands

IntentCommand
Add event-scoped dimensionpython scripts/ga4_admin.py --property X --add-custom-dim --parameter-name brand --display-name "Brand" --scope EVENT
Add item-scoped dimensionpython scripts/ga4_admin.py --property X --add-custom-dim --parameter-name item_brand --display-name "Item brand" --scope ITEM
Add custom metricpython scripts/ga4_admin.py --property X --add-custom-metric --parameter-name shipping_value --display-name "Shipping value" --measurement-unit CURRENCY
Archive dimensionpython scripts/ga4_admin.py --archive-custom-dim properties/X/customDimensions/123 --json
Archive metricpython scripts/ga4_admin.py --archive-custom-metric properties/X/customMetrics/123 --json

Validation

The script validates parameter_name before calling the API:

  • Must start with a letter
  • May contain letters, digits, underscores
  • Length ≤ 40 (event-scoped) or 24 (user-scoped)
  • Scope must be EVENT, USER, or ITEM

When to use

  • EVENT: per-event metadata that varies across hits (logged_in_status, plan_tier, payment_provider, content_topic, video_quality)
  • USER: durable user attributes that rarely change (membership_tier, signup_cohort, internal_user_id)
  • ITEM: per-product / per-line-item catalog metadata used in ecomm items[] arrays (brand, supplier, category_path)

Cleanup

Archived definitions cannot be undone, but the slot is freed. Use the ga4-property agent to identify definitions with no data flowing.

Every Admin write is gated inside ga4_admin.py: it prints a scrubbed proposal and asks y/N for that operation. Run it in an interactive terminal; piped input, EOF and cancellation refuse the write. There is no bypass flag. MCP stdio tools provide previews; confirm=true returns confirmation_required without terminal approval. Never chain writes.

MCP propose_admin_write saves one exact Admin proposal for an expiring, single-use terminal approval. The user must run its approval_command and answer the existing y/N prompt themselves; agents must not supply approval. admin_proposal_status only reads the outcome. There is no MCP execute tool, and confirm=true remains insufficient. Refused or failed proposals cannot be replayed; applied:null means the result is unknown. See docs/APPROVALS.md.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.