Skip to main content
Analytics endpoints require a Pro plan subscription or higher.
Location data allows you to analyze how users interact with your links across different geographical locations.

Country analytics

The top countries by event count, including ISO 3166-1 alpha-2 country codes.
import { Pearset } from "pearset";

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

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

City analytics

The top cities by event count, including city names and their corresponding region codes + ISO 3166-1 alpha-2 country codes.
import { Pearset } from "pearset";

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

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

Continent analytics

The top continents by event count, using 2-letter ISO continent codes.
import { Pearset } from "pearset";

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

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

Region analytics

The top regions by event count, including region codes and ISO 3166-1 alpha-2 country codes.
import { Pearset } from "pearset";

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

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