SIR is the global JavaScript function that serves as the main API for Virtual Stadium integration. All methods follow the pattern:
This page documents the Virtual Stadium–specific subset of the SIR API. For the full global SIR API reference shared across all Sportradar widgets, see the SIR API Documentation.
The Virtual Stadium integration starts with including our script loader. This provides the global SIR function used for all widget operations.
clientId string required
Your unique client identifier provided by Sportradar.
language string optional
Default language for all widgets (ISO language codes like 'en', 'es', 'fr').
clockType '12' | '24' optional
Clock display format. Default is 24-hour format.
unitType 'metric' | 'imperial' optional
Unit system for measurements (length, weight, temperature, speed).
oddsType 'eu' | 'uk' | 'us' optional
Odds format: 'eu' (decimal), 'uk' (fractional), 'us' (american).
theme string | false optional
Global theme. Can be a theme name ('betradar', 'sportradar', 'betradardark', 'sportradardark') or false to disable theming.
logLevel 'warn' | 'info' | 'error' optional
Logging level for debugging. Default is 'warn'.
debug boolean optional
Enables debug mode, which sets logLevel to 'warn' if not specified.
SIR function required
Global function for widget and adapter management. See the SIR API Methods section below for details.
Basic Script Initiation:
<!DOCTYPE html>
<html>
<head>
<!-- Virtual Stadium Script Loader -->
<script>
/**
* TODO(developer): Replace <CLIENT_ID> with your actual client ID
* provided by Sportradar before running this code.
*/
(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/<CLIENT_ID>/widgetloader", "SIR", {
language: "en"
});
</script>
</head>
<body>
<!-- ... -->
</body>
</html>Signature:
SIR('addWidget', container, widgetType, config)Parameters:
container string | Element required
DOM element or selector where the widget will be rendered.
widgetType string required
Type of widget to load ('virtualStadium', 'button', 'quickBet').
config object optional
Widget configuration options (see Widget Configuration section below).
// Add a Virtual Stadium widget to a container
/**
* TODO(developer): Replace 'your-jwt-token' with your actual JWT token
* and 'your-channel-id' with your actual channel ID before running this code.
*/
SIR('addWidget', '#my-container', 'virtualStadium', {
jwt: 'your-jwt-token',
channelId: 'your-channel-id'
});Signature:
SIR('updateWidget', container, config)Parameters:
container string | Element required
DOM element or CSS selector containing the widget to update.
config object required
Updated configuration options to apply to the widget.
Update Widget Configuration:
// Update an existing widget with new settings
SIR('updateWidget', '#my-widget', {
theme: 'dark',
language: 'es'
});Signature:
SIR('removeWidget', container)Parameters:
container string | Element required
DOM element or CSS selector containing the widget to remove.
Remove a Widget:
// Remove a widget from the page
SIR('removeWidget', '#my-widget');Signature:
SIR('registerAdapter', adapterNameOrImplementation, options)Parameters:
adapterNameOrImplementation string | function | Promise required
Hosted adapter name (string) or custom adapter implementation.
options object optional
Configuration options for hosted adapters.
Register Hosted Adapter:
// Register a hosted adapter by name
/**
* TODO(developer): Replace 'your-api-key' with your actual API key
* before running this code.
*/
SIR('registerAdapter', 'myAdapter', {
apiKey: 'your-api-key'
});Register Custom Adapter:
// Register a custom adapter implementation
SIR('registerAdapter', function(action, ...args) {
// Custom adapter logic
if (action === 'betPlacement') {
return placeBet(args[0]);
}
});Signature:
SIR('changeLanguage', language)Parameters:
language string required
Language code (e.g., 'en', 'es', 'fr'). Forces reload of all widgets.
Change Language:
// Change language for all widgets
SIR('changeLanguage', 'es');Signature:
SIR('changeClockType', clockType)Parameters:
clockType '12' | '24' required
Clock display format. Forces reload of all widgets.
Change Clock Format:
// Change to 24-hour format
SIR('changeClockType', '24');Signature:
SIR('changeOddsType', oddsType)Parameters:
oddsType 'eu' | 'uk' | 'us' required
Odds format: 'eu' (decimal), 'uk' (fractional), 'us' (american). Forces reload of all widgets.
Change Odds Format:
// Change to European decimal odds
SIR('changeOddsType', 'eu');Signature:
SIR('changeTeamInvert', teamInvert)Parameters:
teamInvert object required
Team display inversion settings. Forces reload of all widgets.
teamInvert.all boolean optional
Invert all matches.
teamInvert.sid Object.<string, boolean> optional
Dictionary of sport IDs to invert.
teamInvert.rcid Object.<string, boolean> optional
Dictionary of real category IDs to invert.
teamInvert.utid Object.<string, boolean> optional
Dictionary of unique tournament IDs to invert.
Invert Teams for Baseball:
// Invert teams for all baseball matches
SIR('changeTeamInvert', { sid: { '3': true } });Signature:
SIR('changeLogLevel', logLevel)Parameters:
logLevel 'error' | 'warn' | 'info' required
Logging level for debugging.
Change Log Level:
// Enable info level logging
SIR('changeLogLevel', 'info');Signature:
SIR('setClientTheme', theme, callback)Parameters:
theme string required
Theme to load. Can be a theme name or URL.
callback function optional
Function called when theme is loaded.
Apply Custom Theme:
// Apply a custom theme with callback
SIR('setClientTheme', 'my-custom-theme', () => {
console.log('Theme loaded successfully');
});Signature:
SIR('check', callback)Parameters:
callback function optional
Callback function receiving array of instantiated widgets. Each item contains widgetDomElement, widgetInstance, and widgetClass.
Check for Auto-initialized Widgets:
// Check for widgets initialized from data attributes
SIR('check', (widgets) => {
console.log('Found', widgets.length, 'widgets');
widgets.forEach(widget => {
console.log('Widget:', widget.widgetDomElement.id);
});
});