Widgets.meta.HottestMatchSelector

Sets a default match ID that is then used by widgets that are not already configured with a match ID. If a match ID is already set globally, then it does nothing.

The widget attempts to find a live match. Failing that it then tries to find an upcoming match, and failing that it finds a past match. If more than one match qualifies (e.g. more than one live match), it selects the most interesting match.

First, it selects among matches which correspond to one of favorite tournaments IDs. Otherwise it picks from all available matches.

For the widget to work you need to provide sportId. Other properties are optional.

To set a match ID globally:

  • when using the declarative approach, set the data-sr-match-id attribute on the <script> tag that loads the widget loader,
  • when using the programmatic approach, set the matchId property on the object that is the 6th argument to the widget loader initializer.

new HottestMatchSelector(props)

Parameters
Name Type Description
props object
Properties
Name Type Argument Description
sportId number

Sport Id. Check enum.sport to get valid values.

favouritesUtIds array <optional>

array of unique favorite tournaments IDs. To narrow the choice. Tournament IDs must comply with the specified sport ID.

onMatchSelect function <optional>

onMatchSelect callback function. Returns matchId on callback selected by the widget. If a match ID is already set globally, then callback is not triggered.

Examples

HTML/Declarative

<div data-sr-widget="meta.hottestmatchselector" data-sr-sport-id="1"></div>
<script type="application/javascript" src="https://widgets.media.sportradar.com/sportradar/widgetloader" async></script>

HTML/Declarative with favourites favorite tournament IDs

<div data-sr-widget="meta.hottestmatchselector" data-sr-sport-id="1"  data-sr-favourites-ut-ids="[17, 35, 8, 34, 23, 7]"></div>
<script type="application/javascript" src="https://widgets.media.sportradar.com/sportradar/widgetloader" async></script>

JS/Programmatic

<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.media.sportradar.com/sportradar/widgetloader","USW", {
        language: 'en'
    });
    USW('addWidget', '#sr-widget', 'meta.hottestmatchselector', {sportId: 1});
</script>
<div id="sr-widget"></div>

JS/Programmatic with favourites favorite tournament IDs

<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.media.sportradar.com/sportradar/widgetloader","USW", {
        language: 'en'
    });
    USW('addWidget', '#sr-widget', 'meta.hottestmatchselector', {sportId: 1, favouritesUtIds: [17, 35, 8, 34, 23, 7]});
</script>
<div id="sr-widget"></div>

JS/Programmatic with onMatchSelect function callback

<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.media.sportradar.com/sportradar/widgetloader","USW", {
        language: 'en'
    });
    USW('addWidget', '#sr-widget', 'meta.hottestmatchselector', {sportId: 1, onMatchSelect: callback});
    function callback(id) {
        console.log('matchId', id);
    }
</script>
<div id="sr-widget"></div>

JS/Programmatic with a global match ID set

<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.media.sportradar.com/sportradar/widgetloader","USW", {
        language: 'en',
        matchId: 11440439
    });
    USW('addWidget', '#sr-widget', 'meta.hottestmatchselector', {sportId: 1});
</script>
<div id="sr-widget"></div>