Google Analytics
API actions for the Google Analytics integration.
Google Analytics
Measure traffic and engagement across your web properties.
Get engagement overview
Get daily engagement metrics including users, page views, and engagement duration.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
property_id | string | Yes | Google Analytics property ID (e.g., '123456789' or 'properties/123456789') |
start_date | string | Yes | Start date for the report (e.g., '2024-01-01' or '7daysAgo') |
end_date | string | Yes | End date for the report (e.g., '2024-01-31' or 'today') |
Response
{
"metadata": {
"dimensions": [
"date"
],
"metrics": [
"totalUsers",
"screenPageViews",
"userEngagementDuration"
]
},
"rowCount": 7,
"rows": [
{
"date": "20240115",
"screenPageViews": "5000",
"totalUsers": "1000",
"userEngagementDuration": "36000"
}
]
}Get event counts
Get event counts grouped by event name for a date range.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
property_id | string | Yes | Google Analytics property ID (e.g., '123456789' or 'properties/123456789') |
start_date | string | Yes | Start date for the report (e.g., '2024-01-01' or '7daysAgo') |
end_date | string | Yes | End date for the report (e.g., '2024-01-31' or 'today') |
Response
{
"metadata": {
"dimensions": [
"eventName"
],
"metrics": [
"eventCount"
]
},
"rowCount": 3,
"rows": [
{
"eventCount": "10000",
"eventName": "page_view"
},
{
"eventCount": "5000",
"eventName": "scroll"
},
{
"eventCount": "2500",
"eventName": "click"
}
]
}Get realtime active users
Get the current number of active users on the property in real-time.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
property_id | string | Yes | Google Analytics property ID (e.g., '123456789' or 'properties/123456789') |
Response
{
"metadata": {
"dimensions": [],
"metrics": [
"activeUsers"
]
},
"rowCount": 1,
"rows": [
{
"activeUsers": "42"
}
]
}Run custom report
Run a custom Google Analytics report with specified dimensions and metrics.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
property_id | string | Yes | Google Analytics property ID (e.g., '123456789' or 'properties/123456789') |
dimensions | array | Yes | List of dimension names to include in the report (e.g., ['country', 'city']) |
metrics | array | Yes | List of metric names to include in the report (e.g., ['sessions', 'activeUsers']) |
start_date | string | Yes | Start date for the report (e.g., '2024-01-01' or '7daysAgo') |
end_date | string | Yes | End date for the report (e.g., '2024-01-31' or 'today') |
limit | number | No | Maximum number of rows to return |
Response
{
"metadata": {
"dimensions": [
"country"
],
"metrics": [
"sessions"
]
},
"rowCount": 2,
"rows": [
{
"country": "United States",
"sessions": "1234"
},
{
"country": "Canada",
"sessions": "567"
}
]
}Get sessions by country
Get session counts grouped by country for a date range.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
property_id | string | Yes | Google Analytics property ID (e.g., '123456789' or 'properties/123456789') |
start_date | string | Yes | Start date for the report (e.g., '2024-01-01' or '7daysAgo') |
end_date | string | Yes | End date for the report (e.g., '2024-01-31' or 'today') |
Response
{
"metadata": {
"dimensions": [
"country"
],
"metrics": [
"sessions"
]
},
"rowCount": 3,
"rows": [
{
"country": "United States",
"sessions": "5000"
},
{
"country": "United Kingdom",
"sessions": "2500"
},
{
"country": "Canada",
"sessions": "1200"
}
]
}Get top pages
Get the top pages by page views for a date range.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
property_id | string | Yes | Google Analytics property ID (e.g., '123456789' or 'properties/123456789') |
start_date | string | Yes | Start date for the report (e.g., '2024-01-01' or '7daysAgo') |
end_date | string | Yes | End date for the report (e.g., '2024-01-31' or 'today') |
limit | number | No | Maximum number of pages to return (default: 10) |
Response
{
"metadata": {
"dimensions": [
"pagePath"
],
"metrics": [
"screenPageViews"
]
},
"rowCount": 3,
"rows": [
{
"pagePath": "/",
"screenPageViews": "5000"
},
{
"pagePath": "/about",
"screenPageViews": "2500"
},
{
"pagePath": "/contact",
"screenPageViews": "1200"
}
]
}