Tracking/Custom events

Custom events

Pageviews tell you where people go. Custom events tell you what they do. Track any action with a name and properties, then slice it in the Events view.

Sending an event

Call track with an event name and optional properties:

ts
import { track } from "@analyse.net/sdk";

track("plan_selected", {
  plan: "pro",
  billing_interval: "month",
});

With the script tag install, the same call is available on the global object:

js
Analyse.track("plan_selected", { plan: "pro" });

Events show up in the Events view within seconds, and you can chart them, break them down by property, and use them in funnels and boards.

Naming events

A few habits that pay off later:

  • Use snake_case names like report_exported, not "Report Exported!".
  • Name the action, not the page. signup_completed survives a redesign, clicked_green_button does not.
  • Keep the name stable and put the variation in properties. One plan_selected event with a plan property beats three separate events.

Properties

Properties are a flat set of values describing the event. Strings, numbers, and booleans all work. Amounts are best sent in minor units (cents) so they aggregate cleanly.

Heads up

Do not put personal data like emails or names in event properties. If you need to know who did something, call identify and let Analyse connect the event to the person.

Standard events

For common lifecycle moments, signups, checkouts, and trials, the SDK ships typed helpers with agreed property shapes. Prefer those over hand rolled names, the dashboard understands them. See Standard events.