Skip to main content
Analytics endpoints require a Pro plan subscription or higher.
Dub’s Analytics API allows you to build real-time analytics dashboards for your links that lives directly inside your application.

Fundamentals

At a high level, Dub’s Analytics API allows you to retrieve data about your links by event type and group by different dimensions. Dub’s Analytics API supports the following event types:
  • clicks – the number of clicks on a link
  • leads – the number of leads generated from a link
  • sales – the number of sales generated from a link
Each of these events can be aggregated in different ways by using the groupBy parameter:
The total number of events over the specified time period.Example response:
The number of events over a given time interval, broken down by time periods.Example response:
The top countries by event count, using ISO 3166-1 alpha-2 country codes.Example response:
The top cities by event count, including city names and ISO 3166-1 alpha-2 country codes.Example response:
The top regions by event count, including region codes and ISO 3166-1 alpha-2 country codes.Example response:
The top continents by event count, using 2-letter ISO continent codes.Example response:
The top devices by event count, including device names.Example response:
The top browsers by event count, including browser names.Example response:
The top operating systems by event count, including OS names.Example response:
The top referrers by event count, including referrer names.Example response:
The top referrer URLs by event count, including full URLs.Example response:
The top UTM sources by event count.Example response:
The top UTM mediums by event count.Example response:
The top UTM campaigns by event count.Example response:
The top UTM terms by event count.Example response:
The top UTM contents by event count.Example response:

Example queries

Here are some examples of how to retrieve data using Dub’s Analytics API:

Total event count

Timeseries data

Example apps

With Dub’s Analytics API, you can build user-facing analytics dashboards with the real-time click and conversion data for your links. Here are some open-source examples of how you can use the Analytics API to build your own custom analytics dashboards:

OSS Gallery

Programmatically shorten links and fetch real-time click analytics with Dub

Cap.so

How Cap.so fetches real-time click analytics for their recording links
And here’s another real-world example of a custom analytics dashboard built with the Analytics API:
Assembly link analytics