REST API

Update an existing page view tracking entry with engagement metrics. Use this to send periodic updates or final metrics when the user leaves.

PropertyTypeDescriptionDefault
id*stringPage view ID (e.g., 'pv_xyz789')-

PropertyTypeDescriptionDefault
timeOnPagenumberTotal time spent in seconds-
scrollDepthnumberMaximum scroll depth (0-100%)-
exitPositionnumberScroll position when leaving (0-100%)-
bouncedbooleanWhether user bounced (< 5 seconds)-
eventsPageEvent[]Additional custom events-

PropertyTypeDescriptionDefault
success*booleanWhether update succeeded-

cURL Command
curl -X PUT "https://api.simplist.blog/v1/analytics/track/pv_xyz789" \
  -H "X-API-Key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d "{\"timeOnPage\":125,\"scrollDepth\":85,\"exitPosition\":85,\"bounced\":false}"

{
  "timeOnPage": 125,
  "scrollDepth": 85,
  "exitPosition": 85,
  "bounced": false,
  "events": [
    {
      "type": "button_click",
      "element": "share-button",
      "timeOffset": 45000
    }
  ]
}

{
  "data": {
    "success": true
  }
}

  1. Initialize tracking with POST/v1/analytics/track
  2. Store the returned ID
  3. Update periodically (every 30s) with current metrics
  4. Send final update when user leaves page
// 1. Initialize
const response = await fetch('https://api.simplist.blog/v1/analytics/track', {
method: 'POST',
headers: {
  'X-API-Key': 'YOUR_API_KEY',
  'Content-Type': 'application/json'
},
body: JSON.stringify({ slug: 'my-article', timeOnPage: 0 })
})
const { id } = await response.json()

// 2. Update periodically
setInterval(async () => {
await fetch(`https://api.simplist.blog/v1/analytics/track/${id}`, {
  method: 'PUT',
  headers: {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    timeOnPage: getTimeOnPage(),
    scrollDepth: getScrollDepth()
  })
})
}, 30000)

// 3. Final update on unload
window.addEventListener('beforeunload', async () => {
await fetch(`https://api.simplist.blog/v1/analytics/track/${id}`, {
  method: 'PUT',
  headers: {
    'X-API-Key': 'YOUR_API_KEY',
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    timeOnPage: getTimeOnPage(),
    scrollDepth: getScrollDepth(),
    exitPosition: getScrollDepth(),
    bounced: getTimeOnPage() < 5
  })
})
})

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

Command Palette

Search for a command to run...