Skip to main content

Overview

Pageview analytics provide insights into which pages users visit, how they navigate through your site, and how long they spend on each page.

Query Types

Top Pages

Get the most visited pages ranked by pageviews and visitors. Query Type: top_pages
curl -X POST 'https://api.databuddy.com/v1/query?website_id=web_abc123' \
  -H 'Authorization: Bearer db_key_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "parameters": ["top_pages"],
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "limit": 20
  }'
Response Fields:
name
string
The page path (e.g., /home, /about).
pageviews
number
Total number of page views.
visitors
number
Number of unique visitors to this page.
percentage
number
Percentage of total traffic (0-100).
Example Response:
{
  "success": true,
  "requestId": "req_abc123",
  "data": [
    {
      "parameter": "top_pages",
      "success": true,
      "data": [
        {
          "name": "/home",
          "pageviews": 1234,
          "visitors": 456,
          "percentage": 12.5
        },
        {
          "name": "/about",
          "pageviews": 987,
          "visitors": 321,
          "percentage": 10.2
        }
      ]
    }
  ],
  "meta": {
    "parameters": ["top_pages"],
    "total_parameters": 1,
    "page": 1,
    "limit": 20,
    "filters_applied": 0
  }
}

Entry Pages

Analyze which pages users first land on when visiting your site. Query Type: entry_pages
curl -X POST 'https://api.databuddy.com/v1/query?website_id=web_abc123' \
  -H 'Authorization: Bearer db_key_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "parameters": ["entry_pages"],
    "preset": "last_30d",
    "limit": 25
  }'
Response Fields:
name
string
The entry page path.
pageviews
number
Number of sessions that started on this page.
visitors
number
Unique visitors who entered through this page.
percentage
number
Percentage of total entry traffic.

Exit Pages

Identify pages where users most commonly leave your site. Query Type: exit_pages
curl -X POST 'https://api.databuddy.com/v1/query?website_id=web_abc123' \
  -H 'Authorization: Bearer db_key_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "parameters": ["exit_pages"],
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "limit": 25
  }'
Response Fields:
name
string
The exit page path.
pageviews
number
Number of sessions that ended on this page.
visitors
number
Unique visitors who exited from this page.
percentage
number
Percentage of total exit traffic.

Page Performance

Analyze average time spent on each page along with visitor counts. Query Type: page_performance
curl -X POST 'https://api.databuddy.com/v1/query?website_id=web_abc123' \
  -H 'Authorization: Bearer db_key_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "parameters": ["page_performance"],
    "preset": "last_7d"
  }'
Response Fields:
name
string
The page path.
pageviews
number
Total page views.
avg_time_on_page
number
Average time spent on page in seconds.
visitors
number
Unique visitors.

Page Time Analysis

Detailed analysis of time spent on pages with median time calculations and quality filters. Query Type: page_time_analysis
curl -X POST 'https://api.databuddy.com/v1/query?website_id=web_abc123' \
  -H 'Authorization: Bearer db_key_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "parameters": ["page_time_analysis"],
    "startDate": "2024-01-01",
    "endDate": "2024-01-31",
    "limit": 50
  }'
Response Fields:
name
string
The page path.
sessions_with_time
number
Number of sessions with valid time measurements (excludes bounces and outliers).
visitors
number
Unique visitors with time data.
median_time_on_page
number
Median time spent on page in seconds (more reliable than average).
percentage
number
Percentage of total visitors.

Filters

Pageview queries support the following filters:
path
string
Filter by page path (supports contains, starts_with, etc.).
query_string
string
Filter by URL query parameters.
country
string
Filter by visitor country code (e.g., US, GB).
device_type
string
Filter by device type (desktop, mobile, tablet).
browser_name
string
Filter by browser (e.g., Chrome, Safari, Firefox).
os_name
string
Filter by operating system.
referrer
string
Filter by referrer URL.
utm_source
string
Filter by UTM source parameter.
utm_medium
string
Filter by UTM medium parameter.
utm_campaign
string
Filter by UTM campaign parameter.

Filter Example

Get top pages for US mobile visitors:
curl -X POST 'https://api.databuddy.com/v1/query?website_id=web_abc123' \
  -H 'Authorization: Bearer db_key_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "parameters": ["top_pages"],
    "preset": "last_30d",
    "filters": [
      {
        "field": "country",
        "op": "eq",
        "value": "US"
      },
      {
        "field": "device_type",
        "op": "eq",
        "value": "mobile"
      }
    ],
    "limit": 10
  }'

Combined Query Example

Get multiple pageview metrics in a single request:
curl -X POST 'https://api.databuddy.com/v1/query?website_id=web_abc123' \
  -H 'Authorization: Bearer db_key_...' \
  -H 'Content-Type: application/json' \
  -d '{
    "parameters": [
      "top_pages",
      "entry_pages",
      "exit_pages",
      "page_time_analysis"
    ],
    "preset": "last_7d",
    "limit": 20
  }'

Notes

  • Page paths are automatically normalized (trailing slashes removed, decoded)
  • Root path is represented as /
  • Time calculations exclude invalid data (bounces, very short visits, or outliers over 1 hour)
  • Median time is generally more reliable than average for time analysis
  • Session attribution automatically applies UTM parameters and referrer data to all pages in a session

Build docs developers (and LLMs) love