Skip to main content

Documentation Index

Fetch the complete documentation index at: https://onlook.mintlify.app/llms.txt

Use this file to discover all available pages before exploring further.

Install the SDK

npm install @onlook/core

Initialize

Call track() once per session. Pass a user identifier and optional config.
import { track } from '@onlook/core'

const session = track(userId, {
  context: 'dashboard',   // label for this surface
  threshold: 40,          // score below which interventions fire
})

Listen for score changes

session.on('score', ({ score, delta }) => {
  console.log(`Attention: ${score} (${delta > 0 ? '+' : ''}${delta})`)
})

session.on('drop', ({ score }) => {
  // score fell below threshold
  showNudge(userId)
})

Stop tracking

Call stop() when the user navigates away or the session ends.
session.stop()

Next steps

Attention scoring

Learn how the 0–100 score is computed.

SDK reference

Full API surface of @onlook/core.

Webhooks

Push score events to your backend.

Self-hosting

Run the ingest and scoring layer yourself.