Skip to main content
Logo
Explore APIsContact Us
  • Home
  1. Resources
  2. Virtual Stadium
  3. SIR API

SIR API

SIR is the global JavaScript function that serves as the main API for Virtual Stadium integration. All methods follow the pattern:

Global SIR Reference

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.

#Script Initiation

The Virtual Stadium integration starts with including our script loader. This provides the global SIR function used for all widget operations.

#Script Loader

clientId string required

Your unique client identifier provided by Sportradar.

#Global SIR Options

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.

#Global SIR Function

SIR function required

Global function for widget and adapter management. See the SIR API Methods section below for details.

Basic Script Initiation:

html
<!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>

#SIR API Methods


#addWidget

Signature:

javascript
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).

javascript
// 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'
});

#updateWidget

Signature:

javascript
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:

javascript
// Update an existing widget with new settings
SIR('updateWidget', '#my-widget', {
    theme: 'dark',
    language: 'es'
});

#removeWidget

Signature:

javascript
SIR('removeWidget', container)

Parameters:

container string | Element required

DOM element or CSS selector containing the widget to remove.

Remove a Widget:

javascript
// Remove a widget from the page
SIR('removeWidget', '#my-widget');

#registerAdapter

Signature:

javascript
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:

javascript
// 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:

javascript
// Register a custom adapter implementation
SIR('registerAdapter', function(action, ...args) {
    // Custom adapter logic
    if (action === 'betPlacement') {
        return placeBet(args[0]);
    }
});

#changeLanguage

Signature:

javascript
SIR('changeLanguage', language)

Parameters:

language string required

Language code (e.g., 'en', 'es', 'fr'). Forces reload of all widgets.

Change Language:

javascript
// Change language for all widgets
SIR('changeLanguage', 'es');

#changeClockType

Signature:

javascript
SIR('changeClockType', clockType)

Parameters:

clockType '12' | '24' required

Clock display format. Forces reload of all widgets.

Change Clock Format:

javascript
// Change to 24-hour format
SIR('changeClockType', '24');

#changeOddsType

Signature:

javascript
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:

javascript
// Change to European decimal odds
SIR('changeOddsType', 'eu');

#changeTeamInvert

Signature:

javascript
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:

javascript
// Invert teams for all baseball matches
SIR('changeTeamInvert', { sid: { '3': true } });

#changeLogLevel

Signature:

javascript
SIR('changeLogLevel', logLevel)

Parameters:

logLevel 'error' | 'warn' | 'info' required

Logging level for debugging.

Change Log Level:

javascript
// Enable info level logging
SIR('changeLogLevel', 'info');

#setClientTheme

Signature:

javascript
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:

javascript
// Apply a custom theme with callback
SIR('setClientTheme', 'my-custom-theme', () => {
    console.log('Theme loaded successfully');
});

#Check

Signature:

javascript
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:

javascript
// 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);
    });
});
Last updated 13 days ago
Is this site helpful?
Virtual Stadium, Moderation, Engagement Tools
OverviewWidgets
On this page
  • Script Initiation
  • Script Loader
  • Global SIR Options
  • Global SIR Function
  • SIR API Methods
  • addWidget
  • updateWidget
  • removeWidget
  • registerAdapter
  • changeLanguage
  • changeClockType
  • changeOddsType
  • changeTeamInvert
  • changeLogLevel
  • setClientTheme
  • Check