Skip to main content

Installation

Add the snippet to your root HTML file (public/index.html for Create React App, or the equivalent entry HTML for Vite).
public/index.html

Calling identify

Call identify() inside a useEffect that runs when the authenticated user is available. The snippet’s queue system means this is safe to call before or after the script loads.
src/components/ZenstepProvider.tsx
Wrap your app root with this provider:
src/main.tsx

TypeScript types

Add a global type declaration so TypeScript knows about window.zenstep:
src/global.d.ts

SPA navigation

Zenstep automatically detects client-side navigation using a History API pushState observer. When the URL changes, it re-evaluates all targeting rules and shows any newly-matching flows. No additional setup is required.

Conditional loading (development)

If you want to disable Zenstep in your local development environment: