Betting Entertainment Tools

Tracking options

Use onTrack function as a prop to every widget. This function will be invoked whenever any of specified events occurs:

  1. 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.
  2. odds_click - user clicks on an odds button.
  3. social_share - user clicks on social share button,
  4. license_error - widget returns a licensing error.

Function emits two parameters containing triggered event (param1) and object with relevant data (param2).

Name Type Description
param1 string Type of triggered event, contains one of the following strings:
  • data_change,
  • odds_click,
  • social_share,
  • license_error.
param2 object Relevant data, object, contains data depending on the event type:
  • {'scheme', 'solution', 'component', 'version', 'language', 'channel', 'customer', 'brand', 'scope', 'sportId', 'categoryId', 'uniqueTournamentId', 'tournamentId','seasonId', 'matchId', eam1uid', 'team2uid', 'player1id', 'continentId', 'venueId', 'layout', 'user', 'streamId', 'player2id', 'error'} for data_change,
  • {visible: boolean} for odds_click,
  • {source: widget.name, target: facebook|twitter} for social_share,
  • {error: string} for license_error.

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>

Advanced example demonstrating how to use onTrack callback to preload widget and display it only if there is no error, can be found here.