Widgets.us.common.ScoreTicker

us.common.scoreTicker tracks scores/matchups from the previous day(s), current day, and next day(s).

All properties are optional.

There are two general options for setting up the scoreticker widget.

A. Without matchId, sport or uniqueTournamentId props being set, the widget attempts to find and auto select sports with live games.

If there are multiple sports that are live at one time, the widget follows this order of operations: NFL playoffs, NBA playoffs, NCAAF playoffs, NCAAB NCAA tournament, MLB playoffs, NHL playoffs, NFL pro bowl, NBA All-Star game, MLB All-Star game, NHL All-Star game, NFL regular season, NBA regular season, NCAAF regular season, NCAAB regular season, MLB regular season, NHL regular season, Premier League, Champions League, LaLiga, Bundesliga, MLS playoffs, MLS regular season, Serie A, Ligue 1, Europa League, NCAAB NIT, NCAAB CBI, NCAAB CIT, NFL preseason, NBA preseason, MLB spring training, NHL preseason, NBA summer league.

It picks from allowedSports prop, if set. Otherwise, it picks from all supported sports. For soccer it further picks from allowedUniqueTournaments prop, if set. Otherwise, it picks from all supported unique tournaments.

Failing to find a live sport, and with considerNearest prop set to true, the widget would try next to select a sport with the nearest upcoming game.

Failing to find a live sport or an upcoming game with the considerNearest prop, the widget fallbacks to the NFL scoreticker for the current day.

The widget automatically reselects live games, or the nearest sport in line, to match status changes that occur over time.

Once a user selects another sport using the sport selector, the widget would stop automatically reselecting games and sports until the widget is reloaded (e.g. the web page gets refreshed).

B. If matchId or sport or uniqueTournamentId props are set, the widget simply initializes with that sport. Auto selecting sport is turned off in this scenario.


new ScoreTicker(props)

Parameters
Name Type Description
props object
Properties
Name Type Argument Default Description
matchId number | string <optional>

Match ID. Denotes match, sport, tournament and a day. Has priority over sport prop.

sport number | string <optional>
nfl

A name (string) or ID (number) of the (us) sport that will initially be displayed. Supported: soccer (1), nba (2), mlb (3), nhl (4), nfl (5), ncaaf (6), ncaab (7) - also depends on allowedProp input.

allowedSports array | string <optional>

Array or comma separated string of allowed sport (names or ids) to chose from sport selector or sport prop. Also denotes live/nearest sport auto selecting feature and sport selector items order. If sport prop default is not on the list its default changes to first allowed sport. Supported: soccer (1), nba (2), mlb (3), nhl (4), nfl (5), ncaaf (6), ncaab (7). In case of one sport (with the exception of soccer - see allowedUniqueTournaments), the sport toggle ability is removed and a sport label is displayed instead of sport selector. I not set all supported sports are allowed.

uniqueTournamentId number <optional>

Selected soccer unique tournament ID. Supported: 17 (EPL), 242 (MLS), 7 (UCL), 679 (UEL), 8 (LaLiga), 23 (Serie A), 35 (BundesLiga), 34 (Ligue 1), 16 (World Cup), 290 (Women World Cup). Has no effect in combination with other supported sports.

allowedUniqueTournaments array | string <optional>

Array or comma separated string of allowed soccer unique tournaments IDs to chose from sport selector or uniqueTournamentId prop. Also impacts live/nearest auto selecting feature and sport selector soccer items order. Supported: 17 (EPL), 242 (MLS), 7 (UCL), 679 (UEL), 8 (LaLiga), 23 (Serie A), 35 (BundesLiga), 34 (Ligue 1), 16 (World Cup), 290 (Women World Cup). In case of only soccer and one soccer unique tournament, the sport toggle ability is removed and a selected soccer unique tournament label is displayed instead of sport selector. For other sports, it is enough to be listed at allowedSports. If not set all supported soccer unique tournaments are allowed.

prevDays number <optional>
1

Number of previous days to chose from date control.

nextDays number <optional>
1

Number of next days to chose from date control.

flipOnEndDay boolean <optional>

Forces to flip to next day on day end. If a sport has games being played on consecutive days (e.g. Monday and Tuesday), the ticker will automatically flip to Tuesday's games at the end of the current day/start of the next day. If, however, a sport has games separated by a day (e.g. Monday and Wednesday), then the flipOnEndDay prop can be set to "true" and force the ticker to flip at the end of Monday/start of Tuesday. If set to "false" or left as the default option, the ticker would not flip to the next set of games until the end of Tuesday/start of Wednesday. As a rule, NFL and NCAAF are not affected by this prop's functionality. These two sports are set to flip based on weekly timers. NFL is set to flip to the next week at 5 a.m. UTC on Wednesdays, while NCAAF is set to flip to the next week at 5 a.m. UTC on Tuesdays. If there are live games from the previous week still taking place at those times, the week flip will be delayed until the conclusion of those games. Effects football (NFL and NCAAF) only.

dayFlipUTCHours number <optional>

Forces flipping to current day's games at a specified time based on UTC time zone, but not before start of the current day (in local time). Although the time is set according to UTC, it will effect end users according to their local time zone. Example: if the current date is 1/19/22, a value of 20 will set flipping at 12:00 for a user in PST time zone, 15:00 for EST and 21:00 for CET. However, using a value of 6 will set flipping at 0:00 PST (rather than 1/18/22 22:00 PST), 1:00 EST and 7:00 CET. An integer between 0 and 23. dayFlipUTCHours has priority over dayFlipHoursBefore.

dayFlipHoursBefore number <optional>

Forces flipping to current day's games a specific number of hours before scheduled time of the first match, but not before start of the current day (in local time). Example: if the first game of the day is at 7:30pm EST, a value of 7 would leave last night's games displayed until 12:30pm EST. An integer between 0 and 23.

mergeLive boolean <optional>

Displays all live matches today no matter when they were scheduled/started. Any matches that were scheduled the day before and continued past midnight will be moved to the previous day (their original displayed day) as soon as they are finished.

ncaaMarchMadnessOnly boolean <optional>

If set to true the ticker would show only the NCAA Division I Men's Basketball Tournament (i.e. NCAA March Madness) games for the NCAAB postseason. NIT, CBI, and CIT games would be removed from display.

considerNearest boolean <optional>
true

Auto selects sport with the nearest match if there are currently no live matches.

hasHorizontalSelectors number <optional>

Renders horizontal selectors instead of dropdowns. Typical use case: the HTML Inline Frame element.

h80 boolean <optional>

Sets widget fixed height 80px. Typical use case: the HTML Inline Frame element.

h90 boolean <optional>

Sets widget fixed height 90px. Typical use case: the HTML Inline Frame element.

layout string <optional>
'normal'

Sets type of layout. Valid values are normal and compact. The main difference is normal brakes navigation and match list for mobile breakpoint (480px) in 2 lines while compact layout keeps the sport selector and match list for mobile breakpoint in one line omitting the date selector. 'Compact' layout also has some different paddings, widths and uses carrot icon instead of hamburger icon for sport selector.

disableSportDropdown boolean <optional>

If true hides sports dropdown/label and takes away from the user the ability to change sport/unique tournament. If case of disabled sport selector and unset sport and uniqueTournamentId props the widget will operate in auto selecting mode indefinitely.

allowedNcaafDivisions string <optional>
'fbs'

Restricts the set of games when displaying NCAAF games to those where at least one of the teams belongs to a given division. When more than one division is given, they must be separated by a comma, e.g. fbs,fcs. By default only FBS games are displayed. See List of NCAA divisions/conferences for possible division values.

allowedNcaafConferences string <optional>

Restricts the set of games when displaying NCAAF games to those where at least one of the teams belongs to a given conference. The restriction applies only within a given division. E.g. if you specify only FBS conferences, then other divisions' games will still be displayed. To also restrict within other divisions use allowedNcaafDivisions and/or specify additional conferences from other divisions. See List of NCAA divisions/conferences for possible conference values.

allowedNcaabDivisions string <optional>
'dI'

Restricts the set of games when displaying NCAAB games to those where at least one of the teams belongs to a given division. When more than one division is given, they must be separated by a comma, e.g. dI,dII. By default only Division I games are displayed. See List of NCAA divisions/conferences for possible division values.

allowedNcaabConferences string <optional>

Restricts the set of games when displaying NCAAB games to those where at least one of the teams belongs to a given conference. The restriction applies only within a given division. E.g. if you specify only Division I conferences, then other divisions' games will still be displayed. To also restrict within other divisions use allowedNcaabDivisions and/or specify additional conferences from other divisions. See List of NCAA divisions/conferences for possible conference values.

showOdds boolean <optional>

When set to true displays odds for every game with odds available (pre-match only). When showOdds is enabled and oddsType is unset the three odds types, moneyline, spread or over/under, rotate through every 5 seconds.

oddsType boolean <optional>

Accepts a single input of moneyline, spread or overunder that overrides the rotating odds. Only a selected odds type displays in the ScoreTicker.

topGames array <optional>

Will accept any number or sd:match:X string of match IDs from all sports. When any IDs are included in the parameter, a 'Top Games' option will become available as the #1 priority in the sport selection menu. When the 'Top Games' option is selected, the ticker will show all included games sorted by sport.

onItemClick function <optional>

Function/event handler. Possible target items are match and us-sport. When the target is match it means a match has been clicked or touched and it emits various match values: matchId, sportId, usSport, realCategoryId, seasonId, tournamentId, uniqueTournamentId, awayTeamUid, homeTeamUid, matchStatus. When the target is us-sport it means a different sport (or a different soccer league) has been selected in the score ticker, and it emits usSport and uniqueTournamentId values. Valid matchStatus values are: pre, live, post. The usSport value is a numerical sport ID, it can contain same IDs as the sport prop. For example: match: {"matchId":27506858,"seasonId":79153,"tournamentId":10561,"uniqueTournamentId":132,"realCategoryId":15,"sportId":2,"awayTeamUid":3417,"homeTeamUid":3414,"matchStatus":"post","usSport":2};

Examples

HTML/Declarative

<div class="sr-widget" data-sr-widget="us.common.scoreTicker" data-sr-sport="soccer" data-sr-unique-tournament-id="8"></div>
<script type="application/javascript" src="https://widgets.media.sportradar.com/uscommon/widgetloader" data-sr-language="en_us" 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/uscommon/widgetloader","USW", {
        language: 'en_us'
    });
    USW('addWidget', '#sr-widget', 'us.common.scoreTicker', {matchId: 17132773});
</script>
<div id="sr-widget"></div>

JS/Example of using Event Handlers

<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/uscommon/widgetloader","USW", {
        language: 'en_us'
    });
    USW('addWidget', '#sr-widget', 'us.common.scoreTicker', {onItemClick: function(target, obj){alert(target+':'+JSON.stringify(obj));}});
</script>
<div id="sr-widget"></div>

JS/Allowing MLS(242) soccer league and all non soccer leagues (using array notation)

<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/uscommon/widgetloader","USW", {
        language: 'en_us'
    });
    USW('addWidget', '#sr-widget', 'us.common.scoreTicker', {allowedUniqueTournaments: [242]});
</script>
<div id="sr-widget"></div>

JS/Allowing European soccer leagues (using comma separated string notation)

<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/uscommon/widgetloader","USW", {
        language: 'en_us'
    });
    USW('addWidget', '#sr-widget', 'us.common.scoreTicker', {allowedSport: "soccer", allowedUniqueTournaments: "17, 7, 679, 8, 23, 35, 34"});
</script>
<div id="sr-widget"></div>

JS/Enabling Top Games)

<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/uscommon/widgetloader","USW", {
       language: 'en_us'
   });
USW('addWidget', '#sr-widget', 'us.common.scoreTicker', {topGames: [37592597, 36924091, 33623417, 34542559, 35431943, 'sd:match:afb0e513-ab69-4ca1-b1ae-a8ab3fc490a5', 36487917, '36489735', 35432599, 'ec9e43b0-c1d0-4ff8-aab6-9195721e39d3', 36922639]});
</script>
<div id="sr-widget"></div>