REST API

Create a new page view tracking entry for an article.

POST{{baseUrl}}/v1/analytics/track
Auth required

Request Body

PropertyTypeDescriptionDefault
slug*stringArticle slug (required)-
sessionIdstringUser session identifier-
pageUrlstringFull page URL-
pageTitlestringPage title-
referrerstringReferrer URL-
utmSourcestringUTM source parameter-
utmMediumstringUTM medium parameter-
utmCampaignstringUTM campaign parameter-
utmTermstringUTM term parameter-
utmContentstringUTM content parameter-
screenWidthnumberScreen width in pixels-
screenHeightnumberScreen height in pixels-
timeOnPagenumberTime spent in seconds-
scrollDepthnumberScroll depth (0-100%)-
exitPositionnumberExit position (0-100%)-
bouncedbooleanWhether user bounced-
eventsPageEvent[]Custom events array-
fetchGeobooleanFetch geolocation data-

PropertyTypeDescriptionDefault
id*stringPage view tracking ID-
success*booleanWhether tracking succeeded-

cURL Command
curl -X POST "https://api.simplist.blog/v1/analytics/track" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"slug\":\"getting-started\",\"sessionId\":\"sess_abc123\",\"pageUrl\":\"https://myblog.com/blog/getting-started\",\"timeOnPage\":0,\"fetchGeo\":true}"

minimal-example.json
{
  "slug": "getting-started"
}

complete-example.json
{
  "slug": "getting-started",
  "sessionId": "sess_abc123",
  "pageUrl": "https://myblog.com/blog/getting-started",
  "pageTitle": "Getting Started with Simplist",
  "referrer": "https://google.com",
  "utmSource": "google",
  "utmMedium": "cpc",
  "utmCampaign": "launch",
  "screenWidth": 1920,
  "screenHeight": 1080,
  "timeOnPage": 0,
  "scrollDepth": 0,
  "exitPosition": 0,
  "bounced": false,
  "fetchGeo": true,
  "events": []
}

response.json
{
  "success": true,
  "pageViewId": "pv_xyz789",
  "visitorId": "visitor_def456",
  "sessionId": "session_abc123"
}

  1. Initialize tracking when user lands on page (timeOnPage: 0)
  2. Store the page view ID returned in response
  3. Update metrics periodically using PUT/v1/analytics/track/:id
  4. Send final update when user leaves (with final timeOnPage, scrollDepth, etc.)

  • Server-side analytics: Track views without JavaScript
  • Privacy-friendly tracking: No cookies, no client-side scripts
  • Custom events: Track button clicks, video plays, etc.
  • UTM tracking: Campaign attribution
  • Geolocation: Optional IP-based location (GDPR compliant)

If you're using TypeScript/JavaScript, you can use the SDK instead: client.analytics.track()

Notes

Session ID:Generate a unique ID per user session (e.g., UUID)
Geolocation:Only fetched if fetchGeo: true (based on IP address)
Privacy:All data is anonymized and GDPR compliant
Update:Use the returned id to update metrics with PUT request

Command Palette

Search for a command to run...