Skip to main content
The Bily JavaScript SDK works across browser applications because it owns one small contract: load one exact tracking URL, record the initial page automatically, and track only later client-side routes yourself.

Find your installation path

WebsiteStart Bily inObserve later routes with
Plain HTMLShared <head>A new document loads the script again
Vanilla JavaScriptBrowser entry moduleYour router’s committed-navigation callback
React RouterOne component inside the existing routeruseLocation()
Next.jsOne shared client componentusePathname() and useSearchParams()
VueBrowser bootstrap after the router is readyrouter.afterEach()
NuxtOne client pluginuseRouter().afterEach()
SvelteBrowser entry moduleYour router’s committed-navigation callback
SvelteKitRoot layout componentafterNavigate()
AngularOne root serviceNavigationEnd
AstroShared layout scriptPersisted script plus astro:page-load
React Router framework mode or RemixOne component in the root routeuseLocation()

Choose a guide

Plain HTML

Add the exact browser script to every document through one shared layout.

Vanilla JavaScript

Initialize from a browser entry module and connect your router callback.

React Router

Mount one tracking component inside the router you already use.

Next.js

Cover App Router, Pages Router, or both with one shared component.

Vue

Wait for the initial route, then observe successful navigations.

Nuxt

Start Bily from one client plugin after the first page finishes.

Svelte and SvelteKit

Use the browser entry for Svelte or the root layout for SvelteKit.

Angular

Subscribe once to successful Angular Router navigation.

Astro

Support full document loads and optional client-side transitions.

React Router framework mode and Remix

Add one component to the root route without replacing its document shell.

Keep one contract everywhere

Every framework follows the same rules:
  1. Copy the complete tracking URL from Bily > Settings > Apps > More settings > Install tracking.
  2. Let @bilyai/js own the loader unless a framework guide reserves one script element for the SDK to reuse. Never add a second unmanaged tag.
  3. Let the browser script record the initial PageView.
  4. Send one explicit PageView after each later committed client-side route.
  5. Ignore repeated notifications when window.location.href has not changed.
The package ships ESM, CommonJS, and TypeScript definitions with no runtime dependencies. Its public methods can be imported during server rendering; browser work starts only from client-mounted code.
The tracking URL is public installation data, not a private token. Keep private credentials out of browser configuration and event payloads.

Verify the installation

Prove the script, initial page, later routes, and action events appear once.

Move to first-party tracking

Replace the complete tracking URL after Bily validates your customer subdomain.