Live Google Analytics 4 data for a property from the last 30 minutes (60 on Analytics 360): active users, events and more by dimension.
curl -X POST "https://api.primaryapi.com/v1/run/google-analytics.realtime_report" \
-H "Authorization: Bearer $PRIMARYAPI_API_KEY" \
-H "Content-Type: application/json" \
-d '{"propertyId":"312345678","dimensions":["country"],"metrics":["activeUsers"]}'{
"output": {
"found": true,
"data": {
"rowCount": 2,
"propertyQuota": null,
"nextCursor": null,
"rows": [
{
"dimensions": { … },
"metrics": { … }
}, …
], …
}
},
"credits": 1
}Input and output
10 fields
312345678.["activeUsers"].["country"].9 fields
Good to know
Runs as your connected Google account. Needs the Read Google Analytics capability.
Only realtime dimensions. Metrics work here (for example country, city, deviceCategory, unifiedScreenName, eventName; activeUsers, eventCount, screenPageViews).
One page of up to 10,000 rows, no paging.
The same key and credits work for every API.