Skip to main content

Use cases

KPI visualization

Visualize key performance indicators.

In-product metrics

Display metrics within your product.

Alerts and triggers

Power alerts and automated workflows.

Product usage emails

Send key metrics via email.

Features

All the common API features.

Example

Example 1: Simple counter query

Get the total taco sales for the last year, filtered by the restaurant name.

Usage

Arguments

The fields for querying a Metric in counter format. A Metric’s counter query returns a single value over a given time range.
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.
TimeRangeInput
The time range for calculating the counter.
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”.
String
The Query Filters to apply before retrieving the counter data, in the form of SQL. If no Query Filters are provided, all data is included.

Response

The counter response object. It contains a single Metric value for the given time range and Query Filters.
String
The value of the counter.
QueryInfo
required
The Query statistics and metadata.

Embeddable UI components

Counter component

A React component to visualize a counter value.

useCounter

A React Hook for fetching a single aggregated value from the Counter API.