Correlation examples demonstrate how widgets can communicate with each other by passing properties on user interactions. This enables you to create connected widget experiences where clicking an element in one widget updates another.
All correlation examples use the universal click callback function onItemClick, which receives two arguments:
| Parameter | Type | Description |
|---|---|---|
type | string | Type of clicked element: 'match', 'player', 'team', 'season', 'realCategory', 'tournament', or 'uniqueTournament' |
obj | object | Data object specific to the widget and element type. Properties vary by widget. |
Use the code example below to inspect available properties for any widget by replacing 'player.selector' with your target widget name.
View Inspection Code Example
<div class="container"></div>
<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'
});
alert('Click on any player to get correlation info.');
SIR('addWidget', '.container', 'player.selector', {
onItemClick: function(type, obj) {
alert('Clicked item type:\n"' + type + '"\n\nObject:\n' + JSON.stringify(obj, null, '\t'));
}
});
</script>Correlation examples work best with Chrome and Firefox browsers.
How It Works:
| Input Widget | Output Widget | Shared Properties |
|---|---|---|
match.matchlist | LMT demo page | • matchId |
For the best presentation, choose a live match when testing this correlation.
How It Works:
| Input Widget | Output Widget | Shared Properties |
|---|---|---|
player.selector | player.info | • playerId• teamId• uniqueTournamentId |
How It Works:
| Input Widget | Output Widget | Shared Properties |
|---|---|---|
team.selector | team.info | • seasonId• uniqueTournamentId• teamUid |
How It Works:
| Input Widget | Output Widget | Shared Properties |
|---|---|---|
season.liveTable | team.leaderboard | • matchId• seasonId• uniqueTournamentId• teamUid |
team.leaderboard | player.info | • playerId• teamUid• uniqueTournamentId |
This example demonstrates multi-level widget correlations where one interaction triggers a chain of updates.
How It Works:
| Input Widget | Output Widget | Shared Properties |
|---|---|---|
season.liveTable | team.basketball.info | • seasonId• teamUid |
For more information about widget integration and advanced features: