Skip to main content
Mount one Bily component in the existing root route. This supports React Router framework mode and Remix without replacing the document shell, providers, error boundaries, or route outlet. Do not add a raw Bily script tag. init() loads the script for you.

Install Bily

Set one public build value

For a Vite build, copy the complete tracking URL into a public environment value.
.env
The URL is public installation data, not a private token. Vite includes it in browser assets, so rebuild and redeploy when it changes.

Create the tracking component

Choose the import that matches the framework. Both versions follow the same route contract.
app/bily-tracking.tsx
The browser script records the initial page and supported client-side navigation automatically. Do not add manual PageView calls for those navigations; use track() for business events. Repeated init() calls with the same URL are safe.

Mount it in the existing root route

Add <BilyTracking /> inside the default root component, without replacing your existing router.
app/root.tsx
These root examples show only the mount point. Keep your existing Layout, document elements, metadata, links, scripts, providers, hydration support, error boundaries, and other root-route behavior.

Track successful actions

Call track() from browser code after the operation succeeds.
app/routes/settings.tsx

Verify framework routes

Check direct loads, nested routes, search changes, redirects, and browser history.

Move to first-party tracking

Replace the bundled URL after Bily validates the customer subdomain.