New Date Range Picker for custom date ranges

New Date Range Picker for custom date ranges

We've added a new Date Range Picker to our Analytics dashboard to make it easier to select custom date ranges for your reports.

You can select from a few preset date ranges like "Last 30 days", "Last 3 months", "Year to Date", or choose a custom date range. Here's a live demo for you to try it out.

This is also supported in our API via the start and end query parameters. Here's an example:

get-analytics.ts
import { Dub } from "dub";
 
const dub = new Dub();
 
const data = await dub.analytics.retrieve({
  groupBy: "timeseries",
  start: "5 days ago", // natural language is supported
  end: new Date(Date.now()),
});
 
console.log(data); // [{ start: "2024-05-17", clicks: 69 }, { start: "2024-05-18", clicks: 42 }, ...]

Check out the docs to learn more.