ga4-audiences
Skill0 starsChanged 6 months agoMITView on GitHub
Manage GA4 Audiences via the Admin API. Create, list, archive, rename. Audiences are stored cohorts based on event/dimension filters, usable in reports and Google Ads. Triggers: 'create audience', 'audience definition', 'cohort builder', 'high-intent users'.
In this repository13 other files it gives its agents.
- AGENTS.mdAGENTS.md
- CLAUDE.mdCLAUDE.md
- ga4-auditSkill
- ga4-contextSkill
- ga4-custom-defsSkill
- 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
1 rule. About 0 are common, 0 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈0
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
- Very specific: line 79
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: Audiences
Audiences are immutable post-create for their filter clauses - only
display_name and description can be changed afterward. To alter the
filter, archive the existing audience and create a new one.
Scope required: analytics.edit.
Process
- Verify auth.
- For proposals based on observed funnel drop-off, spawn the
ga4-audience-builderagent. - Print the JSON definition and ask
y/nbefore creating. - Run the script.
Direct commands
| Intent | Command |
| List audiences | python scripts/ga4_admin.py --property X --list-audiences --json |
| Create audience | python scripts/ga4_admin.py --property X --create-audience audience.json --json |
| Archive audience | python scripts/ga4_admin.py --audience-name <full> --archive-audience --json |
Definition shape
{
"display_name": "Cart abandoners (7d)",
"description": "Users who added to cart but did not purchase",
"membership_duration_days": 7,
"filter_clauses": [
{
"clause_type": "INCLUDE",
"simple_filter": {
"scope": "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS",
"filter_expression": {
"event_filter": {"event_name": "add_to_cart"}
}
}
},
{
"clause_type": "EXCLUDE",
"simple_filter": {
"scope": "AUDIENCE_FILTER_SCOPE_ACROSS_ALL_SESSIONS",
"filter_expression": {
"event_filter": {"event_name": "purchase"}
}
}
}
]
}Limits
- 100 audiences per property (400 on GA4 360).
membership_duration_daysmust be ≤ 540.- Up to 14 days of historical backfill on creation.
Useful audience patterns
- Cart abandoners: include
add_to_cart, excludepurchase, 7-day membership - Engaged readers: include
page_viewwith engagement_time_msec > 60000, scope WITHIN_SAME_SESSION - High-value purchasers: include
purchasewherevalue>= threshold, scope ACROSS_ALL_SESSIONS - Inactive in last 30 days: invert via NOT on
session_start, scope ACROSS_ALL_SESSIONS
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.
Build local audience JSON with ga4_audience_templates.py or MCP audience_template: event_participants, event_parameter_threshold, or event_sequence. Membership days do not mean lookback or disengagement. These are public-filter templates, not replicas of undocumented UI lifecycle audiences. Review the definition, then use the existing separate create-audience y/N flow or MCP proposal handoff; never chain writes. See docs/AUDIENCE_TEMPLATES.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.

