Widget Tokens
Save values from an HTML widget with bb.setToken and use them on prints, in URLs and anywhere tokens work.
Widgets are HTML pages that are displayed on top of the booth screens. They can be used to run games, capture guest details, let guests pick options and more.
Any value a widget saves can be used as a token, the same way as survey data: in print layouts, text overlays, URLs, emails and anywhere else tokens are supported.
Building a widget? See Widgets for how they work in Breeze Booth.
Token Format#
Widget tokens use the format: {ID_key}
ID is the ID of the widget, e.g. taxgame. key is the name the widget gives the value when it saves it, e.g. score
The widget ID is added to the front of every token automatically. This means two widgets can both save a value called name without overwriting each other.
To use a score saved by a widget with the ID taxgame, you would use {taxgame_score}
To use a first name saved by a widget with the ID checkin, you would use {checkin_FirstName}
Saving a Token from a Widget#
Widgets save values with the bb.setToken function. The first value is the key and the second is the value to save:
window.bb.setToken('score', 1250);
window.bb.setToken('FirstName', 'Sam');
If the widget's ID is taxgame, these become {taxgame_score} and {taxgame_FirstName}.
It's good practice to check that the booth is available before calling it, so the widget still works when you preview it in a web browser:
if (window.bb && typeof window.bb.setToken === 'function') {
window.bb.setToken('score', 1250);
}
Examples#
Game score on the print
A tap game with the ID taxgame saves the player's score when the game ends. Add {taxgame_score} to a text field in the print layout to show the score on the print.
Choosing an AI effect
A widget with the ID era lets guests choose 70s, 80s or 90s and saves their choice as decade. Use the token in the effect URL so each guest gets the style they picked:
https://fx.breezesoftware.com/api/generate/your-account/{era_decade}
Guest details
A check-in widget with the ID vah saves FirstName, Email and OptIn. Use {vah_FirstName}, {vah_Email} and {vah_OptIn} anywhere you need that data.
Tips#
Save your tokens right before the widget starts the session (e.g. in the same tap that runs stillsStart or videoStart). Tokens saved too early can be cleared before the session begins.
Don't use a survey screen and a widget to collect data in the same session. The survey can overwrite tokens that the widget saved.
bb.tokens holds the tokens as they were when the widget loaded and doesn't update. To read the latest values, use bb.getTokens().
Auto Sharing Tokens#
Two special keys tell the booth to share automatically when the sharing screen is shown:
- autoemail: sends the email to the address saved in this token
- autotext: sends a text message to the phone number saved in this token. The number must include the + and country code, e.g. +61412345678
window.bb.setToken('autoemail', '[email protected]');
window.bb.setToken('autotext', '+61412345678');
The sharing screen must have Email or Text turned on for these to work.
Was this page helpful?
Thanks, that helps us improve the guides.