Skip to main content
GET
/
sites
/
{id}
/
analytics
Typescript (SDK)
import { Crevio } from "@crevio/sdk";

const crevio = new Crevio({
  apiKey: process.env["CREVIO_API_KEY"] ?? "",
});

async function run() {
  const result = await crevio.sites.analytics({
    id: "<id>",
  });

  console.log(result);
}

run();
{
  "object": "site_analytics",
  "site_id": "site_ExD8Y6PWw0xJrfD9QKVgvnRZ",
  "period": {
    "start_date": "2026-05-05",
    "end_date": "2026-06-04"
  },
  "totals": {
    "pageviews": 1820,
    "visitors": 642
  },
  "new_vs_returning": {
    "new_visitors": 511,
    "returning_visitors": 131
  },
  "funnel": [
    {
      "label": "Landing",
      "visitors": 642
    },
    {
      "label": "Product view",
      "visitors": 188
    },
    {
      "label": "Checkout",
      "visitors": 54
    },
    {
      "label": "Purchase",
      "visitors": 21
    }
  ],
  "by_day": [
    {
      "date": "2026-06-04",
      "pageviews": 96,
      "visitors": 38
    }
  ],
  "top_pages": [
    {
      "path": "/",
      "pageviews": 820,
      "visitors": 410
    }
  ],
  "top_referrers": [
    {
      "source": "google.com",
      "pageviews": 240,
      "visitors": 180
    }
  ],
  "custom_events": [
    {
      "event_name": "purchase",
      "hits": 21,
      "visitors": 21,
      "revenue": 1049.79
    }
  ],
  "by_device": [
    {
      "value": "mobile",
      "pageviews": 1100,
      "visitors": 402
    }
  ],
  "by_country": [
    {
      "value": "US",
      "pageviews": 900,
      "visitors": 360
    }
  ]
}

Authorizations

Authorization
string
header
required

API key in the format: Bearer {api_token}

Path Parameters

id
string
required

The resource ID (e.g., "prod_abc123") or slug (e.g., "my-product")

Query Parameters

start_date
string<date>

Start of the date range (inclusive), as an ISO-8601 date (YYYY-MM-DD). Defaults to 30 days before end_date.

end_date
string<date>

End of the date range (inclusive), as an ISO-8601 date (YYYY-MM-DD). Defaults to today.

Response

Site analytics for the requested period

object
enum<string>
required
Available options:
site_analytics
site_id
string
required

Prefix id of the site (e.g. site_abc123).

period
object
required

The resolved date range the metrics cover.

totals
object
required

Aggregate pageviews and unique visitors over the period.

new_vs_returning
object

Visitors active in the period split by whether their first-ever visit was before the period started.

funnel
object[]

Ordered conversion funnel; each stage counts visitors who reached it within 24h of the first stage.

by_day
object[]

Per-day pageviews and visitors time series.

top_pages
object[]

Top 20 pages by pageviews.

top_referrers
object[]

Top 20 referrer hosts by visitors.

custom_events
object[]

Top 20 custom events by hit count, with unique visitors and any associated revenue.

by_device
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.

by_browser
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.

by_os
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.

by_country
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.

by_region
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.

by_city
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.

by_utm_source
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.

by_utm_medium
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.

by_utm_campaign
object[]

Top 20 values for a single analytics dimension, ranked by unique visitors.