Analytics endpoints require a Pro plan subscription or higher.

Device data allows you to analyze how users interact with your links across different devices, browsers, and operating systems.

Device analytics

The top devices by event count, including device 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: "devices",
  linkId: "clux0rgak00011...",
  interval: "30d",
});

Browser analytics

The top browsers by event count, including browser 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: "browsers",
  linkId: "clux0rgak00011...",
  interval: "30d",
});

Operating system analytics

The top operating systems by event count, including OS 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: "os",
  linkId: "clux0rgak00011...",
  interval: "30d",
});