Here you find all widget groups. When you find your widget, be sure to enter correct widget name in addWidget function.
Read Getting started guide on how to include widgets on page and on finding widget name.
Widgets
- Custom Bet
- Custom Bet
- VirtualStadium
- Bet Assist
- Head To Head
- Match
- NBA
- Player
- Season
- Team
- Tournament
Methods
# static onTrack(param1, param2)
Use onTrack function as a prop to every widget. This function will be invoked whenever any of specified events occurs:
- data_change - whenever widget gets new data as a response to (external) prop change. If new data results in an error, the
error
property will be set. - odds_click - user clicks on an odds button.
- social_share - user clicks on social share button,
- license_error - widget returns a licensing error.
Function emits two parameters containing triggered event (param1) and object with relevant data (param2).
Parameters
Name | Type | Description |
---|---|---|
param1 |
string | Type of triggered event, contains one of the following strings:
|
param2 |
object | Relevant data, object, contains data depending on the event type:
|
Example
JS/Example of using Event Handler
<script>
(function(a,b,c,d,e,f,g,h,i){a[e]||(i=a[e]=function(){(a[e].q=a[e].q||[]).push(arguments)},i.l=1*new Date,i.o=f,
g=b.createElement(c),h=b.getElementsByTagName(c)[0],g.async=1,g.src=d,g.setAttribute("n",e),h.parentNode.insertBefore(g,h)
)})(window,document,"script","https://widgets.sir.sportradar.com/sportradar/widgetloader","SIR", {
language: 'en'
});
SIR('addWidget', '#sr-widget', 'match.matchList', {sportId: 1, onTrack: function(param1, param2){alert('param1: ' + param1 + ' param2: ' + JSON.stringify(param2))}});
</script>
<div id="sr-widget"></div>