Overview

The Metrics endpoint provides comprehensive analytics data including time series charts, visitor breakdowns, and aggregated totals. Perfect for building dashboards, generating reports, and analyzing website performance across multiple dimensions.

Get detailed insights into your website traffic with support for custom timeframes, data intervals, timezone-aware calculations, and extensive visitor demographics.

Endpoint

GET https://app.usehardal.com/api/websites/{signalId}/metrics

Authentication

Include your API key in the Authorization header:

Authorization: Bearer YOUR_API_KEY

Parameters

ParameterTypeRequiredDefaultDescription
signalIdstringYes-Your website signal ID (URL path)
timeframestringNotodayTime period: today, yesterday, last7days, last30days, custom
intervalstringNohourlyData granularity: minute, hourly, daily, weekly, monthly
targetSignalIdstringNosignalIdTarget signal ID for analytics data
timezonestringNoUTCTimezone for date calculations (e.g., Asia/Istanbul, America/New_York)
isHybridbooleanNofalseWhether this is a hybrid/self-hosted signal
startDatestringNo-Start date for custom timeframe (ISO format)
endDatestringNo-End date for custom timeframe (ISO format)

Quick Start

Environment Setup

Finding your signal ID: Go to your Hardal dashboard → select your project → view the signal ID in the URL or settings.

Finding your API key: Navigate to your Hardal dashboard → select your signal → Settings → Security → API Keys.

Start with a basic request to get today’s metrics:

Usage Examples

Response Fields

Timeseries Data

Each timeseries object contains:

  • date: Timestamp for the data point (ISO format)
  • pageviews: Number of page views in this time period
  • visitors: Number of unique visitors
  • sessions: Number of unique sessions
  • bounce_rate: Percentage of single-page sessions
  • avg_duration: Average session duration in seconds

Visitor Breakdowns

Countries Array:

  • country: Country name
  • visitors: Number of unique visitors from this country
  • percentage: Percentage of total visitors

Browsers Array:

  • browser: Browser name (Chrome, Safari, Firefox, etc.)
  • visitors: Number of unique visitors using this browser
  • percentage: Percentage of total visitors

Operating Systems Array:

  • os: Operating system name (Windows, macOS, Linux, etc.)
  • visitors: Number of unique visitors using this OS
  • percentage: Percentage of total visitors

Devices Array:

  • device: Device type (Desktop, Mobile, Tablet)
  • visitors: Number of unique visitors using this device
  • percentage: Percentage of total visitors

Content Performance

Pages Array:

  • path: URL path of the page
  • title: Page title
  • pageviews: Number of page views for this page
  • visitors: Number of unique visitors to this page
  • percentage: Percentage of total traffic

Referrers Array:

  • referrer: Referring domain
  • visitors: Number of visitors from this referrer
  • percentage: Percentage of total visitors

Totals Summary

  • pageviews: Total page views in the selected period
  • visitors: Total unique visitors
  • sessions: Total unique sessions
  • bounce_rate: Overall bounce rate percentage
  • avg_duration: Overall average session duration in seconds
  • events: Total number of events (all types)

Timeframe Options

Data Intervals

Best Practices

Usage Notes

  • All timestamps are returned in UTC, but calculations respect the specified timezone
  • Results are limited to top entries (top 10 for most breakdowns, top 50 for countries)
  • Bounce rate calculation: single-page sessions ÷ total sessions × 100
  • Average duration excludes sessions with 0 duration for accuracy
  • Real-time data updates every few minutes for current day metrics
  • Historical data is processed and optimized for faster retrieval