Use cases

Leaderboard visualization

Visualize leaderboard data in your apps.


Aggregated tables

Display aggregated data in tables.


Features

All the common API features, plus:

Example

Example 1: Simple leaderboard query

Get top 3 restaurants by total taco sales for the current year.

Usage

Arguments

The fields for querying a Metric in leaderboard format.

A Metric’s leaderboard query returns an ordered table of Dimension and Metric values over a given time range.

metric
MetricInput

The Metric to query. You can query a pre-configured Metric by ID or name, or you can query an ad hoc Metric that you define inline.

timeRange
TimeRangeInput

The time range for calculating the leaderboard.

timeZone
String

The time zone to use. Dates and times are always returned in UTC, but setting the time zone influences relative time ranges and granularities.

You can set this to “America/Los_Angeles”, “Europe/Berlin”, or any other value in the IANA time zone database. Defaults to “UTC”.

dimensions
[DimensionInput!]
required

One or many Dimensions to group the Metric values by. Typically, Dimensions in a leaderboard are what you want to compare and rank.

sort
Sort

The sort order of the rows. It can be ascending (ASC) or descending (DESC) order. Defaults to descending (DESC) order when not provided.

rowLimit
Int
required

The number of rows to be returned. It can be a number between 1 and 1,000.

filterSql
String

The Query Filters to apply before retrieving the leaderboard data, in the form of SQL. If no Query Filters are provided, all data is included.

Response

The leaderboard response object. It contains an array of headers and a table (array of rows) with the selected Dimensions and corresponding Metric values for the given time range and Query Filters.

headers
[String!]
required

The table headers. It contains the Dimension and Metric names.

rows
[[String]!]
required

An ordered array of rows. Each row contains the Dimension values and the corresponding Metric value. A Dimension value can be empty. A Metric value will never be empty.

query
QueryInfo
required

The Query statistics and metadata.

Embeddable UI components