Skip to main content
Add one Bily component inside your existing React Router. It starts the SDK once; the browser script owns page-view tracking. Do not add a raw Bily script tag anywhere else in the application. init() loads the script for you.

Install Bily

Track every route once

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.
src/bily-tracking.tsx
Mount the component once in a component that your existing router already renders. Keep your existing router and application shell.
src/AppRoutes.tsx
This setup expects react-router-dom to be installed and a router to exist above AppRoutes. Do not add another BrowserRouter, Router, or RouterProvider. Repeated init() calls with the same URL are safe. One component keeps loader ownership clear.

Track successful actions

Call track() only after the user action succeeds.
src/LaunchCampaignButton.tsx

Verify React Router

Check the initial view, later routes, and action events without duplicates.

Use framework mode

Install Bily in a React Router framework mode or Remix root route.