Analytics endpoints require a Pro plan subscription or higher.

Referrers data allows you to analyze where your link traffic is coming from, including both the referrer domain and the full referrer URL.

Referrer domain analytics

The top referrers by event count, including referrer names.

import { Dub } from "dub";

export const dub = new Dub({
  token: process.env.DUB_API_KEY,
});

const result = await dub.analytics.retrieve({
  event: "clicks",
  groupBy: "referrers",
  linkId: "clux0rgak00011...",
  interval: "30d",
});

Referrer URL analytics

The top referrer URLs by event count, including full URLs.

import { Dub } from "dub";

export const dub = new Dub({
  token: process.env.DUB_API_KEY,
});

const result = await dub.analytics.retrieve({
  event: "clicks",
  groupBy: "referer_urls",
  linkId: "clux0rgak00011...",
  interval: "30d",
});