Pull current-session / active-user data from the GA4 Realtime endpoint — a separate API surface from runReport with different metrics, dimensions, and freshness guarantees (~30 min rolling window…

MITAuto-check passed

Install Ga4 Realtime API

skills CLI
$ npx skills add jeremylongshore/tons-of-skills-marketplace --skill ga4-realtime-api -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install jeremylongshore/tons-of-skills-marketplace ga4-realtime-api --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/jeremylongshore/tons-of-skills-marketplace.git skills-src && mkdir -p .claude/skills && cp -r skills-src/skills/.curated/ga4-realtime-api .claude/skills/ga4-realtime-api && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
ga4-realtime-api
GitHub stars
2.8k
Token cost
~1.8k tokens
SKILL.md length
654 words
Files
1
Skills in repo
3,342
Repo updated
First seen
Licence
MIT

At a glance

Pull current-session / active-user data from the GA4 Realtime endpoint — a separate API surface from runReport with different metrics, dimensions, and freshness guarantees (~30 min rolling window…

  • With GA4 realtime
  • SKILL.md covers Overview, Prerequisites, Instructions and Examples, plus 10 more sections
  • Instructions only: no scripts, shell commands, URLs or credentials in SKILL.md
  • Active users right now

What it does

Ga4 Realtime API is an agent skill from jeremylongshore/tons-of-skills-marketplace. Pull current-session / active-user data from the GA4 Realtime endpoint — a separate API surface from runReport with different metrics, dimensions, and freshness guarantees (~30 min rolling window instead of T-48h). Trigger with "GA4 realtime", "active users right now", "GA4 current sessions", "who's on my site now".

Its SKILL.md is about 1.8k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts. Compatibility notes: Designed for Claude Code

It works with Google Analytics. The repository describes itself as: Model-agnostic agent-skills platform with a harness-free canonical layer, verified adapters, and the ccpi package manager. Explore at tonsofskills.com. The licence is MIT.

When your agent uses it

  • With GA4 realtime
  • Active users right now
  • GA4 current sessions
  • Whos on my site now

Example prompts

  • “GA4 realtime”
  • “active users right now”
  • “GA4 current sessions”
  • “/ga4-realtime-api”

Requirements

  • Python 3
  • Compatibility (from SKILL.md): Designed for Claude Code
  • Pre-approved tools (allowed-tools): Bash(python3:*), Bash(curl:*)

What it can do on your machine

Read from SKILL.md and the folder at commit cfae287. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(python3:*)
    • Bash(curl:*)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    No scripts in the folder and no shell commands in SKILL.md (its code samples are python).

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    Links to these hosts (documentation or services it may open):

    • developers.google.com

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

  • Compatibility

    Designed for Claude Code

    From compatibility in the SKILL.md frontmatter.

Context cost

Ga4 Realtime API loads about 1.8k tokens when it runs. Until then it costs about 84 tokens; SKILL.md has 654 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~84
When it runs · the whole SKILL.md, loaded when a task matches
~1.8k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from jeremylongshore/tons-of-skills-marketplace at commit cfae287, republished under its MIT licence (© jeremylongshore). 654 words, ~1,776 tokens.

Download SKILL.mdSave it as .claude/skills/ga4-realtime-api/SKILL.md (or your agent's skills folder).
name
ga4-realtime-api
description
Pull current-session / active-user data from the GA4 Realtime endpoint — a separate API surface from runReport with different metrics, dimensions, and freshness guarantees (~30 min rolling window instead of T-48h). Trigger with "GA4 realtime", "active users right now", "GA4 current sessions", "who's on my site now".
allowed-tools
Bash(python3:*), Bash(curl:*)
compatibility
Designed for Claude Code
version
1.3.0
license
MIT
author
Jeremy Longshore <jeremy@intentsolutions.io>
tags
saas, analytics, google-analytics, ga4, realtime

GA4 Realtime API

Overview

The Realtime API is GA4's "what's happening right now" endpoint. Different from runReport:

runReport (Data API)runRealtimeReport (Realtime)
Freshness~24-48h lag, stableLast ~30 min, rolling
WindowAny date rangeImplicit — last 30 min
Metrics~50 supported~10 supported (subset)
Dimensions~150 supported~15 supported (subset)
QuotaPer-property dailySeparate Realtime quota
Use caseReports, dashboards, trend analysisLive dashboards, monitoring, "are we down?"

Don't try to use runReport for now-data — its freshest data point is yesterday. Use runRealtimeReport.

Prerequisites

  • A GA4 Data API credential with access to the target property, configured through ga4-auth-setup.
  • Python with google-analytics-data installed.
  • A numeric property ID; realtime data is inherently a rolling, roughly 30-minute view and is not a replacement for historical reporting.

Instructions

Examples

Minimum viable call

python
from google.analytics.data_v1beta import BetaAnalyticsDataClient
from google.analytics.data_v1beta.types import (
    RunRealtimeReportRequest, Metric, Dimension,
)

client = BetaAnalyticsDataClient()
resp = client.run_realtime_report(RunRealtimeReportRequest(
    property="properties/123456789",
    metrics=[Metric(name="activeUsers")],
))

# Single-row response when there are no dimensions
total = int(resp.rows[0].metric_values[0].value) if resp.rows else 0
print(f"Active users right now: {total}")

No date_ranges block — the implicit window is the last 30 min. Adding one will error.

Realtime metrics (the full list)

MetricWhat it counts
activeUsersUnique users in the last 30 min
screenPageViewsPageviews + screenviews in the last 30 min
eventCountTotal events in the last 30 min
conversionsConversion events in the last 30 min
keyEventsKey events (post-2024 rename of conversions)

Custom-event aggregates (e.g. purchase_revenue) are NOT in the Realtime API. If you need realtime revenue, derive it from eventCount filtered to eventName=="purchase" plus your average AOV.

Realtime dimensions (the full list)

DimensionUse
country, cityGeo of currently-active users
deviceCategorydesktop / mobile / tablet split
unifiedScreenName / unifiedScreenClassApp screen / web title
eventNameEvent-type breakdown
streamId, streamNameWhen property has multiple data streams (web + iOS + Android)
platformweb / ios / android
appVersion, audienceName, audienceIdWhen defined in the property

That's the full list. ~15 dims total. Compare to runReport's ~150.

Common realtime queries

"How many people are on my site right now?"
python
resp = client.run_realtime_report(RunRealtimeReportRequest(
    property="properties/123456789",
    metrics=[Metric(name="activeUsers")],
))
print(int(resp.rows[0].metric_values[0].value) if resp.rows else 0)
"Active users by country, right now"
python
resp = client.run_realtime_report(RunRealtimeReportRequest(
    property="properties/123456789",
    metrics=[Metric(name="activeUsers")],
    dimensions=[Dimension(name="country")],
    limit=20,
))
for r in resp.rows:
    print(f"{r.dimension_values[0].value:25s} {r.metric_values[0].value}")
"Which events are firing in the last 30 min?"
python
resp = client.run_realtime_report(RunRealtimeReportRequest(
    property="properties/123456789",
    metrics=[Metric(name="eventCount")],
    dimensions=[Dimension(name="eventName")],
    limit=30,
))

This is the live event firehose — useful to verify a new tracking deployment is actually firing.

"Top pages right now"
python
resp = client.run_realtime_report(RunRealtimeReportRequest(
    property="properties/123456789",
    metrics=[Metric(name="screenPageViews")],
    dimensions=[Dimension(name="unifiedScreenName")],   # NOT pagePath — that's Data-API-only
    limit=20,
))

Realtime doesn't expose pagePath directly. Use unifiedScreenName (the page title) or unifiedScreenClass. To get path-level granularity in realtime, push a custom event with the path as a parameter, then query by eventName + that custom dimension.

Filters

Same shape as runReport — FilterExpression / Filter blocks. Realtime supports dimension_filter and metric_filter but not the full set of dimensions / metrics; check the Realtime API schema before writing complex filters.

Show full SKILL.md (264 more words)Show less

Quotas — different from Data API

Realtime has its own quota bucket. Defaults (2026):

  • 5,000 requests per project per day
  • 250 requests per property per day
  • 60 requests per minute per property

For a live dashboard polling every 10s: that's 6 RPM, well within limits. For a hot incident where you want minute-by-minute data, you can poll up to 60x/min per property.

Don't poll faster than 30s

The data window is the last 30 min. Polling faster than ~30s wastes quota without meaningful resolution change. For most "live" use cases, 60s polling is plenty.

Output

The API returns the current rolling-window aggregate or a bounded set of dimension rows, such as active users by country or event count by name. A valid empty rows list means no currently reportable activity, so callers should render zero rather than treat it as a transport failure.

Error Handling

IssueWhy
activeUsers doesn't match the GA4 web UI's "Realtime" overviewThe UI uses a slightly different window (~5 min default) and may include in-flight events not yet reportable via API. Web UI > API for instant-incidents.
Empty rows on a busy siteProperty may be using a different stream you didn't filter for. Add Dimension(name="streamId") to see splits.
400 INVALID_ARGUMENT: Realtime reports do not support dimension XUsing a Data-API-only dimension (e.g. pagePath, sessionSource). Use a Realtime dimension.
Latency between front-end event and Realtime visibility~10-30 seconds is normal. If >2 minutes, check the GA4 DebugView for event delivery issues.

Resources

  • ga4-auth-setup — prerequisite
  • ga4-data-api-query — for any window longer than 30 min
  • ga4-common-reports — for canonical reports (DAU/MAU/retention) which are NOT realtime-able

© jeremylongshore, MIT. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in skills/.curated/ga4-realtime-api of jeremylongshore/tons-of-skills-marketplace.

Open the folder on GitHubat commit cfae287

Compare with similar skills

Ga4 Realtime API next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Ga4 Realtime API compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Ga4 Realtime API this skilljeremylongshore/tons-of-skills-marketplace2.8k—~1.8kAutomated safety check: PassMIT
Google SEO APIsAgriciDaniel/claude-seo19k1 repos~4.2kAutomated safety check: PassMIT
AnalyticsNexus-JPF/note-companion8707 repos~2.2kAutomated safety check: PassMIT
Blog GoogleAgriciDaniel/claude-blog2.3k1 repos~3.3kAutomated safety check: NotesMIT
SEO GoogleAgriciDaniel/codex-seo7992 repos~3.4kAutomated safety check: PassMIT
C15tc15t/c15t1.9k1 repos~1.6kAutomated safety check: PassApache-2.0

Similar skills

  • Google SEO APIs

    AgriciDaniel/claude-seo

    Pulls real Google data for SEO work: Search Console, PageSpeed Insights, CrUX field data, the Indexing API and GA4 organic traffic, through /seo google commands.

    19k GitHub starsUsed in 1 repo~4.2k tokens
    Marketing & SEOAuto-check passed
  • Analytics

    Nexus-JPF/note-companion

    When the user wants to set up, improve, or audit analytics tracking and measurement.

    870 GitHub starsUsed in 7 repos~2.2k tokens
    Marketing & SEOAuto-check passed
  • Blog Google

    AgriciDaniel/claude-blog

    Google API integration for blog performance: PageSpeed Insights, CrUX Core Web Vitals with 25-week history, Search Console performance, URL Inspection, Indexing API, GA4 organic traffic, NLP entity…

    2.3k GitHub starsUsed in 1 repo~3.3k tokens
    Marketing & SEOAuto-check: notes
  • SEO Google

    AgriciDaniel/codex-seo

    Google SEO APIs: Search Console (Search Analytics, URL Inspection, Sitemaps), PageSpeed Insights v5, CrUX field data with 25-week history, Indexing API v3, and GA4 organic traffic.

    799 GitHub starsUsed in 2 repos~3.4k tokens
    Frontend & DesignAuto-check passed
  • C15t

    c15t/c15t

    Work with c15t consent management docs, APIs, and integrations for Next.js, React, and JavaScript.

    1.9k GitHub starsUsed in 1 repo~1.6k tokens
    Legal & ComplianceAuto-check passed
  • AI Visibility

    Ryze-AI-Adgent/open-seo-mcp-skills

    Measure real AI-engine visibility — traffic from ChatGPT, Perplexity, Claude, Gemini and which pages they cite — from actual GA4 referral data, not prompt sampling.

    4.7k GitHub stars~611 tokensUpdated 17 days ago
    Marketing & SEOAuto-check passed

More from jeremylongshore/tons-of-skills-marketplace

All 3,342 skills in this repo
  • Performing Security Code Review

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to conduct a security-focused code review using the security-agent plugin.

    2.8k GitHub starsUsed in 2 repos~1.3k tokens
    Auto-check: notes
  • Adapting Transfer Learning Models

    jeremylongshore/tons-of-skills-marketplace

    Build this skill automates the adaptation of pre-trained machine learning models using transfer learning techniques.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Agent Context Loader

    jeremylongshore/tons-of-skills-marketplace

    Execute proactive auto-loading: automatically detects and loads agents.md files.

    2.8k GitHub stars~1.1k tokensUpdated today
    Auto-check passed
  • Aggregating Performance Metrics

    jeremylongshore/tons-of-skills-marketplace

    Aggregate and centralize performance metrics from applications, systems, databases, caches, and services.

    2.8k GitHub stars~1.2k tokensUpdated today
    Auto-check passed
  • Analyzing Capacity Planning

    jeremylongshore/tons-of-skills-marketplace

    Execute this skill enables AI assistant to analyze capacity requirements and plan for future growth.

    2.8k GitHub stars~947 tokensUpdated today
    Auto-check passed
  • Analyzing Database Indexes

    jeremylongshore/tons-of-skills-marketplace

    Process use when you need to work with database indexing. An agent skill from jeremylongshore/tons-of-skills-marketplace.

    2.8k GitHub stars~2k tokensUpdated today
    Auto-check passed

Questions about Ga4 Realtime API

What does Ga4 Realtime API do?

Pull current-session / active-user data from the GA4 Realtime endpoint — a separate API surface from runReport with different metrics, dimensions, and freshness guarantees (~30 min rolling window…. Ga4 Realtime API is an agent skill from jeremylongshore/tons-of-skills-marketplace. Pull current-session / active-user data from the GA4 Realtime endpoint — a separate API surface from runReport with different metrics, dimensions, and freshness guarantees (~30 min rolling window instead of T-48h).

When should I use Ga4 Realtime API?

Ga4 Realtime API fits situations like: with GA4 realtime; active users right now; GA4 current sessions; whos on my site now.

How do I install Ga4 Realtime API in Claude Code?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill ga4-realtime-api -a claude-code`. Or copy the skill folder (skills/.curated/ga4-realtime-api in jeremylongshore/tons-of-skills-marketplace) into .claude/skills/ga4-realtime-api in your project. Claude Code loads it when a task matches its description.

How do I install Ga4 Realtime API in Codex?

Run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill ga4-realtime-api -a codex`. Or copy the skill folder (skills/.curated/ga4-realtime-api in jeremylongshore/tons-of-skills-marketplace) into .agents/skills/ga4-realtime-api in your project. Codex loads it when a task matches its description.

Can I use Ga4 Realtime API in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add jeremylongshore/tons-of-skills-marketplace --skill ga4-realtime-api -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/ga4-realtime-api, .gemini/skills/ga4-realtime-api, .github/skills/ga4-realtime-api and .opencode/skills/ga4-realtime-api in your project.

What does Ga4 Realtime API need to run?

SKILL.md names no scripts, command-line tools or credentials: Ga4 Realtime API is instructions for the agent only. Our summary lists: Python 3. Its frontmatter pre-approves these tools: Bash(python3:*), Bash(curl:*). Compatibility (from SKILL.md): Designed for Claude Code.

Does Ga4 Realtime API access the network?

SKILL.md names 1 domain. As links in the text: developers.google.com. This is read from the text; nothing was executed.

Is Ga4 Realtime API safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Ga4 Realtime API use?

Ga4 Realtime API is published under the MIT licence (declared in SKILL.md). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Ga4 Realtime API use?

About 1.8k tokens (SKILL.md is roughly 7.1k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Ga4 Realtime API?

Skills that share tags, products or a category with Ga4 Realtime API: Google SEO APIs (AgriciDaniel/claude-seo, 19k stars), Analytics (Nexus-JPF/note-companion, 870 stars), Blog Google (AgriciDaniel/claude-blog, 2.3k stars) and SEO Google (AgriciDaniel/codex-seo, 799 stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Ga4 Realtime API?

jeremylongshore (a GitHub user) maintains it in jeremylongshore/tons-of-skills-marketplace, which has 2,827 GitHub stars. The repository holds 3,342 skills in this directory. The repository was last updated on October 10, 2026.

Source: jeremylongshore/tons-of-skills-marketplace on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.