Basic setup
Initialize
Choose between synchronous and asynchronous initialization:
initAsync fetches the widget configuration from the server before rendering, so the widget reflects your dashboard settings (colors, position, branding). init uses defaults and renders immediately.Configuration options
Pass these properties toinit or initAsync:
| Property | Type | Required | Description |
|---|---|---|---|
projectId | string | Yes | Your project ID (proj_...) |
apiUrl | string | Yes | API base URL |
apiKey | string | Yes | Public API key (lum_pk_...) |
user | object | No | End user identity (see Identity) |
userTokens | object | No | Custom headers forwarded to action endpoints |
Full example
The widget script is cached for 1 hour with a stale-while-revalidate window of 1 day. Users always get a fast load with automatic background updates.