Central Hub is a social betting feature that enables users to share betslips, interact with other users, comment on bets, and manage their betting social network within the application. It serves as a comprehensive social layer for the betting experience.
To integrate the Central Hub widget, follow these steps:
This guide will walk you through each step with code examples and best practices.
If you are using the Virtual Stadium widget and you want to enable Central Hub, see Virtual Stadium Central Hub Feature.
Before adding the Central Hub widget, you need to include the SIR widget loader script.
See the Script Initiation section in the API documentation for detailed instructions on loading the SIR library and configuring global options.
Add the Central Hub widget for authenticated users to unlock the full social betting experience:
For detailed API method documentation, see the SIR API Reference.
jwt string required
Client's JWT token for authenticated access and betting functionality. See Authentication Configuration for details on JWT setup.
The jwt is a required attribute that needs to be set. See Widget Configuration for additional attributes.
Authenticated Widget Integration:
<html>
<head>
<title>Central Hub Integration</title>
<!-- 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>
<div id="central-hub-container"></div>
<script>
// SIR function is available immediately and queues actions until DOM is ready
/**
* TODO(developer): Replace 'your-jwt-token' with your actual JWT token
* before running this code.
*/
SIR('addWidget', '#central-hub-container', 'centralHub', {
jwt: 'your-jwt-token',
// ... additional attributes as needed
});
</script>
</body>
</html>Features are enabled through widget properties. These features require additional adapter configuration or backend integration.
To implement Central Hub correctly you need to support all of the features listed above.
Central Hub widgets support various configuration options to customize appearance, behavior, and functionality.
jwt string optional
Client's JWT token for authenticated access and betting functionality. See Authentication Configuration for details on JWT setup.
bookmakerThemeVersion string | object optional
Bookmaker branding and theming configuration.
Bookmaker Theme Configuration:
bookmakerThemeVersion: {
backgroundColor: '#1a1a1a',
textColor: '#ffffff',
oddNameBackgroundColor: '#333333',
oddNameTextColor: '#ffffff',
oddValueBackgroundColor: '#007bff',
oddValueTextColor: '#ffffff',
logoImage: 'https://example.com/logo.png',
hasBorder: true
}avatarGeneratorConfiguration object optional
Configuration for avatar color generation based on user ID.
saturation number required
Saturation value for avatar colors (0-100).
lightness number required
Lightness value for avatar colors (0-100).
range number required
Color range for avatar generation.
Avatar Generator Configuration:
avatarGeneratorConfiguration: {
saturation: 0.7,
lightness: 0.5,
range: 360
}isRelativeTimeFormat boolean optional
Controls time display format. Default is relative format ("4m ago"). Set to false for absolute time ("12
").dateFormat 'narrow' | 'short' | 'long' optional
Defines date format style. Default is 'narrow'. Use 'long' for better readability in some languages.
onAction function optional
Callback function triggered when specific events occur in the widget (bet placement, navigation, etc.).
onTrack function optional
Tracking callback function invoked whenever specified events occur in the widget. Events include data changes, user interactions, and errors.
Event Types:
data_change - Widget receives new data or encounters an errorodds_click - User clicks on an odds buttonsocial_share - User clicks on social share buttonlicense_error - Widget returns a licensing errorParameters:
eventType (string) - Type of triggered eventdata (object) - Relevant data depending on event typeTracking Events:
/**
* TODO(developer): Replace 'your-jwt-token' with your actual JWT token
* before running this code.
*/
SIR('addWidget', '#central-hub-container', 'centralHub', {
jwt: 'your-jwt-token',
onTrack: function(eventType, data) {
console.log('Event:', eventType, data);
// Track with analytics service
analytics.track('widget_event', {
event_type: eventType,
widget_data: data
});
}
});onDataChange function optional
Callback function triggered when widget data changes.
testMarkets string optional
Pipe-separated market IDs for testing specific market configurations (e.g., '7|8|12').
dbg boolean optional
Enables additional debugging options and verbose logging.
drawerState object optional
Programmatically control which screens (drawers) are open in the Central Hub widget and configure their initial state.
Example — Open to Bets Tab:
SIR('addWidget', '#central-hub-container', 'centralHub', {
jwt: 'your-jwt-token',
drawerState: {
screenName: 'centralHub',
params: {
activeTab: 'bets',
filterBy: 'followerBets'
}
}
});Drawer states allow you to programmatically control which screen is displayed when the Central Hub widget loads. Each drawer represents a specific view or functionality within the Central Hub.
The main dashboard that serves as the home screen for the social betting experience. Users can switch between two tabs:
drawerState: {
screenName: 'centralHub',
params:
{ activeTab: 'profile' } |
{
activeTab: 'bets',
filterBy: 'all' | 'followerBets' | 'mySharedBets' |
'myConversations' | 'winningBets',
sort: 'CREATED' | 'COMMENT_COUNT' | 'COPY_COUNT',
}
}
Shows a list of available betslips that can be shared to the social feed. Users can select from their active or settled betslips to share with their followers.
drawerState: { screenName: 'shareBetslipList' }
Opens the betslip sharing interface where users can add a caption, review the bet details, and publish it for their followers to see and potentially copy.
Requires a betslip parameter containing the BetSlip object to be shared.
drawerState: {
screenName: 'shareBetslip',
params: {
betslip: BetSlip
}
}
Opens the conversation thread for a specific shared betslip. Users can view all comments, add new comments, and engage in discussions about the bet.
Requires a betShareId parameter to identify which shared bet's comments to display.
drawerState: {
screenName: 'betslipCommenting',
params: {
betShareId: 'string'
}
}
Manage user relationships and discover new users to follow. This drawer provides three tabs:
Requires a userId parameter to identify which user's relationships to display.
drawerState: {
screenName: 'users',
params: {
activeTab: 'following' | 'followers' | 'search',
userId: 'string',
userDisplayName: 'string'
}
}
Displays a detailed profile view of another user. Shows their shared bets and provides options to follow/unfollow. Typically opened when clicking on a username from a shared bet or user list.
Requires a userId parameter to identify which user's profile to display.
drawerState: {
screenName: 'otherUserProfile',
params: {
userId: 'string'
}
}
Allows users to modify their profile information including display name, avatar, bio, and other personal settings.
drawerState: { screenName: 'editUserProfile' }
Displays all notifications related to comments on the user's shared bets — when someone comments on their bets or replies to their comments. Each notification links to the relevant betslip commenting screen.
drawerState: { screenName: 'commentsNotifications' }
Shows notifications related to betslip activity, including when users copy your bets or when followed users share new bets.
drawerState: { screenName: 'betslipsNotifications' }
Displays notifications about social interactions such as new followers, follow requests, and other user relationship events.
drawerState: { screenName: 'socialsNotifications' }
An onboarding screen shown to new users when they first access the Central Hub. Introduces key features and guides users through initial setup.
drawerState: { screenName: 'centralHubFirstTimeView' }
An introductory screen displayed when users first navigate to the Bets tab. Explains how to browse shared bets, use filters, and engage with the betting community.
drawerState: { screenName: 'betsSectionFirstTimeView' }
For optimal integration, implement features in this recommended order based on your chosen adapter approach:
Set Sportradar entity IDs on your channels.
Allow users to share their bets on social media and with other users directly from the widget.
Enable one-click bet copying so users can instantly replicate a shared bet slip.