Integration
The betting frame allows seamless integration into partner websites, providing a complete betting experience with customization options for theming, localization, and event handling. The integration can be done either as a Single Page Application (SPA) or with Server-Side Rendering (SSR), depending on your needs.
Configuration options
AppInitOptions
AppInitOptions is the top-level configuration object, which has the following structure:
1 2 3 4 5 6 7 8 9 10 11 |
|
Property | Description | Type | Required |
---|---|---|---|
token | Token of the current player Token | string | yes |
locale | Selected language | Locale code | yes |
currency | Currency code in the ISO:4217 format | string | yes |
rootElement | Identifier of the DOM element in which betting will be embedded | string | yes |
isAuthorized | Player's authorization status | boolean | yes |
url | All endpoints for betting | BettingUrl | yes |
features | A set of Features that are responsible for connecting various SPA functionality. | Record<FeatureKeys, boolean> | no |
defaultSettings | Default settings for the SPA. | DefaultSettings | yes |
BettingURL contains all the necessary endpoints for the SPA:
1 2 3 4 5 |
|
Property | Description | Type | Required |
---|---|---|---|
gqlEndpoint | Path to the GraphQL server | string | yes |
staticEndpoint | Path to the server where all the statistics are stored (js/css/assets ) | string | yes |
basename | The basename field is used to specify the base URL for all relative links within the embedded betting. This is particularly useful when the application is deployed within a subdirectory of a domain. | string | yes |
Features
The SPA provides an option for enabling or disabling various new, or experimental features:
IS_MEMORY_ROUTER
uses MemoryRouter instead of BrowserRouter, allowing internal navigation within the SPA without changing the site's URL
Default settings
DefaultSetting options are used to set the initial configuration of the application.
They define default values for various settings, such as display odds, which can later be changed by gambler.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
|
Property | Description | Type | Default value | Required |
---|---|---|---|---|
oddFormat | Default odd format for the SPA. | OddFormat | Decimal | false |
oddAcceptStrategy | Default odd accept strategy for the SPA. | OddAcceptStrategy | acceptAll | false |
SPA Integration
To integrate the betting SPA into your product, follow these steps:
1. Add DOM containers
You must include the following elements in your HTML layout:
- Main container — this is where the entire betting application will be rendered:
1
<div id="betting__container"></div>
- Betslip containers — separate elements for mobile and tablet betslip views (rendered only on corresponding devices):
1 2
<div id="betting-betslip-mob"></div> <div id="betting-betslip-tablet"></div>
Note
These elements must exist in the DOM before initializing the SPA
2. Add the bootstrap script
Include the script for the appropriate environment. Use the staging version during development and testing, and production for live deployment.
- Production:
1
<script type="module" defer src="https://spa.databet.cloud/v2/<project-name>/bootstrap.js"></script>
- Staging:
1
<script type="module" defer src="https://spa.int.databet.cloud/v2/<project-name>/bootstrap.js"></script>
Note
This links will be provided by data.bet
Note
type="module" is required attribute
3. Initialize the application
After the script loads, a global object bettingLoader becomes available on the window. Use its load method to start the SPA:
1 2 3 4 5 6 |
|
Example
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
|
Important
Changes to the token, locale, or currency require a page reload to take effect. This limitation is expected to be resolved in future updates.
4.Style the betslip containers
The SPA renders betslip views into two dedicated containers, depending on screen size:
Mobile betslip (#betting-betslip-mob) On our demo site, we applied the following styling using Tailwind CSS:
1 2 3 4 5 6 7 8 |
|
- When the betslip is closed, a small button sits 18px from the bottom.
- When opened, it expands to cover the entire screen.
- This behavior is controlled via the toggle-widget-betslip event.
In your configuration, this layout can be customized — for example, to account for a page footer, or to prevent the betslip from covering a sticky header.
Tablet betslip (#betting-betslip-tablet) On tablets, we use a sidebar that stretches the full height of the viewport:
1 2 3 4 |
|
SSR Integration
Note
Support for server-side rendering (SSR) is currently under development. Stay tuned for updates in future releases.