BeaconDocsDashboard

Sending data

Properties on every event

Some details belong on everything a visitor does: their plan, your app's version, the account they're in. Set them once and they're added to every event.

Set properties

js
beacon('set', { plan: 'team', app_version: '2.4.1' });

Every event after this call, including page views and clicks, carries these properties. Each call adds to what's already set, and a property you pass with an event wins over the same one from set:

js
beacon('set', { plan: 'free' });
beacon('set', { app_version: '2.4.1' });
// Both are now attached: { plan: 'free', app_version: '2.4.1' }

beacon('event', 'export', { format: 'csv', plan: 'team' });
// A property on the event itself wins over the one from set: plan is 'team' here

Where to call it

set lasts for the current page. Call it on every page, as early as possible: in your root layout, or right after the snippet. In a single-page app, calling it once when the app starts is enough, and again whenever the values change.

On every page
// In your root layout, or the first script on every page
beacon('set', {
  plan: account.plan,          // 'free' | 'team' | 'business'
  account: account.id,         // a company or team, if your product has them
  theme: prefersDark ? 'dark' : 'light',
});

What they're good for

  • Your events in a visit's journey in Sessions show them, so you can see which plan or version someone was on.
  • The Data tab lists them with each event, with their types and the values it has seen.
  • Experiments and feature flags can split by one of them, for example account, so everyone in the same company sees the same version.

The same rules apply as for event properties: no personal data, and consistent types. See Custom events.