The window.boostra JavaScript API
Every command the tracking snippet exposes on window.boostra, with signatures and examples.
Updated
Once the tracking snippet is on the page, the tracker exposes one function: window.boostra(command, value). The first line of the snippet defines a small stub, so you can call it before t.js has loaded: calls are queued and replayed as soon as the tracker starts.
Always call it with optional chaining, window.boostra?.(...), so your app keeps working when an ad blocker removes the script.
Commands#
"identify": tell Boostra who the visitor is. Takes a string id or{ userId, email?, traits? }. See Identify signed-in users."reset": clear the identity on sign-out. The next visit starts a new anonymous visitor."goal": record a custom goal by name. Returnstruewhen the goal was accepted andfalsewhen the name is invalid. See Custom goals and data attributes."pageview": record a pageview yourself. You rarely need it: route changes in single-page apps are tracked automatically."consent": grant or withdraw analytics consent when the snippet runs in consent mode. See Consent, Do Not Track and Global Privacy Control."ids": returns{ visitorId, sessionId, externalId }for the current visitor. Use it to pass the ids to Stripe Checkout."decorate": takes a URL string and returns it with the visitor hand-off added, for links to another domain you track. See Track visitors across domains.
Examples#
// After sign-in
window.boostra?.("identify", { userId: user.id });
// On sign-out
window.boostra?.("reset");
// A goal without its own page
window.boostra?.("goal", "signup_completed");
// Read the current ids
const ids = window.boostra?.("ids") ?? {};Check it in the console#
Open your site, then the browser console, and run window.boostra("ids"). You get the visitor id (it starts with bv_), the session id (bs_) and, after an identify call, the externalId. If the function is undefined, the snippet is not on that page: see Verify your installation.
What there is no command for#
There is no "track" command with custom properties. Use "goal" for named conversions, and let the tracker record clicks, forms and scroll on its own (what Boostra tracks automatically). Revenue comes from Stripe or Shopify, not from a JavaScript call.
Related articles
-
Identify signed-in users
Call identify after sign-in and reset on sign-out so visits, funnels and revenue are tied to real users.
Read article -
Custom goals and data attributes
Record named goals from code or HTML and give important elements stable names for funnels.
Read article -
Track visitors across domains
Keep one visitor when people move between your site and a checkout or app on a different domain.
Read article -
Consent, Do Not Track and Global Privacy Control
Run the tracker only after consent, and how it reacts to Do Not Track and Global Privacy Control signals.
Read article