The Clickport API lets you query your analytics data programmatically, send events from your server, and access realtime visitor counts. All endpoints require authentication via API key.
Every API request must include your site's API key. You can find and manage your API keys in Settings → API Keys in your dashboard.
Pass the key in the x-api-key HTTP header:
curl https://clickport.io/api/query \
-H "x-api-key: ck_your_api_key_here" \
-H "Content-Type: application/json" \
-d '{"metrics": ["visitors"], "period": "30d"}'
API keys start with ck_ and are scoped to a single site. Each key has read and tracker permissions, allowing you to query data and send events.
All API endpoints use the base URL:
https://clickport.io/api
The event ingestion endpoint (/api/event) is rate-limited to 60 requests per minute per IP address. When the limit is exceeded, events are silently dropped (the response still returns 200). Query endpoints do not have a per-request rate limit but are subject to fair use.
Query your analytics data with flexible metrics, dimensions, filters, and date ranges.
metrics["visitors"]dimensionsperiod"today"date_range{"start": "2026-03-01", "end": "2026-03-31"}. End date is exclusive.filters[{"dimension": "country", "operator": "is", "value": "DE"}]order_byorder_dir"asc" or "desc". Default: "desc"limit100offset0timezone"UTC"include_comparisonfalsevisitors - Unique visitorssessions - Total sessionspageviews - Total pageviewsviews_per_visit - Average pageviews per sessionbounce_rate - Percentage of single-page sessions (0-100)avg_duration - Average session duration in secondsavg_scroll - Average scroll depth (0-100)clickers - Sessions with at least one click eventsource, channel, referrer_urlutm_source, utm_medium, utm_campaign, utm_content, utm_termpage, entry_page, exit_pagecountry, region, citydevice, browser, browser_version, os, os_version, screenhour, date, week, monthrealtime - Last 30 minutestoday, yesterday7d, 14d, 30d, 90d - Last N days12m - Last 12 monthsall - All timedate_range for custom rangesis - Exact matchis_not - Does not matchcontains - Substring match (case-insensitive)not_contains - Does not contain substringstarts_with - Starts with valueends_with - Ends with valueGet total visitors, pageviews, and bounce rate for the last 30 days:
curl -X POST https://clickport.io/api/query \
-H "x-api-key: ck_your_key" \
-H "Content-Type: application/json" \
-d '{
"metrics": ["visitors", "pageviews", "bounce_rate"],
"period": "30d"
}'
Response:
{
"results": {
"visitors": 4821,
"pageviews": 12493,
"bounce_rate": 42
}
}
Get top pages by visitors for a custom date range, filtered to Germany:
curl -X POST https://clickport.io/api/query \
-H "x-api-key: ck_your_key" \
-H "Content-Type: application/json" \
-d '{
"metrics": ["visitors", "pageviews", "avg_scroll"],
"dimensions": ["page"],
"date_range": {"start": "2026-03-01", "end": "2026-03-31"},
"filters": [{"dimension": "country", "operator": "is", "value": "DE"}],
"limit": 10,
"timezone": "Europe/Berlin"
}'
Response:
{
"results": [
{ "page": "/", "visitors": 312, "pageviews": 487, "avg_scroll": 65 },
{ "page": "/pricing", "visitors": 198, "pageviews": 214, "avg_scroll": 78 },
{ "page": "/blog/privacy", "visitors": 145, "pageviews": 152, "avg_scroll": 82 }
]
}
Get daily visitor counts for the last 7 days:
curl -X POST https://clickport.io/api/query \
-H "x-api-key: ck_your_key" \
-H "Content-Type: application/json" \
-d '{
"metrics": ["visitors", "pageviews"],
"dimensions": ["date"],
"period": "7d"
}'
Response:
{
"results": [
{ "date": "2026-03-25", "visitors": 183, "pageviews": 421 },
{ "date": "2026-03-26", "visitors": 201, "pageviews": 467 },
{ "date": "2026-03-27", "visitors": 195, "pageviews": 442 }
]
}
Send events from your server. Use this for server-side tracking, mobile apps, or any environment where the JavaScript tracker is not available.
type"pageview", "custom", "click", "form". Default: "pageview"url"https://yoursite.com/page"referrername"Signup"utm_sourceutm_mediumutm_campaignscreen_widthtimezone"UTC"revenue_amountrevenue_currency"USD", "EUR"meta_keysmeta_valuesmeta_keys. Max 2000 chars each.User-Agent header with your request. Clickport uses it for browser/OS detection and to filter bots. Requests with missing or bot-like User-Agents may be rejected.
curl -X POST https://clickport.io/api/event \
-H "x-api-key: ck_your_key" \
-H "Content-Type: application/json" \
-H "User-Agent: Mozilla/5.0 ..." \
-d '{
"type": "pageview",
"url": "https://yoursite.com/pricing",
"referrer": "https://google.com/"
}'
Response:
{
"success": true,
"session_id": 48291,
"page_visit_id": "a1b2c3d4"
}
curl -X POST https://clickport.io/api/event \
-H "x-api-key: ck_your_key" \
-H "Content-Type: application/json" \
-H "User-Agent: Mozilla/5.0 ..." \
-d '{
"type": "custom",
"name": "Purchase",
"url": "https://yoursite.com/checkout/complete",
"revenue_amount": 49.99,
"revenue_currency": "USD",
"meta_keys": ["plan", "interval"],
"meta_values": ["pro", "annual"]
}'
gclid, fbclid, msclkid, etc.) are automatically stripped from stored URLsDNT: 1 headers are excludedGet the number of currently active visitors on your site.
curl https://clickport.io/api/realtime \
-H "x-api-key: ck_your_key"
Response:
{
"count": 7,
"visitors": [
{
"session_id": 91823,
"entry_page": "/",
"exit_page": "/pricing",
"pageviews": 3,
"duration": 124,
"source": "google",
"country": "DE",
"city": "Berlin",
"device": "Desktop",
"browser": "Chrome",
"os": "macOS",
"scroll": 72
}
]
}
Returns up to 20 currently active visitors (active within the last 5 minutes). Each visitor includes their session details, current page, traffic source, location, and engagement data.
Retrieve goal conversion data for your site.
start_dateend_datetimezone"UTC"curl "https://clickport.io/api/goals?start_date=2026-03-01&end_date=2026-03-31" \
-H "x-api-key: ck_your_key"
Response:
{
"goals": [
{
"id": 1,
"name": "Contact Form",
"type": "form",
"visitors": 84,
"submissions": 91
},
{
"id": 2,
"name": "Purchase",
"type": "custom",
"visitors": 37,
"events": 42,
"total_revenue": 1849.50
}
]
}
These GET endpoints return pre-formatted breakdowns for common dimensions. All accept start_date and end_date as query parameters.
GET /api/pages - Top pages with visitors, pageviews, scroll depth, durationGET /api/sources - Traffic sources with visitors, bounce rate, engagementGET /api/referrers - Full referrer URLs with visitors and bounce rateGET /api/countries - Country breakdown with visitor countsGET /api/campaigns - Campaign data (campaign, source, medium)GET /api/utm-sources - UTM source breakdownGET /api/utm-mediums - UTM medium breakdownGET /api/utm-content - UTM content breakdownGET /api/utm-term - UTM term breakdownGET /api/entry-pages - Entry pages with session countsGET /api/exit-pages - Exit pages with session countsGET /api/tech?type=device - Device type breakdownGET /api/tech?type=browser - Browser breakdownGET /api/tech?type=os - Operating system breakdowncurl "https://clickport.io/api/pages?start_date=2026-03-01&end_date=2026-03-31" \
-H "x-api-key: ck_your_key"
The API returns standard HTTP status codes:
200 - Success401 - Invalid or missing API key404 - Endpoint not found500 - Server errorError responses include a JSON body:
{
"error": "Unauthorized",
"message": "Invalid API key"
}