Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.


This page describes how to integrate with the variety of SmartStream products Multisport Game Tracker product with examples.

All SmartStream Game Tracker products are hosted by Betgenius Genius Sports and designed to be embedded within a client-hosted webpage via an iframe.

SmartStream Release Process

SmartStream is released to it’s user acceptance testing (UAT) environment every two weeks with new features and bug fixes. Release notes will be published at the start of each cycle detailing what features and fixes are to be included in the release.

After two weeks have passed with no critical issues, the version will be pushed to Production where it will be visible on your live site. It is at your discretion that you keep track of these release notes to ensure you are still successfully integrating and that you are satisfied with the new and upcoming version of SmartStream.

A separate UAT SmartStream URL will be included as part of your integration details for you to use. It is highly recommended that you We encourage you to reach out regarding the timeline for when the widget will be ready. It is highly advisable to maintain a replica environment of your own site with that incorporates the UAT version of SmartStream integrated to enable you to review up-and-coming Game Tracker. This will allow you to preview upcoming features and fixes before they reach are deployed to Production.

Image Removed

Embedding a product

To display the HTML SmartStream product on your page you will first need to add the following scripts into the body of the page, preferably at the bottom to ensure that the SmartStream application is loaded after the elements of the page itself. The demo URLs should be replaced with your customer specific URLs, which will be provided by Betgenius once a client specific version of the application has been generated.

Code Block
languagexml
<script src="https://bsdemo.betstream.betgenius.com/betstream-view/public/bg_api.js" type="text/javascript"></script>
  <script>
          var iframeApi = new IFrameApi("betgenius-iframe");      
  </script>

The iframe code below should be placed within the body of the webpage where you would like the HTML SmartStream product application to appear. The script below is an example that embeds a Football Scorecentre product and should be replaced with the location of your client specific product which will be provided by Betgenius. The id of the iframe should match the parameter passed in the JavaScript object above.

Code Block
languagexml
<iframe scrolling="no" id="betgenius-iframe" src="https://bsdemo.betstream.betgenius.com/betstream-view/footballscorecentre/betstreamfootballscorecentre/html?eventId=1234" width="320" height="289"></iframe>

Below is an example Football Scorecentre product that would be loaded in this way:

Image Removed

iPhone Specific Integration

If the application is to be used on a mobile site intended for end users on Apple iPhones, additional code is required to ensure that iframe load widths are maintained correctly.

The below should be included within the header:

Code Block
languagexml
<meta name=”viewport” content=”initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no”>

With the following included in the body of the page after the iframe:

Code Block
languagejs
<script type=”text/javascript”>
     function addLoadEvent(fn) {
         var oldonload = window.onload;
         if (typeof window.onload != 'function') {
             window.onload = fn;
         } else {
             window.onload = function () {
                 if (oldonload) {
                     oldonload();
                 }
                 fn();
             }
         }
     }
     function addResizeEvent(fn) {
         var oldonresize = window.onresize;
         if(typeof window.onresize != 'function') {
             window.onresize = fn;
         } else {
             window.onresize = function () {
                 if(oldonresize) {
                     oldonresize();
                 }
                 fn();
             }
         }
     }
     function adjustIframeSize() {
         var iframeEl = document.getElementById("betgenius-iframe");
         var docWidth = "" + document.body.clientWidth + "px";
         iframeEl.style.width = docWidth;
     }
     
     addLoadEvent(adjustIframeSize);
     addResizeEvent(adjustIframeSize);
 </script>

Fixture Specific Products

Some products we offer such as the Football, Tennis and Basketball Scorecentres are fixture-specific in that they display information for a particular fixture. In order for these components to work, they require a fixture ID of an available fixture to be passed to them through the query parameter eventId. For example:

Football:
Single module Scorecentre:
https://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/footballscorecentre?eventId=1234

Modular Scorecentre, Live / pitch module:
https://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/footballpitchgraphic?eventId=1234

Modular Scorecentre, Commentary module:
https://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/footballcommentary?eventId=1234

Modular Scorecentre, Scoreboard module:
https://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/footballscoreboard?eventId=1234

Modular Scorecentre, Statistics module:
https://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/footballstatistics?eventId=1234

Horse Racing:
https://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/horseracingracecard?eventId=1234

Basketball:
https://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/basketballscorecentre?eventId=1234

Tennis:
https://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/tennisscorecentre?eventId=1234

MultiSport:
http://bsdemo.betstream.betgenius.com/betstream-view/page/betgenius/multisportscoreboard?eventId=1234

The URL’s that you will integrate with will be specific to each customer, for example, if you are called FreshBet, then your URL will be https://freshbet.betstream.betgenius.com/betstream-view/page/freshbet/footballscorecentre?eventId=1234

SmartStream exposes a coverage feed which lists all sport-specific fixtures available to you:

https://bsdemo.betstream.betgenius.com/betstream-view/getMappedFixtures/v1/product/betgeniusfootballscorecentre/sport/football

https://bsdemo.betstream.betgenius.com/betstream-view/getMappedFixtures/v1/product/betgeniustennisscorecentre/sport/tennis

https://bsdemo.betstream.betgenius.com/betstream-view/getMappedFixtures/v1/product/betgeniusbasketballscorecentre/sport/basketball

https://bsdemo.betstream.betgenius.com/betstream-view/getMappedFixtures/v1/product/betgeniushorseracing/sport/horseracing

Example Response:

Code Block
languagexml
<Set>
<string>5409817</string>
<string>4994191</string>
<string>5409823</string>
</Set>

This feed returns a list of available fixture identifiers that can be used with the relevant sport-specific product. By default the response will return XML; you can request a JSON response by appending .json to the end of URL like so:

https://bsdemo.betstream.betgenius.com/betstream-view/getMappedFixtures/v1/product/betgeniusfootballscorecentre/sport/football.json

Example response:

Code Block
languagexml
["5409817","4994191","5409823"]

However, we would recommend using the request Accept header to request your desired format, i.e. Accept: application/json or Accept: application/xml.

You will receive your own mappings feed URL as part of your integration details if your product is fixture-specific.

In order for this feed to work, you need to have exposed your own fixtures/odds feed that Betgenius can consume and match to external data providers internally like real-time score providers. Below is an example of what the feed you need to expose could look like:

Download Odds Market Feed Sample

Code Block
languagexml
titleExpand Source to see the full message!
collapsetrue
<?xml version="1.0"?>
<betgenius xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="file:///c:/dotnet/XSL/DataAcquisition/Schema/DataAcquisition.xsd">
	<!-- Comments
	id: all @id attributes should be unique
	startTime: @startTime should be in specific format. example 2015-05-30T15:00:00Z
	currentScore: market/@currentScore attribute should be available for inPlay(inRunning) markets, if possible
	context: contains description of the fixture
	
	links: feed should have main url, from where child URL can be created based on region or country or competition.
	This helps to speed up all processing
	Main URL:
		Football
			England
			Spain
			France
			Italy
		IceHockey
			NHL
			KHL
		Basketball
			NBA
		
	-->
	<links>
		<link address="http://bet365.com/BarclaysPremierLeague" context="Barclays Premier League"/>
	</links>
	
	<fixtures>
		<fixture id="456456" name="Arsenal v Manchester Utd" startTime="2015-05-30T15:00:00Z" source="Bet365" sport="Football" context="England > Premier League">
			<competitors>
				<competitor id="11111" name="Arsenal" role="0"/>
				<competitor id="22222" name="Manchester Utd" role="1"/>
			</competitors>
			<markets>
				<market id="984989844" name="Half-time Handicap" marketType="" eachwayPlaces="" eachwayFactor="" isSuspended="0" marketLinkInfo="" inPlayStatus="false">
					<selections>
						<selection id="24234343" name="Arsenal" fractionalPrice="3/1" decimalPrice="2.22" handicap="-5.25" isSuspended="false" />
						<selection id="44444443" name="Draw" fractionalPrice="4/1" decimalPrice="5.00" isSuspended="false" />
						<selection id="24234433" name="Manchester Utd" fractionalPrice="3/1" decimalPrice="2.22" handicap="+5.25" isSuspended="false" />
					</selections>
				</market>
				<market id="984989843" name="Match Result" currentScore="0-0" marketType="" eachwayPlaces="" eachwayFactor="" isSuspended="0" marketLinkInfo="" inPlayStatus="True">
					<selections>
						<selection id="2423434" name="Arsenal" fractionalPrice="3/1" decimalPrice="2.22" handicap="5.25" isSuspended="false" />
						<selection id="4444444" name="Draw" fractionalPrice="4/1" decimalPrice="5.00" isSuspended="false" />
						<selection id="2423443" name="Manchester Utd" fractionalPrice="3/1" decimalPrice="2.22" handicap="5.25" isSuspended="false" />
					</selections>
				</market>
			</markets>				
		</fixture>
		<horseRacingFixture name="4:40" venue="Ascot" startTime="2014-07-23T17:05:00" id="545454!" sport="Horse Racing" source="Bet365" context="Horse Racing > UK and Ireland > Ascot">
			<competitors>
				<horseRaceCompetitor id="111222" name="Devilment">
					<horse id="999888" name="Devilment" owner="" trainer="" age="4"/>
					<jockey id="777777" name="A.P. McCoy" silkUrl=""/>
				</horseRaceCompetitor>
				<horseRaceCompetitor id="222111" name="Chivers">
					<horse id="121212" name="Chivers"/>
					<jockey id="1313133" name="Ruby Walsh" silkUrl=""/>
				</horseRaceCompetitor>
				<horseRaceCompetitor id="333333" name="Lucky Jim" />
			</competitors>
			<markets>
				<market id="46666666" name="Win" eachwayPlaces="4" eachwayFactor="1/4" isSuspended="0" inPlayStatus="InPlay">
					<selections>
						<selection id="0909090" name="Devilment" fractionalPrice="3/1" decimalPrice="2.22" isSuspended="true" />
						<selection id="0909009" name="Chivers" fractionalPrice="SP" decimalPrice="SP" isSuspended="false" />
					</selections>
				</market>
			</markets>
		</horseRacingFixture>
	</fixtures>
</betgenius>

If the product you have purchased also supports markets, this feed should also provide the market information per fixture as per the example.

The minimum information you need to provide per fixture should include:

  • Unique Fixture ID
  • Fixture Name
  • Sport
  • Fixture Start Time (UTC)
  • Competitor Ids
  • Competitor Names
  • Source (your name, as a customer)

Please ensure that the fixtures remain in your feed until the end of the game. If the fixture is removed then the content will stop being displayed.

Placing a bet in a SmartStream component

Given that the iframe from Betgenius you integrated with has the ID ‘betgenius-iframe’, you need to add the following code to listen to selections being clicked:

Code Block
languagejs
<script>
    var iframeApi = new IFrameApi("betgenius-iframe");
    iframeApi.onMessage = function(message) {
      window.MESSAGES.push(message);
      switch (message["command"]) {
        case "addToBetslip":
          console.log(message["selection"]);
          break;
        }
    };
</script>

The selection ID being added is present in the property.

Code Block
languagejs
 message[“selection”]

With Betbuilder widget the message contract is extended to include the following elements:

Code Block
languagecss
{ command: "addToBetslip", selection: "1234567", sportsbookFixtureId: "56789", marketId: "100120022", sportsbookMarketId: "1234567", sportsbookMarketContext: "ABCDE", }


The documentation does not specify the available competitions, as we depend on what is accessible and being covered at any given time. Currently, only American Football has logic that is specific to a competition. For the Multisport Game Trackers, we are committed to retrieving the data; if it exists, we will ensure its display.

Embedding a widget/game tracker



In order to initiate the Integration Project, Genius Sports requires the whitelisting of the external client domains where the widgets will be utilized.