Skip to main content
Next.js
Because init() needs to run in the browser (not on the server), wrap it in a Client Component.
1. Create the component
Always set environment. Only "production" and "development" are accepted. If omitted, events default to development.
2. Add it to your root layout
init() is a no-op on the server — it checks for window internally. You don’t need a typeof window !== 'undefined' guard.

Create a second Client Component to call identify() once your session is available:

LLM Prompt

Paste this into your coding assistant to install Tracelit for you:

What’s next?