Query Sessions
The session-level counterpart to Query Events, grouping visits rather than individual events. Adds session-only metrics (pageViews, bounceRate, avgSessionSec) that cannot be derived from the event stream. Use this for traffic and engagement reporting, and Query Events for anything keyed on a specific action.
Authorization
Authorization In: header
Path Parameters
ID of the project to query.
Request Body
application/json
Dimension to aggregate by. One row comes back per distinct value. Use date or hour for a time series.
Optional second dimension, giving one row per groupBy × subGroupBy pair.
Metrics to compute for each row. At least one is required.
Start of the window as a YYYY-MM-DD date, inclusive. Interpreted in the project's configured timezone.
End of the window as a YYYY-MM-DD date, inclusive. Interpreted in the project's configured timezone.
Only include sessions from this country name.
Only include sessions from this device type, e.g. mobile.
Only include sessions from this browser, e.g. Chrome.
Only include sessions from this referring domain.
Only include sessions tagged with this utm_source.
Only include sessions tagged with this utm_medium.
Only include sessions tagged with this utm_campaign.
Only include sessions tagged with this utm_term.
Only include sessions tagged with this utm_content.
Only include sessions attributed to this ad ID.
Column to sort by: either groupBy or one of the requested metrics.
Sort direction. Ignored unless orderBy is set.
Number of rows to skip before collecting results.
Maximum number of rows to return.
Response Body
application/json
application/json
application/json
application/json
application/json
curl -X POST "https://www.saasco.com/api/v2/projects/string/analytics/query-sessions" \ -H "Content-Type: application/json" \ -d '{ "groupBy": "projectId", "metrics": [ "users" ] }'{
"meta": [
{
"name": "string",
"type": "string"
}
],
"rows": 0,
"statistics": {
"bytes_read": 0,
"elapsed": 0,
"rows_read": 0
},
"usage": {
"cost": 0,
"duration": 0,
"metricCount": 0
},
"data": [
{
"avgSessionSec": 0,
"bounceRate": 0,
"events": 0,
"groupBy": "string",
"pageViews": 0,
"sessions": 0,
"subGroupBy": "string",
"users": 0
}
]
}{
"code": "BAD_REQUEST",
"message": "Invalid input data",
"issues": []
}{
"code": "UNAUTHORIZED",
"message": "Authorization not provided",
"issues": []
}{
"code": "FORBIDDEN",
"message": "Insufficient access",
"issues": []
}{
"code": "INTERNAL_SERVER_ERROR",
"message": "Internal server error",
"issues": []
}User Events
Returns one user's event history, newest first: the activity timeline for a single person. Events fired before they were identified are stitched in by anonymous ID, so the timeline reaches back past the `identify()` call. Social-proof popup events are excluded. Page through it with `cursor`, which is a row offset: pass the number of rows already received to get the next batch.
Get Funnel Steps
Runs a sequential funnel over the named events and returns the number of users reaching each step. Order is significant: a user counts at step N only if they fired steps 1 through N in the given order within the window. Users are counted by anonymous ID, so the same person on two devices counts twice.