DataDad.

Stats API reference

Every stats API endpoint, its parameters and its response. Summary, time series, breakdowns, realtime visitors and the list of tenants.

Updated

The base URL is https://data.dad/api/v1. Every request needs the header Authorization: Bearer <key>. The Analytics API guide explains keys, periods, errors and limits.

All stats endpoints take these parameters:

ParameterValue
tenantOne tenant, such as a profile ID. Leave it out for the whole app. See per-user analytics.
rangeA period, such as 7d or 30d. The default is 30d.
from, toDates as YYYY-MM-DD, instead of range.

Summary

GET /stats/summary gives the totals for the period and for the previous period of the same length.

{
  "tenant": "p_123",
  "range": { "from": 1791158400, "to": 1791763200, "previous_from": 1790553600, "previous_to": 1791158400 },
  "visitors": 412, "pageviews": 530, "link_clicks": 221,
  "visits": 455, "bounce_rate": 0.62, "visit_duration": 34.5,
  "previous": { "visitors": 380, "pageviews": 498, "link_clicks": 190, "visits": 401, "bounce_rate": 0.6, "visit_duration": 31 }
}
FieldMeaning
visitorsUnique visitors. One person counts once a day.
pageviewsPage views.
link_clicksClicks on links to other sites. The script counts them when its tag has data-outbound.
visitsVisits that ended at least 30 minutes ago.
bounce_rateThe share of visits with one page view, from 0 to 1. null when there are no visits.
visit_durationThe average visible time of a visit, in seconds. null when it was not measured.

Time series

GET /stats/timeseries gives one point for each hour, day, week or month. Points with no traffic have zeros.

ParameterValue
intervalhour, day, week or month. By default: hour up to 2 days, day up to 90 days, week up to 1 year, otherwise month. A response has at most 1,500 points.
{
  "tenant": "p_123", "interval": "day",
  "range": { "from": 1791158400, "to": 1791763200, "previous_from": 1790553600, "previous_to": 1791158400 },
  "points": [
    { "t": 1791158400, "visitors": 51, "pageviews": 66, "link_clicks": 30 },
    { "t": 1791244800, "visitors": 63, "pageviews": 80, "link_clicks": 29 }
  ]
}

t is the start of the bucket in Unix seconds. Weeks start on Monday.

Breakdown

GET /stats/breakdown gives the top values of one dimension, sorted by visitors.

ParameterValue
bypage, source, referrer, utm_source, utm_medium, utm_campaign, country, region, city, device, browser, os, goal or link
limit1 to 100. The default is 10.
{ "tenant": "p_123", "by": "source", "range": { "from": 1791158400, "to": 1791763200, "previous_from": 1790553600, "previous_to": 1791158400 },
  "rows": [ { "value": "instagram.com", "visitors": 210, "pageviews": 251 }, { "value": "direct", "visitors": 96, "pageviews": 130 } ] }

country values are ISO 3166-1 codes, such as DE. With by=goal, rows have conversions instead of pageviews. With by=link, rows are sorted by clicks:

{ "by": "link", "rows": [ { "value": "lnk_42", "url": "https://open.spotify.com/artist/1", "clicks": 412, "visitors": 388 } ] }

value is the link's data-dd-link name, or its address when the link has no name. Addresses have no query string.

Realtime

GET /stats/realtime gives the number of visitors in the last 5 minutes.

{ "tenant": "p_123", "window_seconds": 300, "visitors": 4 }

Tenants

GET /tenants lists the tenants of a platform that had visits in the period, sorted by visitors.

ParameterValue
limit1 to 100. The default is 10.
offsetThe number of tenants to skip, for the next page.
{
  "range": { "from": 1789430400, "to": 1792022400, "previous_from": 1786838400, "previous_to": 1789430400 },
  "total": 1240, "limit": 10, "offset": 0,
  "tenants": [ { "tenant": "p_123", "visitors": 412, "pageviews": 530, "link_clicks": 221 } ]
}

total is the number of tenants with visits in the period.