https://<brand-name>.widgets.unibo.io/in-game/widget.js<!-- 1. Set player cookies --><script>document.cookie = "unibo_userId=player_123; path=/";document.cookie = "unibo_registrationDate=2023-07-30T00:00:00+00:00; path=/";document.cookie = "unibo_language=en; path=/";</script><!-- 2. Add a custom styled button to open the widget --><button id="unibo-igw-button">Campaigns</button><!-- 3. Add the notification layer to your game --><div id="unibo-igw-notifications" /><!-- 4. Load the widget --><script src="https://<brand-name>.widgets.unibo.io/in-game/widget.js"></script>
unibo_userIdplayer_123unibo_registrationDate2023-07-30T00:00:00+00:00unibo_registrationDate2023-07-30T00:00:00+00:0016906752001690675200000unibo_languageendeunibo_currencyEURunibo_currency is only required for platforms with a multi-currency setup where a player can have more than one account currencyid following this pattern:id="unibo-igw-button"
<button id="unibo-igw-button" class="your-button-class">Campaigns</button>
Existing click handlers are preserved. If your button already has anonclick, it will still fire alongside the widget open action.
<!DOCTYPE html><html><head><title>Example Casino</title></head><body><nav><button id="unibo-igw-button" class="nav-btn">Tournaments</button></nav><script>document.cookie = "unibo_userId=player_123; path=/; Secure; SameSite=Lax";document.cookie = "unibo_registrationDate=1690675200; path=/; Secure; SameSite=Lax";document.cookie = "unibo_language=en; path=/; Secure; SameSite=Lax";</script><script src="https://<brand-name>.widgets.unibo.io/in-game/widget.js"></script></body></html>
// UniboWidget.jsximport { useEffect, useRef } from 'react';const WIDGET_SCRIPT_URL = 'https://<brand-name>.widgets.unibo.io/in-game/widget.js';function setUniboCookies({ userId, registrationDate, language = 'en', currency = 'EUR' }) {const opts = 'path=/; Secure; SameSite=Lax';document.cookie = `unibo_userId=${userId}; ${opts}`;document.cookie = `unibo_registrationDate=${registrationDate}; ${opts}`;document.cookie = `unibo_language=${language}; ${opts}`;}export function UniboWidget({ userId, registrationDate, language, currency }) {const scriptLoaded = useRef(false);useEffect(() => {if (!userId || !registrationDate || scriptLoaded.current) return;setUniboCookies({ userId, registrationDate, language, currency });if (document.querySelector(`script[src="${WIDGET_SCRIPT_URL}"]`)) {scriptLoaded.current = true;return;}const script = document.createElement('script');script.src = WIDGET_SCRIPT_URL;script.async = true;document.body.appendChild(script);scriptLoaded.current = true;}, [userId, registrationDate, language, currency]);return null;}// Nav.jsxexport function Nav() {return (<nav><buttonid="unibo-igw-button"className="nav-btn"type="button">Campaigns</button></nav><div id="unibo-igw-notifications" />);}