Query Live Ingest connected users
Query the connectedUsersMetrics dataset of the GraphQL API for the unique sessions of your Live Ingest streams, per host or as a total across hosts.
You can count the unique sessions connected to your Live Ingest streams with the connectedUsersMetrics dataset of the GraphQL API, per host or as a total across all hosts. The dataset holds aggregated data that Live Ingest provides, and the metrics endpoint, https://api.azion.com/v4/metrics/graphql, serves it. Use the results to review audience activity, or move them to another platform for analysis.
Prerequisites
- A Live Ingest subscription on your account. For what Live Ingest does, refer to Connectors.
- A personal token for your account.
- A way to send a GraphQL query, such as GraphiQL or
curl. For more information, refer to GraphQL API quickstart.
Query unique sessions by host
Group the rows by ts and host to read the unique sessions of each host at each timestamp. To query the sessions by host:
This query reads the sessions of every host in a one-day window, newest first. Replace the begin and end values with your window:
The query uses these arguments:
| Argument | What it sets |
|---|---|
limit | The maximum number of rows to return, from 0 to 10000. Without it, the API returns at most 10 rows. |
filter | The criteria the rows must match. A time filter is required. tsRange takes a begin and an end timestamp in the format "YYYY-MM-DDTHH:mm:ss". |
groupBy | The fields that group the rows: ts, host, or both. [ts,host] returns one row per timestamp and host. |
orderBy | The sort order of the rows. [ts_DESC] returns the newest timestamp first, [ts_ASC] the oldest first. |
The connectedUsersMetrics dataset does not take the resample argument.
Send the query in a POST request to https://api.azion.com/v4/metrics/graphql, with the header Authorization: Token [TOKEN VALUE].
The response holds one object per timestamp and host in data.connectedUsersMetrics, with the fields the query selects:
| Field | Type | Description |
|---|---|---|
ts | CustomDateTime | The timestamp of the data point. |
host | String | The host of the request: the host name from the request line, the host name from the Host request header, or the server name that matches the request. |
uniqueSessions | Int | The unique sessions counted for the host. |
The API answers with HTTP 200 and returns the rows in data.connectedUsersMetrics.
Query the total across hosts
The uniqueSessionsTotal field counts the unique sessions across all hosts, so the query groups the rows by ts alone and leaves host out. To query the total sessions:
This query reads the total sessions in a one-day window, newest first. Replace the begin and end values with your window:
limit takes up to 10000 rows, filter requires a time filter such as tsRange, and orderBy takes [ts_DESC] or [ts_ASC]. groupBy: [ts] returns one row per timestamp.
Send the query in a POST request to https://api.azion.com/v4/metrics/graphql, with the header Authorization: Token [TOKEN VALUE].
The response holds one object per timestamp in data.connectedUsersMetrics, with the fields the query selects:
| Field | Type | Description |
|---|---|---|
ts | CustomDateTime | The timestamp of the data point. |
uniqueSessionsTotal | Int | The unique sessions counted across all hosts. |
The API answers with HTTP 200 and returns the rows in data.connectedUsersMetrics.