BeaconDocsDashboard

Features

Live values

Settings your code reads from Beacon, like a plan limit, a banner or a price, that you change in the dashboard without a release. Different visitors can get different values.

Create one

In Live values, choose New value: a name, a key for your code, a type (text, number, true/false or JSON) and the value for everyone. Then add rules for who gets something else.

In your code

js
const limit = await beacon('value', 'free-project-limit', 3);

if (projects.length >= limit) {
  showUpgradePrompt();
}

beacon('value', key, fallback) returns a promise of this visitor's value. The fallback is what you get if the key doesn't exist or Beacon can't be reached, so your site always has something sensible. JSON values arrive as objects or lists, ready to use:

js
const banner = await beacon('value', 'launch-banner', null);

if (banner) {
  showBanner(banner.text, banner.link);   // { "text": "Beacon 2 is here", "link": "/blog/launch" }
}

Who gets what

Rules are checked in order and the first one that matches wins; everyone else gets the default. Change the order with the arrows in the dashboard.

RuleFor exampleChecked
In a cohortIn cohort Regulars gets 10Asks Beacon once per visit
A propertyplan is team or business gets 25In the browser, from beacon('set')
Signed inSigned in gets trueIn the browser, from beacon('identify')
On a pageOn pages starting /beta gets 50In the browser
On a deviceOn mobile gets 2In the browser
A random share20% of visitors gets 5In the browser; a visitor keeps their answer
EveryoneEveryone gets 4In the browser

Cohorts are worked out from what visitors did, which only Beacon knows, so when the tag reaches a cohort rule it asks Beacon which cohorts this visitor is in. It does that once per visit, and only if a value you read has a cohort rule; everything else is instant.

Changing a value

Save and publish reaches sites within a couple of minutes: the tag reads Beacon's settings once per page and keeps them for a minute. Every change is kept in the value's history, with who made it and what changed, and Restore puts any earlier version back.

Live values are public: the tag has to read them, so anyone who opens your site can too. Don't put secrets, API keys or anything private in them.

On your server

To use a value before the page reaches the browser, ask Beacon for every value worked out for one visitor. All parameters but key are optional; rules needing a missing one don't match.

text
curl "https://beacon.endevre.com/v1/values?key=B-XXXXXX&visitor=VISITOR_ID&user=USER_ID&props=%7B%22plan%22%3A%22team%22%7D&path=/pricing&device=mobile"

{ "values": { "free-project-limit": 25, "launch-banner": { "text": "Beacon 2 is here" } } }

visitor is Beacon's visitor ID (the _bk cookie), user your user ID, props a JSON object like the one you pass to beacon('set'), and device one of desktop, mobile or tablet.