Events & ExportSession group-by aggregates

Session group-by aggregates

Session aggregates grouped by one dimension: session count, engaged count/rate, bounce rate, average duration and pages per group. Accepts the same filters as /sessions, so you can group a filtered set. Ordered by session_count descending. Single dimension only — comma-list multi-dimension group-by is not yet supported.

Segment scoping: pass segment_id to aggregate only the segment's members' sessions — e.g. which campaigns drive engaged sessions from identified customers:

GET /client/v1/data/sessions/breakdown?group_by=utm_campaign&segment_id=9f4e...

curl -X GET "https://mythic-analytics.gulp.workers.dev/client/v1/data/sessions/breakdown?location_id=example_string&date_from=2024-12-25&date_to=2024-12-25&utm_source=example_string&utm_medium=example_string&utm_campaign=example_string&device_type=example_string&browser=example_string&os=example_string&country=USA&landing_page=example_string&engaged=true&bounce=true&is_identified=true&person_id=example_string&distinct_id=example_string&min_duration=42&segment_id=123e4567-e89b-12d3-a456-426614174000&group_by=utm_source&limit=50" \
  -H "Content-Type: application/json" \
  -H "X-Location-Id: example_string" \
  -H "Authorization: Bearer YOUR_API_TOKEN"
{
  "success": true,
  "data": [
    {
      "value": "google",
      "session_count": 1204,
      "engaged_count": 812,
      "engaged_rate": 67.4,
      "bounce_rate": 32.6,
      "avg_duration_seconds": 84.2,
      "avg_pageviews": 2.7
    }
  ],
  "rows": 42
}
GET
/sessions/breakdown
GET
Base URLstring

Target server for requests. Edit to use your own host.

Bearer Token
Bearer Tokenstring
Required

Agency key (ak_) or location secret key (sk_) as a bearer token. Format: Bearer ak_... or Bearer sk_.... Scoped keys (mcp_) are accepted too and need the read scope of the family the route belongs to (people, events, sessions, replays, exceptions, heatmaps or bigquery_export). See Using an mcp_ key over HTTP.

Agency key (ak_) or location secret key (sk_) as a bearer token. Format: Bearer ak_... or Bearer sk_.... Scoped keys (mcp_) are accepted too and need the read scope of the family the route belongs to (people, events, sessions, replays, exceptions, heatmaps or bigquery_export). See Using an mcp_ key over HTTP.
query
location_idstring

Alternative to the X-Location-Id header for agency (ak_) keys. Ignored for secret (sk_) keys.

query
date_fromstring

Start date (YYYY-MM-DD).

Format: date
query
date_tostring

End date (YYYY-MM-DD).

Format: date
query
utm_sourcestring

Filter to sessions with this UTM source. Empty string = "no value set".

query
utm_mediumstring

Filter to sessions with this UTM medium.

query
utm_campaignstring

Filter to sessions with this UTM campaign.

query
device_typestring

Filter to sessions on this device type.

query
browserstring

Filter to sessions on this browser.

query
osstring

Filter to sessions on this operating system.

query
countrystring

Filter to sessions from this country (ISO code).

query
landing_pagestring

Filter to sessions whose entry path matches. Case-insensitive and trailing-slash-insensitive (/About/ matches /about). Query params never apply — the path is captured without them.

query
engagedboolean

Filter by engagement (1/0, or true/false).

query
bounceboolean

Filter by bounce (1/0, or true/false).

query
is_identifiedboolean

Filter to identified (1) or anonymous (0) sessions.

query
person_idstring

Scope to one person's sessions: the canonical person id from the People API (GET /people, GET /people/{personId}). Matches every session whose visitor id belongs to that person in the identity graph (anonymous ids, user ids, emails), so pre-identification sessions are included. Powers per-person Sessions/Recordings tabs on a profile view. Composable with all other filters and the date window; widen date_from for history older than the 30-day default.

query
distinct_idstring

Scope to one person's sessions by any raw identity value (anonymous id, user id, or email). Resolved through the identity graph to the owning person's full identity set — same resolution as GET /people/{personId} — so it returns the same rows as person_id for the same person. A value not in the graph (a never-identified visitor) falls back to an exact distinct_id match. If person_id is also given, both conditions must match (AND) — pass one or the other.

query
min_durationinteger

Minimum session duration in seconds.

query
segment_idstring

Scope results to members of a saved segment (created via the Segments API). Two independent time filters apply: the segment decides WHICH PEOPLE qualify (a live definition, evaluated at query time — not stored membership), and date_from/date_to decides WHICH OF THEIR ROWS are returned. A person who qualifies today contributes all their sessions/events inside the date window — including ones unrelated to how they qualified; there is no "only rows from while they were a member". For first/last attribution scopes membership runs through the identity graph (a row counts when its distinct_id maps to a matching person); a segment with attribution: "session" instead matches visitors directly against the sessions store ("ever had a session that arrived via X"), with no identity-graph dependency. Composable with all other filters. Unknown or foreign id → 404 segment_not_found.

Format: uuid
query
group_bystring
Required

Dimension to group by.

Options: utm_source, utm_medium, utm_campaign, utm_content, utm_term, device_type, browser, os, country, landing_page, exit_page, referring_domain, engaged, bounce, is_identified
query
limitinteger

Max groups. Default 50, min 1, max 1000.

Min: 1 • Max: 1000
header
X-Location-Idstring

Location to scope the request to. Required for agency (ak_) keys on the event routes. Ignored for secret (sk_) keys, which resolve their own location, and not used by /export.

Request Preview
Response

Response will appear here after sending the request

Authentication

header
Authorizationstring
Required

Bearer token. Agency key (ak_) or location secret key (sk_) as a bearer token. Format: Bearer ak_... or Bearer sk_.... Scoped keys (mcp_) are accepted too and need the read scope of the family the route belongs to (people, events, sessions, replays, exceptions, heatmaps or bigquery_export). See Using an mcp_ key over HTTP.

Query Parameters

location_idstring

Alternative to the X-Location-Id header for agency (ak_) keys. Ignored for secret (sk_) keys.

date_fromstring

Start date (YYYY-MM-DD).

date_tostring

End date (YYYY-MM-DD).

utm_sourcestring

Filter to sessions with this UTM source. Empty string = "no value set".

utm_mediumstring

Filter to sessions with this UTM medium.

utm_campaignstring

Filter to sessions with this UTM campaign.

device_typestring

Filter to sessions on this device type.

browserstring

Filter to sessions on this browser.

osstring

Filter to sessions on this operating system.

countrystring

Filter to sessions from this country (ISO code).

landing_pagestring

Filter to sessions whose entry path matches. Case-insensitive and trailing-slash-insensitive (/About/ matches /about). Query params never apply — the path is captured without them.

engagedboolean

Filter by engagement (1/0, or true/false).

bounceboolean

Filter by bounce (1/0, or true/false).

is_identifiedboolean

Filter to identified (1) or anonymous (0) sessions.

person_idstring

Scope to one person's sessions: the canonical person id from the People API (GET /people, GET /people/{personId}). Matches every session whose visitor id belongs to that person in the identity graph (anonymous ids, user ids, emails), so pre-identification sessions are included. Powers per-person Sessions/Recordings tabs on a profile view. Composable with all other filters and the date window; widen date_from for history older than the 30-day default.

distinct_idstring

Scope to one person's sessions by any raw identity value (anonymous id, user id, or email). Resolved through the identity graph to the owning person's full identity set — same resolution as GET /people/{personId} — so it returns the same rows as person_id for the same person. A value not in the graph (a never-identified visitor) falls back to an exact distinct_id match. If person_id is also given, both conditions must match (AND) — pass one or the other.

min_durationinteger

Minimum session duration in seconds.

segment_idstring

Scope results to members of a saved segment (created via the Segments API). Two independent time filters apply: the segment decides WHICH PEOPLE qualify (a live definition, evaluated at query time — not stored membership), and date_from/date_to decides WHICH OF THEIR ROWS are returned. A person who qualifies today contributes all their sessions/events inside the date window — including ones unrelated to how they qualified; there is no "only rows from while they were a member". For first/last attribution scopes membership runs through the identity graph (a row counts when its distinct_id maps to a matching person); a segment with attribution: "session" instead matches visitors directly against the sessions store ("ever had a session that arrived via X"), with no identity-graph dependency. Composable with all other filters. Unknown or foreign id → 404 segment_not_found.

group_bystring
Required

Dimension to group by.

Allowed values:utm_sourceutm_mediumutm_campaignutm_contentutm_termdevice_typebrowseroscountrylanding_pageexit_pagereferring_domainengagedbounceis_identified
limitinteger

Max groups. Default 50, min 1, max 1000.

Headers

X-Location-Idstring

Location to scope the request to. Required for agency (ak_) keys on the event routes. Ignored for secret (sk_) keys, which resolve their own location, and not used by /export.

Responses

successboolean
dataarray
rowsinteger

Number of rows returned.