Skip to content
  • There are no suggestions because the search field is empty.

We receive a prematch widget URL and the event later goes live. What should happen if the widget is no longer available?

Concerning the display of the live widget – to ensure the best user experience and avoid showing an icon for an unavailable widget, you should not rely on the successful generation of the API URL to determine if the widget is actually active. The widget URL is generated and available as soon as the match is added to the system, well before any live data starts flowing. Here is the expected flow and best practice for processing this scenario according to the documentation:

  1. Load the widget hidden in the background: When you receive the Live Widget URL from the API, load the iframe on your frontend but hide it initially using CSS (e.g., display: none or height: 0). Do not display the widget icon/button to the user at this stage.
  2. Listen for the DATA event to reveal the widget: Subscribe to the iFrame's Window.postMessage() events. When the match goes live and the data is confirmed to be actively flowing, the iFrame will emit a DATA event with the payload {"type": "DATA", "available": true}. Only upon receiving this true notification should you reveal the widget icon or the widget itself to your users. If the live widget data is not initially available for an event, the DATA notification will simply not be sent. Because you hid the widget by default, the user will never see a broken or empty widget.
  3. Handling subsequent data loss: If the widget is actively displayed but loses data later in the match (due to data loss or technical issues), it will emit {"type": "DATA", "available": false}. Simultaneously, the widget itself will render an empty state placeholder reading "Live stats not available". If you receive the false payload within the DATA event, you have two choices:
  4. You can automatically hide the widget and its icon again using CSS, waiting for the data to potentially return.
  5. Or, you can leave it open and let the user see the "Live stats not available" placeholder screen.

By hiding the widget by default and using the DATA event as a trigger to reveal it, you can ensure your users never click an icon expecting statistics only to be met with an unavailable widget.