Query your metrics
Ask a precise question of your data — a count, a sum, broken down by day or by campaign — and get back rows scoped to your account.
Analytics queries follow one consistent shape no matter what you're measuring. You name the measures you want (counts, sums), the dimensions to break them down by, an optional time range, and any filters. The query host returns rows. Because your token is scoped to your account, results are automatically restricted to your own data — there's no filter you have to add to keep other accounts' numbers out, and no way to reach them.
Before you begin
- An analytics token. Mint one as described in Authenticate. It's valid for about 5 minutes.
The query format
A query is a JSON object with these fields — all optional except that you need at least one measure or dimension:
| Field | What it does | Example |
|---|---|---|
measures | The numbers to compute (counts, sums). | ["conversions_unified.count"] |
dimensions | Attributes to group rows by. | ["conversions_unified.conversion_status"] |
timeDimensions | A date field plus a granularity (day, week, month) and a dateRange. | see below |
filters | Conditions that narrow the rows. | [{ "member": "…conversion_status", "operator": "equals", "values": ["LOCKED"] }] |
order | Sort order for the result rows. | { "conversions_unified.event_date": "asc" } |
limit / offset | Page through large results. | "limit": 100 |
You pass the query as a URL-encoded query parameter to the load endpoint at
https://cube.paylode.com/cubejs-api/v1/load.
A worked example — conversions per day
This asks: how many conversions did I get per day over the last 30 days?
curl -G https://cube.paylode.com/cubejs-api/v1/load \
-H "Authorization: eyJhbGciOiJIUzI1NiJ9.EXAMPLE_PAYLOAD.EXAMPLE_SIGNATURE" \
--data-urlencode 'query={
"measures": ["conversions_unified.count"],
"timeDimensions": [{
"dimension": "conversions_unified.event_date",
"granularity": "day",
"dateRange": "last 30 days"
}],
"order": { "conversions_unified.event_date": "asc" }
}'
const query = {
measures: ["conversions_unified.count"],
timeDimensions: [
{
dimension: "conversions_unified.event_date",
granularity: "day",
dateRange: "last 30 days",
},
],
order: { "conversions_unified.event_date": "asc" },
};
const url =
"https://cube.paylode.com/cubejs-api/v1/load?query=" +
encodeURIComponent(JSON.stringify(query));
const { data } = await fetch(url, {
headers: { Authorization: token }, // raw token, no "Bearer" prefix
}).then((r) => r.json());
The result is one row per day (trimmed):
{
"data": [
{ "conversions_unified.event_date.day": "2026-05-03T00:00:00.000", "conversions_unified.count": "12" },
{ "conversions_unified.event_date.day": "2026-05-04T00:00:00.000", "conversions_unified.count": "9" },
{ "conversions_unified.event_date.day": "2026-05-05T00:00:00.000", "conversions_unified.count": "15" }
]
}
Measure values come back as strings — parse them to numbers before doing math.
Each row's date field is suffixed with the granularity you asked for
(event_date.day).
To break the same count down another way, add a dimension. For example, group
by conversion status by adding "dimensions": ["conversions_unified.conversion_status"] — you'll get one row per (day,
status) pair.
Pass the token in Authorization without a Bearer prefix — see
Authenticate.
Discover what's available
Each metric belongs to a named view (like conversions_unified), and each view
offers its own measures and dimensions. To see everything your token can
query, call the meta endpoint:
curl https://cube.paylode.com/cubejs-api/v1/meta \
-H "Authorization: eyJhbGciOiJIUzI1NiJ9.EXAMPLE_PAYLOAD.EXAMPLE_SIGNATURE"
The response lists every view visible to your account with its measures and
dimensions — names, types, and titles. It's the authoritative catalog: when
you wonder "can I group conversions by that?", /meta answers it. Any member
you see there can go straight into a query's measures, dimensions, or
filters.
Product-focused walkthroughs of the most useful views:
- Measure your perk pages — page views, clicks, and conversions for your perk pages.
- Boost performance — teasers, deliveries, clicks, and business value per campaign.
For the token endpoint schema and the analytics query host, see the API Reference.