JavaScript API

The browser tracker exposes a single aurora() function. Every method is queued until the tracker loads, so it's safe to call from anywhere on the page — even before the script has finished downloading.

3 min read Updated Aug 18, 2026
On this page
  1. Calling convention
  2. page
  3. identify
  4. track
  5. consent
  6. config
  7. reset
  8. debug
  9. Reading the visitor ID
  10. TypeScript

Calling convention#

All methods use the same shape: the method name as the first argument, followed by its parameters. Calls return immediately; the tracker processes them in order in the background.

JavaScript
aurora(method, ...args);
MethodPurpose
pageRecord a page view
identifyLink the visitor to a known user
trackRecord a custom event
consentGrant or deny tracking consent
configChange tracker options at runtime
resetForget the current visitor, for example on logout
debugLog every event to the browser console

page#

Records a page view. Sent automatically on load unless data-auto-page="false" is set. Call it yourself in single-page apps after each route change.

JavaScript
aurora("page");
aurora("page", { path: "/pricing/annual", title: "Annual pricing" });
ParameterTypeDescription
pathstringOptional. Defaults to location.pathname + location.search.
titlestringOptional. Defaults to document.title.
referrerstringOptional. Defaults to the previous page in the session.

identify#

Links the current visitor to a user in your system. Call it after signup and login, and whenever important traits change.

JavaScript
aurora("identify", "usr_8f2a91", {
  email: "dana@northwind.example",
  name: "Dana Whitfield",
  company: "Northwind Supply",
  role: "Head of Sales",
  plan: "trial"
});
ParameterTypeDescription
userIdstringRequired. Your stable, unique user ID. Don't use the email address.
traits.emailstringStrongly recommended. Used for CRM matching and account grouping.
traits.namestringOptional. Full name shown in alerts.
traits.*string | number | booleanOptional. Any other properties; up to 50 per visitor, keys up to 64 characters.

track#

Records a custom event. Events can be used as signals in scoring rules and conditions in routing rules.

JavaScript
aurora("track", "demo_video_played", { seconds_watched: 94, video: "product-tour" });
aurora("track", "teammate_invited");

Use snake_case event names in the past tense and keep them stable — renaming an event breaks the rules that use it. Event names are limited to 64 characters, and each event can carry up to 20 properties. Up to 300 events per visitor per hour are accepted; anything beyond is dropped to protect scores from runaway loops.

Grants or denies consent when the tracker runs in pending mode. See Consent and cookies.

JavaScript
aurora("consent", "granted");
aurora("consent", "denied");

config#

Changes options at runtime. Accepts the same options as the script attributes, in camelCase.

JavaScript
aurora("config", {
  spa: true,
  exclude: ["/admin", "/checkout"],
  cookieDomain: ".example.com"
});

reset#

Clears the visitor ID and traits from the browser and starts a new anonymous visitor. Call it when a user logs out on a shared device, so the next person's activity isn't attached to the previous user.

JavaScript
aurora("reset");

debug#

Logs every event, its payload and the server's response to the browser console. The setting is stored for the current tab only.

JavaScript
aurora("debug", true);

Reading the visitor ID#

To pass the visitor ID to your backend — for example to identify a visitor server-side after a form submission — use the ready callback, which runs once the tracker has loaded:

JavaScript
aurora("ready", (tracker) => {
  document.querySelector("#aurora-id").value = tracker.visitorId; // "vis_7c1e02"
});

TypeScript#

Type definitions are available on npm as @aurora-io/types. Install them as a dev dependency to get autocomplete for every method and parameter:

Terminal
npm install --save-dev @aurora-io/types
Last updated Aug 18, 2026 Report an issue with this page

Ready to try it on your own site?

Install the snippet in five minutes and see your first scored visitors today. Starter is free forever for one seat.

No credit card required · Setup help from real engineers