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.

Signature

function track(userId: string, config?: OnlookConfig): Session

Parameters

userId
string
required
A stable identifier for the user. Can be an email, UUID, or any string. Not stored as PII — hashed before transmission.
config
OnlookConfig
Optional configuration object. See SDK Overview for all options.

Returns

A Session object. See Session.

Example

import { track } from '@onlook/core'

const session = track('user_123', {
  context: 'onboarding',
  threshold: 50,
  signals: { face: true, idle: 20 },
})

session.on('drop', ({ score }) => {
  triggerIntervention(score)
})

Notes

  • Calling track() twice with the same userId returns the existing session.
  • Call session.stop() when the user navigates away to flush the final score.