Traffic sources endpoint

GET /api/v1/sites/{site}/sources

Returns traffic sources, channels, and UTM campaign data.

Example request

curl -H "Authorization: Bearer your-token" "https://pageviews.ai/api/v1/sites/{site_id}/sources?from=2026-03-01&to=2026-03-07"

Response

Returns an object with three arrays:

  • sources — Traffic sources by referrer domain. Direct traffic is shown as (direct / none).
  • channels — Traffic grouped by channel type
  • utm — UTM campaign breakdowns with utm_source, utm_medium, and utm_campaign fields

Example response

{
  "data": {
    "sources": [
      { "source": "(direct / none)", "visitors": 312 },
      { "source": "google.com", "visitors": 245 },
      { "source": "twitter.com", "visitors": 87 }
    ],
    "channels": [
      { "source": "Direct", "visitors": 312 },
      { "source": "Search", "visitors": 245 }
    ],
    "utm": [
      { "utm_source": "newsletter", "utm_medium": "email", "utm_campaign": "march-update", "visitors": 56 }
    ]
  }
}