Skip to main content

Add and Update

Add and update interface let you add and update widgets to your page. Add and update methods share the same API.

SDW.addWidget(widget: Widget);
SDW.updateWidget(update: widget);
interface Widget {
containerId: string;
type: WidgetType;
locale?: string;
settings: WidgetSettings;
groupId?: string; // This is important for split widgets. A widget group shares a data source.
onTrack?: (event: TrackingEvent) => void;
}

enum WidgetType {
Calendar = 'calendar',
Topbar = 'topbar',
Match = 'match',
SplitMatch = 'split-match',
}

interface WidgetSettings {
// calendar settings
ignoreMapItemCategories?: MapCategory[];
ignoreTimelineItemCategories?: TimelineCategory[];
titleFilter?: GameTitle[];
tournamentFilter?: string;
groupCalendarByLive?: boolean;

// topbar only settings
disableAutoSelectMatch?: boolean;

// topbar and calendar relevant settings
matchWidgetId?: string; // If set, detail opens in external match widget.
tickerOnly?: boolean; // If set, matches ain't selectable.

// match settings
matchId?: string;
// Fuzzy match a fixture if possible
fuzzyMatchFixture?: FuzzyMatchFixture,

// split match settings
dynamicHeight?: boolean;
leftTeam?: string;
rightTeam?: string;
keepTeamSides?: boolean;
elements?: WidgetElement[];
playerStatsDataPoints?: DataPoint[];
}

type GameTitle = 'dota' | 'cs'
type TimelineCategory = 'player' | 'grenade' | 'bomb' | 'round' | 'team' | 'damage' | 'game_state' | 'stream_issue' | 'score' | 'map_state' | 'draft_event' | 'building' | 'roshan' | 'tormentor' | 'ward' | 'item' | 'game_state' | 'multi_kill' | 'timer' | 'stream_issue' | 'score';
type MapCategory = 'bomb' | 'player' | 'grenade' | 'ancient' | 'building', 'ward' | 'roshan';

interface DataPoint {
name: string; // Name of the data point
essential?: boolean; // If true, the data point is always shown unless not enough space.
}

interface FuzzyMatchFixture {
homeTeam: string;
awayTeam: string;
date: string | Date; // Must be iso string if string is used
}

Widget Properties explained

type: string constant -> required

Please see our demo page to see the different widget types in action. Depending on the nature of the widget, there are settings on a widget type basis available.

containerId: string -> required

Please note that you always need to define the container id of where you want to render the widget to. If the provided element cannot be found in the DOM the widget will not be visible. Please check your browser's console if you do not see what you expect for possible integration issues.

groupId: string -> required for split-match widgets only

Split-match-widgets are able to consume one data source for improved performance. Therefore, you can render multiple split-match elements in various containers without worrying about performance. All split-match widgets that have the same groupId will consume the same data source. It is recommended to use one groupId per fixture.

settings: object -> optional

Let's take a look at a widget's possible settings.

PropertyWidget typesDefault ValueDescription
matchIdm, smundefined (required)Match id to display a single match.
fuzzyMatchFixturem, smundefinedIf match id isn't know you can fuzzy match your fixture with team names and date time
groupCalendarByLivec, tfalseGroups matches in your calendar depending on if they are live.
tournamentFilterc, tundefinedFilter your matches by tournament. Use 'lec' for example to only view LEC games.
titleFilterc, t['all', 'dota', 'csgo']Filter your matches by game title.
matchWidgetIdt, cundefined (required)Container Id where the match widget should be attached to.
disableAutoSelectMatchtfalseIf enabled the first live match in the list is auto-selected on load for calendar.
bayesTvEnabledm, c, tfalseEnabled BayesTV. ONLY AVAILABLE FOR BETTING CUSTOMERS!
elementsm, c, sm*see list belowMatch elements to be seen in your widget.
dynamicHeightm, c, smfalseWidget iframes do resize their height automatically and always show full size.
leftTeamm, c, smundefinedManually define the team that is shown on the left side of UI. Fuzzy string match.
rightTeamm, c, smundefinedManually define the team that is shown on the right side of UI. Fuzzy string match.
keepTeamSidesm, c, smfalseMake teams stick to home and away side even if they switch sides during a game.
ignoreMapItemCategoriesm, c, smundefinedList of map item categories not to be shown on the map.
ignoreTimelineCategoriesm, c, smundefinedList of timeline item categories not to be shown in the timeline element.
WidgetTypeAbbreviation
matchm
calendarc
topbart
split-matchsm

Widget elements

Widget elements define the visual features of your widget. The following table breaks these down. Elements can either be prematch (data you can see before a match starts), live (data you see while a match is ongoing) or postmatch (results composed from a complete match). The following table visualizes your options.

ConstantTitleWidget typesWidget typeDescription
'PrematchStreaks'CS2, DOTAm, c, sm, tprematchLatest win/loss streaks.
'PrematchMapVotes'CS2m, c, sm, tprematchCS map votes before a match starts.
'PrematchPastMatches'CS2, DOTAm, c, sm, tprematchPast head-to-heads of the competing teams.
'PrematchRoster'CS2, DOTAm, c, sm, tprematchCurrent known team roster.
'PrematchPlayerPerformance'CS2, DOTAm, c, sm, tprematchHistorical player stats averages from recently recorded matches.
'PrematchTeamPerformance'CS2, DOTAm, c, sm, tprematchHistorical team stats averages from recently recorded matches.
'PrematchMapWinPercentage'CS2m, c, sm, tprematchMap win percentage calculated from the last 6 months.
'RoundScore'CS2m, c, sm, tliveIn-game round score.
'HorizontalTimeline'CS2, DOTAm, c, sm, tliveHorizontal timeline view of important in-game events.
'Timeline'CS2, DOTAsmliveVertical timeline of in-game events.
'RealtimeMap'CS2, DOTAm, c, tliveIn-game map and timeline in a tabbed view.
'RealtimeMapAndVideo'CS2, DOTAm, c, tliveIn-game map, live stream and timeline in a tabbed view. (betting clients only)
'PlayerStats'CS2, DOTAm, c, sm, tliveIn-game player stats.
'PlayerStatsTable'*CS2, DOTAm, c, sm, tlivePlayer stats as a table view.
'TeamStats'CS2, DOTAm, c, sm, tliveIn-game team stats.
'Bans'DOTAm, c, sm, tliveBanned heroes from draft phase.
'MapName'CS2m, c, sm, tliveCS map name and current map score.
'Map'CS2, DOTAsmliveIn-game map view.
'MiniMap'CS2, DOTAsmliveEnhanced map view with additional data.
'GameClock'CS2, DOTAsmliveIn-game clock.
'Video'CS2, DOTAsmliveLive stream (betting clients only).
'ResultsPastMatches'CS2, DOTAm, c, sm, tpostmatchMap results.
'ResultsPlayerPerformance'CS2, DOTAm, c, sm, tpostmatchAverage player performances from current match.
'ResultsTeamPerformance'CS2, DOTAm, c, sm, tpostmatchAverage team performances from current match.
'FixtureInfo'CS2, DOTAsmallBasic info about the fixture. Available for all match stages.

Player stats table special case

PlayerStatsTable element has composable stats. That means you can define and prioritize certain data points you want to see in your player stats table. There is a defined set of stats you can choose from. Essential player info is always part of the dataset though. From screen size of more than 420px you can select up to 8 data points. 4 below that. Data points marked as essential will always be visible (up to 4).

Data pointtitledefaultDescription
main_weaponCS2includedShowing the current main weapon of a player. If player does not have a main weapon, secondary weapon is displayed instead.
health_percentageCS2, DOTAincludedCurrent health of the player
armorCS2includedHas armor or not.
current_moneyCS2includedShowing the current money.
equipment_valueCS2noCS current equipment value of a player.
killsCS2, DOTAessentialKills of a player.
assistsCS2, DOTAessentialAssists of a player.
deathsCS2, DOTAessentialDeaths of a player.
adrCS2essentialAverage damage per round.
headshotsCS2noHeadshots.
levelDOTAessentialDota hero level.
minion_killsDOTAincludedCreep score.
total_goldDOTAincludedTotal gold of a player.
xpDOTAnoExperience.
deniesDOTAnoDenies of a player.