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.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ga4-audiencesSkill
- ga4-auditSkill
- ga4-contextSkill
- ga4-custom-reportSkill
- ga4-events-editSkill
- ga4-eventsSkill
- ga4-funnelSkill
- ga4-key-eventsSkill
- ga4-segment-defsSkill
- ga4-segmentsSkill
- ga4Skill
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
- Distinctive: line 24
Before creating, list current definitions to check headroom:
- Distinctive: line 44
Must start with a letter
- Very specific: line 60
Every Admin write is gated inside ga4_admin.py: it prints a scrubbed proposal and asks y/N for that operation.
≈ “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.
Files
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 --jsonCommands
| Intent | Command |
| Add event-scoped dimension | python scripts/ga4_admin.py --property X --add-custom-dim --parameter-name brand --display-name "Brand" --scope EVENT |
| Add item-scoped dimension | python scripts/ga4_admin.py --property X --add-custom-dim --parameter-name item_brand --display-name "Item brand" --scope ITEM |
| Add custom metric | python scripts/ga4_admin.py --property X --add-custom-metric --parameter-name shipping_value --display-name "Shipping value" --measurement-unit CURRENCY |
| Archive dimension | python scripts/ga4_admin.py --archive-custom-dim properties/X/customDimensions/123 --json |
| Archive metric | python 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, orITEM
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.
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
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.

