Skip to main content

Initialize

After DOM is successfully loaded, Partner has to init BTRenderer by calling initialize() method.

note

Sportsbook inherits fonts from the parent page. Specific font can be applied on the sportsbook div element as well.

note

Once a player has switched the language, signed in/out it is necessary to call initialize() method and pass the updated parameters to it.

note

It is strongly recommended to use and update betSlipOffsetTop and betSlipOffsetBottom parameters to avoid UX conflicts in cases when your header/footer has dynamic height.

Partner can directly open a page inside of the frame by specifying ?bt-path=/page_address in the URL.

List of parameters

NameTypeRequiredDescription
brand_idstringYesUnique Partner's Website ID obtained during the onboarding process
Partner receives it from Fungamess
tokenstringYesUnique time-limited JWT token assigned to each user
Pass token: null for unauthorized users
Platform would receive it from the Fungamess
onTokenExpiredfunctionYesA function that returns a response with a new JWT token when the previous one is expired
Mandatory for authorized users
To get such token, the platform must send a request from its front to back end, along with the POST-request, from the backend to Fungamess, with a refreshSportbookToken method, that contains { id: User ID, api_token: User Token } request body
The platform's frontend should not send a request directly to the Fungamess
themeNamestringYesUnique name of the theme, provided by Fungamess
langstringYesFrame language (default: en)
The full list of supported languages can be found in Appendices section
The abbreviation is case-sensitive
Language code in ISO 639-1 format (e.g., en, ru, es)
targetHTMLElementYesAn element of DOM to render a betslip, in the form of div element instead of iframe
Works similarly to Defining container
betSlipOffsetTopnumberYesThe parameter that defines the gap between top of the window and a betslip (for example, fixed header)
betSlipOffsetBottomnumberYesThe parameter that defines the gap between bottom of the window and a betslip (for example, fixed footer)
betSlipOffsetRightnumberYesThe parameter that defines the gap between right side of the window and a betslip (for example, fixed sidebar)
betslipZIndexnumberYesThe parameter that defines the index of betslip in relation to DOM elements used on Partners website
It helps to avoid overlapping conflicts between different elements
Value should be 100 or more
urlstringYesThe parameter that defines the page that will be shown to the user after the initialization of the application
For example, if url=/1 page with soccer will be shown
stickyTopnumberYesThe parameter that defines the range between top of the window and sticky (fixed) elements in the application (sidebar etc.)
It is recommended to use the parameters of Partner's fixed header
Use 0 in cases when there is no fixed header
scrollTopButtonPositionstringYesThe parameter that defines the scroll button position in the mobile version of the website
There are two possible values: left and right
scrollToTopButtonVisiblebooleanYesThe parameter that defines the scroll button display in the mobile version of the website
There are two possible values: true and false
onRouteChangecallbackYesCallback function provided by Partner, it will be called when a player navigates across the frame
onLogincallbackYesCallback function provided by Partner, it will be called when a player logins with the frame
Partners must specify what should happen when the login button is pressed
For example, open a modal window with a login form or switch to another page (don't forget about the bt.kill() method, which should be called when the user refreshes the page)
onRegistercallbackYesCallback function provided by Partner, it will be called when a player registers with the frame
Partners must specify what should happen when user clicks on the register button
For example, open a modal window with a register form or switch to another page (don't forget about the bt.kill() method, which should be called when the user refreshes the page)
onSessionRefreshcallbackYesCallback function provided by Partner, it is responsible for the process of page refresh and sport initialization with the updated parameters
onRechargecallbackYesCallback function provided by Partner, it will be called when a player makes a deposit with the frame
Partners must indicate where the user goes when they click on Make a deposit button
onBannerClickcallbackYesCallback function provided by Partner, it will be called when a player clicks on line_banner
onOutcomeClickcallbackYesCallback function provided by Partner, it will be called when a player clicks on line_banner or any widget, and the outcome is added to the betslip
onBetSlipStateChangecallbackYesCallback function provided by Partner, it will be called when player opens or closes the betslip
This function accepts a boolean parameter isOpen { isOpen: true \ false }
betSlipButtonHTMLElementYesWill be used when a player adds outcome to the betslip on mobile device
Relevant in case when Partner uses his own betslip button
Animation will be directed to the DOM element provided by Partner with the options { betSlipButton: someHTMLElement }
handlePageChangeHTMLElementYesCallback function provided by Partner, it will be called when a user navigates between pages inside of the application
This function accepts a single parameter - url
This callback should be used only for custom routing

Example

var bt = new BTRenderer().initialize({
brand_id: "11111111111111111",
token: "<JWT token>",
onTokenExpired: function() {},
themeName: "default",
lang: "en",
target: document.getElementById('betby'),
betSlipOffsetTop: 0,
betslipZIndex: 999,
onRouteChange: function() {},
onLogin: function() {},
onRegister: function() {},
onSessionRefresh: function() {},
onBetSlipStateChange: function() {}
});