Skip to main content
Use the SDK in browser applications built with npm. It loads your exact Bily tracking URL, keeps early calls in order, and can be imported safely during server rendering.

Install Bily

Start tracking once

Select your store. Then open Bily > Settings > Apps > More settings > Install tracking, choose your framework, and copy the exact scriptUrl from the SDK snippet.
analytics.ts
Import this module once from your browser entry point. This gives the SDK one clear place to start.
main.ts
Do not add a separate script tag. For this installation path, init() loads the script.

Track every later route once

The browser script records the initial page view automatically. Save that URL, then run this function only after the router completes a later navigation.
analytics.ts
Call trackCommittedRoute() from your router’s after-navigation callback. Do not call it during the initial mount, or you will duplicate the automatic page view.

Track successful actions

create-workspace.ts
Send completion events only after the operation succeeds. This keeps attempted actions from looking like completed ones.

Track custom events

Change the tracking URL