Operator Integration Instructions
Please note that the code snippets displayed in this article are intended to be used for assessment and testing purposes only. Prior to going live, please reach out to integrations@imgarena.com.
Integration Library
The Front Row Seat integration library is distributed with an ES module build and a UMD build, the examples below use the UMD syntax for clarity and to show the simplest implementation. When using via an import
statement the ES module build be used.
The ES module build is intended for use in modern browsers* which support Javascript syntax and features released after 2016. These features allow web browsers to deliver better performance with smaller Javascript bundle sizes, causing users to experience faster page loads and response rates from the UI. This is the recommended approach due to its performance benefits.
The UMD build is intended for use in legacy browsers that do not support modern Javascript features referenced above. The build contains polyfills which allow these legacy browsers to make use of the Front Row Seat integration library, but this comes at a cost of a larger bundle size which will result in slower initial page load times.
* Most popular "modern web browsers" are: Chrome, Safari, Microsoft Edge and Firefox. All of which are available on both mobile and desktop.
The package is distributed using npm, where both ES module and UMD builds are available: https://www.npmjs.com/package/@img-arena/front-row-seat
The UMD build is available on unpkg: https://unpkg.com/@img-arena/front-row-seat
For more information on how to use unpkg please see their docs: https://unpkg.com/
Usage
All that is needed to integrate an IMG Arena Event Centre into your website is:
Add a containing HTML DOM element for where the Event Centre should appear
Include the integration library script
Initialise the integration library
The code below shows an example of integrating a Golf Event Centre with placeholder values.
Target Element
There may be occasions where it is preferable to pass in an element node instead of a string for the target destination of the event centre.
The targetElementSelector
property can be either a string for the selection of a DOM element, or an element node itself.
Initialisation
To handle the synchronising of Event Centre with your site there are two methods exposed on the return value from the eventCentre
initialiser: on
and emit
. Both these methods follow the pub/sub pattern for asynchronous message exchange. The on
method is for receiving messages from the Event Centre, whereas the emit
method is for sending messages to the Event Centre.
Modularisation for Golf Stokeplay:
The Event centre supports being initialised in seven different modular configurations, Provide the required module to the library:Initialisation value
Module name
Description
Notes
full
All Event Centre
leaderboard
Leaderboard Only (no global navigation)
leaderboarddetail
Leaderboard & Team/Player (no global navigation)
course
Course & Hole Only (no global navigation)
hole
Hole Only (No navigation back to Course)
holeNo must be passed in initialContext, see below for more details
groupdetail
Groups List & Group Detail
groups
Group Only
minileaderboard
Mini Leaderboard with 7 top players
No global navigation
Modularisation for Golf Match Play (covers Ryder Cup)
full
All Event Centre
matchlist
Match list Only (no navigation to match detail)
matchdetail
Match detail Only (no navigation to match list)
To target one of the above pass the initialisation value to the targetModule
field when initialising the event centre, for example to initialise an Event Centre with only the Leaderboard module:
Theming
The theme of the event centre can be configured by passing in a value for the theme
parameter, this is how operators can add their brand colours and typography; the IMG Arena integrations team manage this process.
Backend Environment
The backend environment used by the event centre can be changed by setting a value to the env
initialisation parameter. Defining this field is optional, if it is omitted the default value is "prod", see below for each environment's data source.
Environment
Data Source
prod
DDE Production
sims
DDE Simulation
Options
Some additional options can be specified in the options
field.
videoPlaybackEnabled
Enables viewing broadcasts when they are available
false
true
userId
Used for google analytics tracking
undefined
"123e4567"
units
Used for operators wishing to use metric units, rather than imperial
undefined
"metric"
holeNavOnly
Used for operators wishing to have only hole nav on course-live-streams
view
false
true
oddsFormat
Used to specify odds format ('fractional', 'decimal', 'moneyline')
undefined
"moneyline"
Fractional Odds Example:
Deep Linking
The Event Centre also supports being initialised with a specific UI state. This is achieved by passing in a "Context Update" message object, detailed below, when initialising the Event Centre. These can include specific tournaments, rounds, players etc.
View
Required initial context fields
Optional initial context fields
leaderboard
view
player-detail-hole
view, teamNo
roundNo, holeNo
player-detail-scorecard
view, teamNo
roundNo
player-detail-shots
view, teamNo
roundNo
playoff-detail-hole
view, groupId
roundNo, holeNo°
playoff-detail-shots
view, groupId
roundNo, holeNo°
groups
view
GroupDetail
view, groupNo, roundNo
holeNo
group-detail-hole
view, groupId
roundNo, holeNo
group-detail-scorecard
view, groupId
roundNo, holeNo
group-detail-shots
view, groupId
roundNo, holeNo
course
view
course-live-streams
view, holeNo
course-detail-hole
view, holeNo
course-detail-scorecard
view, holeNo
courseId
course-detail-shots
view, holeNo
courseId
Golf Match Play (covers Ryder Cup) Views
match-play-list
tournament, view
match-play-detail-hole
tournament, view, matchNo
holeNo
match-play-detail-scorecard
tournament, view, matchNo
holeNo
match-play-detail-shots
tournament, view, matchNo
holeNo
match-play-streaming
tournament, view
match-play-streaming-hole
tournament, view, holeNo
° For playoff views the holeNo field MUST take it's value from the holeOrder field from DDE feeds
The following are examples of these message objects and their corresponding UI states:
Full Event Centre with Event ID 207
Subscribing
The on
method is available on the return value from the eventCentre
initialiser, it is used to subscribe to messages emitted from the Event Centre. The supported message topics are exposed on the eventCentreUtils
namespace, eventCentreUtils.MessageTopics
, and are detailed below. The callback receives a single value which is an object containing the respective fields to the message topic subscribed to.
Emitting
The emit
method is available on the return value from the eventCentre
initialiser, it is used to send message to the Event Centre. Only supported message topics will be passed to the Event Centre.
Emitting context updates to synchronize the event centre
The event centre emits context updates whenever the webpage navigates to a new route. These context updates can be used to keep track of what users are doing in the event centre. For example, these events can be used to display appropriate markets when a user navigates to a certain player, hole or group.
The other scenario is that a user is navigating on your webpage, and you would like to synchronize the event centre to display similar contextual data. In this case it is possible to emit context updates to the event centre. These updates will allow you to control what page/view the event centre is displaying.
Note: These updates will not re-create the event centre therefore it is not possible to change things like the tournamentId or the theme.
The list of possible views and their required fields that can passed into the CONTEXT_UPDATE topic is covered above in the Golf Views section.
Note: The values that are passed for initialContext
when creating the eventCentreInstance
can also be used as data for context updates.
See below a few examples:
Navigate to groups list
Navigate to a player
Navigate to a group's shots view
Languages
Please see the Language Translations Available page to the left.
Message Topics
All the tables below detail the data fields present in the message data objects that are sent and received for each message topic.
Handshake Failed MessageTopics.HANDSHAKE_FAILED
MessageTopics.HANDSHAKE_FAILED
Dedicated topic to signify the handshake between Event Centre and your site failed to complete. This topic is emitted by the integration library, it should only be subscribed to, not emitted.
Field
Type
Description
Required
timestamp
number
unix timestamp from time of failure
✅
Context Update MessageTopics.CONTEXT_UPDATE
MessageTopics.CONTEXT_UPDATE
Topic for covering general UI state updates, for example navigation changes or the user selecting a player in the UI.
Field
Type
Description
Required
view
string
The name of the active view
✅
tournamentId
number or string
Identifier for the tournament
✅
roundNo
number or string
The round the user is currently viewing data from
-
holeNo
number or string
The hole the user is currently viewing data from
-
playerNo
number or string
The player's ID
-
groupNo
number or string
The group's ID
-
From iframe to parent message. List of possible events:
View
Component
Action
Sending parameters
Leaderboard
Leaderboard
onLoad
view
tournamentId
roundNo
Group List
GroupList
onLoad
view
onRoundChange
tournamentId
roundNo
Course
Course
onLoad
view
tournamentId
roundNo
onRoundChange
view
tournamentId
roundNo
holeNo
All Bets
AllBets
onLoad
view
tournamentId
roundNo
Group Detail
GroupDetail
onLoad
view
onTeamChange
tournamentId
onHoleChange
roundNo
holeNo
groupNo
playerNo
Hole
Hole
onLoad
view
onGroupChange
tournamentId
onTeamChange
roundNo
onHoleChange
holeNo
groupNo
playerNo
Player
Team
onLoad
view
onRoundChange
tournamentId
onHoleChange
roundNo
holeNo
playerNo
Selection Updates MessageTopics.SELECTION_UPDATE
MessageTopics.SELECTION_UPDATE
Dedicated topic for handling user selection updates. The selected
field within the message data handles both selecting and deselecting updates.
Field
Type
Description
Required
marketId
number or string
supplied by Mustard
✅
betId
number or string
supplied by Mustard
✅
selected
boolean
whether or not the UI state should display as selected
✅
On all views client app uses the same component Bet, so we need to send message in the one place. Message is sent after selecting or unselecting bet. Sending payload:
MessageTopics.VIDEO_PLAYBACK_AUTH_REQUEST
Dedicated topic when the user has requested video playback. You must listen for this event and respond to using VIDEO_PLAYBACK_AUTH_RESPONSE
as described below.
MessageTopics.VIDEO_PLAYBACK_AUTH_RESPONSE
Topic to provide authorisation for video playback.
operatorId
string
as supplied by ALC
✅
auth
string
generated by your backend
✅
timestamp
number
timestamp in milliseconds since epoch
✅
error
Error
error message should auth not be possible
-
Last updated