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

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'.

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
  1. Very specific:

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

    line 79

≈ “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: 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

  1. Verify auth.
  2. For proposals based on observed funnel drop-off, spawn the ga4-audience-builder agent.
  3. Print the JSON definition and ask y/n before creating.
  4. Run the script.

Direct commands

IntentCommand
List audiencespython scripts/ga4_admin.py --property X --list-audiences --json
Create audiencepython scripts/ga4_admin.py --property X --create-audience audience.json --json
Archive audiencepython 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_days must be ≤ 540.
  • Up to 14 days of historical backfill on creation.

Useful audience patterns

  • Cart abandoners: include add_to_cart, exclude purchase, 7-day membership
  • Engaged readers: include page_view with engagement_time_msec > 60000, scope WITHIN_SAME_SESSION
  • High-value purchasers: include purchase where value >= 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.

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.