Skip to main content
The time series endpoint provides granular analytics data aggregated over customizable time intervals, enabling you to visualize traffic trends and identify patterns.

Endpoint

GET /analytics/redirect/:redirectId/stats/time

Function signature

getHitsOverTime(
  redirectId: string,
  params?: { start?: string; end?: string; interval?: string }
): Promise<AxiosResponse>

Path parameters

redirectId
string
required
The unique identifier of the redirect to retrieve time-series data for

Query parameters

start
string
Start date for the analytics period in ISO 8601 formatExample: 2024-01-01T00:00:00Z
end
string
End date for the analytics period in ISO 8601 formatExample: 2024-01-31T23:59:59Z
interval
string
Time interval for aggregating hits. Determines the granularity of the returned data.Available values:
  • hour - Hourly aggregation
  • day - Daily aggregation (default)
  • week - Weekly aggregation
  • month - Monthly aggregation
Choose an interval appropriate for your date range. For example, use hour for same-day analysis, day for weekly/monthly views, and month for yearly overviews.

Response

The endpoint returns a time-series array with hit counts for each interval:
data
object
meta
object

Example request

import { getHitsOverTime } from '@quickleap/api';

const response = await getHitsOverTime('redirect_abc123', {
  start: '2024-01-01T00:00:00Z',
  end: '2024-01-31T23:59:59Z',
  interval: 'day'
});

const { timeSeries, summary } = response.data.data;

// Plot on a chart
timeSeries.forEach(point => {
  console.log(`${point.timestamp}: ${point.hits} hits`);
});

console.log(`Peak: ${summary.peakHits} hits`);

Example response

{
  "data": {
    "timeSeries": [
      {
        "timestamp": "2024-01-01T00:00:00Z",
        "hits": 1234,
        "uniqueVisitors": 456,
        "botHits": 89,
        "humanHits": 1145
      },
      {
        "timestamp": "2024-01-02T00:00:00Z",
        "hits": 1456,
        "uniqueVisitors": 523,
        "botHits": 102,
        "humanHits": 1354
      },
      {
        "timestamp": "2024-01-03T00:00:00Z",
        "hits": 1678,
        "uniqueVisitors": 601,
        "botHits": 115,
        "humanHits": 1563
      }
    ],
    "summary": {
      "totalHits": 45678,
      "averageHits": 1473.5,
      "peakHits": 3892
    }
  },
  "meta": {
    "redirectId": "redirect_abc123",
    "interval": "day",
    "period": {
      "start": "2024-01-01T00:00:00Z",
      "end": "2024-01-31T23:59:59Z"
    }
  }
}

Use cases

  • Traffic visualization: Create line charts and graphs showing traffic trends
  • Pattern detection: Identify daily, weekly, or seasonal traffic patterns
  • Anomaly detection: Spot unusual spikes or drops in traffic
  • Capacity planning: Predict future traffic based on historical trends
  • Reporting: Generate periodic traffic reports for stakeholders
  • A/B testing: Compare traffic before and after redirect changes

Best practices

  • Match interval to range: Use hourly intervals for short periods (1-7 days), daily for medium periods (1-3 months), and weekly/monthly for longer periods
  • Caching: Time-series data is computationally intensive. Cache results when possible
  • Pagination: For very long date ranges, consider breaking requests into smaller chunks
  • Timezone awareness: All timestamps are in UTC. Convert to local time in your application if needed