Introduction to link analytics
📝
Analytics endpoints require a Pro plan subscription or higher.
RevRoute’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, RevRoute’s Analytics API allows you to retrieve data about your links by event type and group by different dimensions.
RevRoute’s Analytics API supports the following event types:
clicks– the number of clicks on a linkleads– the number of leads generated from a linksales– the number of sales generated from a link
Each of these events can be aggregated in different ways by using the groupBy parameter:
Example queries
Here are some examples of how to retrieve data using RevRoute’s Analytics API:
Total event count
import { RevRoute } from "dub";
export const dub = new RevRoute({
token: process.env.REVROUTE_API_KEY,
});
const result = await dub.analytics.retrieve({
event: "clicks",
groupBy: "count",
linkId: "clux0rgak00011...",
interval: "30d",
});Timeseries data
import { RevRoute } from "dub";
export const dub = new RevRoute({
token: process.env.REVROUTE_API_KEY,
});
const result = await dub.analytics.retrieve({
event: "clicks",
groupBy: "timeseries",
linkId: "clux0rgak00011...",
interval: "30d",
});Top links by event
import { RevRoute } from "dub";
export const dub = new RevRoute({
token: process.env.REVROUTE_API_KEY,
});
const result = await dub.analytics.retrieve({
event: "clicks",
groupBy: "top_links",
linkId: "clux0rgak00011...",
interval: "30d",
});Last updated on