BeaconDocsDashboard

Sending data

Custom events

Page views and clicks come for free. For everything else that matters to you, like a signup, a download or a game started, send an event with one line.

Send an event

js
beacon('event', 'signup', { plan: 'team', seats: 5 });

The first argument is the command, 'event'. Then the event's name, and optionally an object of properties with more detail. The page it happened on is added for you. Events are sent in small batches, every few seconds and when the page is closed, so calling it often costs nothing.

Examples
// A button
document.querySelector('#start-trial').addEventListener('click', () => {
  beacon('event', 'trial_started', { plan: 'team' });
});

// A form, once it's really sent
form.addEventListener('submit', () => {
  beacon('event', 'contact_sent', { topic: form.topic.value });
});

// Something that happens in your app, not on a click
player.on('ended', () => beacon('event', 'video_finished', { video: 'launch', seconds: 94 }));
React
export function UpgradeButton({ plan }: { plan: string }) {
  return (
    <button onClick={() => beacon('event', 'upgrade_clicked', { plan })}>
      Upgrade
    </button>
  );
}

Naming events

  • Letters, numbers and _ . : -, up to 63 characters. Anything else is dropped.
  • Don't start a name with $: those are Beacon's own ($pageview, $click…).
  • Pick one style and stick to it. signup, sign_up and Signup are three different events, and the Data tab will point them out if they appear.
  • Keep IDs out of names: send view_item with { item: 1234 }, not view_item_1234.

Properties

Any JSON value works: text, numbers, true/false, lists and nested objects. Keep a property's type the same every time (a price is always a number, not sometimes "9.99"), and keep the whole object under 4 KB. To add the same properties to every event, use beacon('set').

Don't send personal data such as names, email addresses or phone numbers in properties. Beacon replaces email addresses and card numbers with [redacted] before storing them (unless you turn that off in the Data tab), and flags anything else that looks personal.

Where events show up

  • Realtime shows them in the feed as they happen.
  • Overview counts them in the Events panel, and you can filter any report to people who did an event.
  • Sessions shows them in each visit's journey.
  • Data lists every event and property Beacon has seen, describes it, and checks it stays healthy. See Data & tracking plan.