Analytics APIEndpoints

Returns statistics grouped by a query parameter of the page

Returns the same statistics as `POST /sessions/stats`, one item per query parameter of the page URL and value, such as `utm_source` with `facebook`. `query_key` or `query_keys` limit the parameters; without them, every parameter is returned.

POST
/traffic_origin/stats

Authorization

apiToken apiVersion userAgent
X-Api-Token<token>

Access the application and copy your api token, then, just set the header X-Api-Token with it.

In: header

X-Api-Version<token>

The API version to use. Currently supported versions are:

  • v1: The current stable version

A request without this header, or with any other value, is answered by the edge with 404 and {"error_msg":"404 Route Not Found"}.

In: header

User-Agent<token>

A non-empty User-Agent identifying your integration is required. Requests without it are rejected at the edge before reaching the API.

In: header

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/traffic_origin/stats" \  -H "Content-Type: application/json" \  -d '{    "player_id": "64a5c8072e6fd10009828db2",    "start_date": "2026-09-01 00:00:00",    "end_date": "2026-09-30 23:59:59",    "query_key": "utm_campaign",    "video_duration": 3600,    "timezone": "America/Sao_Paulo",    "pitch_time": 300  }'
[  {    "query_key": "utm_campaign",    "grouped_field": "black-friday",    "total_viewed": 200,    "total_viewed_session_uniq": 190,    "total_viewed_device_uniq": 180,    "total_started": 120,    "total_started_session_uniq": 115,    "total_started_device_uniq": 110,    "total_finished": 40,    "total_finished_session_uniq": 38,    "total_finished_device_uniq": 36,    "total_clicked": 50,    "total_clicked_session_uniq": 45,    "total_clicked_device_uniq": 44,    "total_over_pitch": 30,    "total_under_pitch": 10,    "total_conversions": 5,    "overall_conversion_rate": 4.54,    "total_amount_usd": 0,    "total_amount_brl": 98500,    "total_amount_eur": 0,    "engagement_rate": 35,    "over_pitch_rate": 75.25,    "play_rate": 61.11  }]