Embedding widgets

Put live scores and match detail blocks on your website with one snippet. No React or framework needed; data updates while matches are played.

Quick start

  1. Send us the domain that will embed the widget (e.g. https://www.example.com) so it can read the data.
  2. Add the script tag to the page once, anywhere.
  3. Place a div with data-sportx-widget where it should appear. A page can hold several widgets.
<script type="module" src="https://bbidt.name/widgets/v1/embed.js"></script>

<div data-sportx-widget="livescore" data-match-url="/tran-dau/{id}"></div>

Script and styles load from our servers and update with new releases; browsers may keep a previous version for up to 4 hours.

Connecting live scores to your match page

A common setup is live scores on your home page and detail blocks on your match page:

  1. On the live scores, set data-match-url to your match page structure, e.g. /matches/{id}.
  2. When a visitor clicks a match, the browser opens /matches/fm_… on your website.
  3. Your match page reads the id from its URL and puts it in each block's data-match-id.
<!-- /tran-dau/fm_xxxxxxxxxxxx -->
<div data-sportx-widget="match" data-block="scoreboard"></div>
<div data-sportx-widget="match" data-block="timeline"></div>
<div data-sportx-widget="match" data-block="lineups"></div>
<script>
  const id = location.pathname.split("/").pop();
  for (const el of document.querySelectorAll('[data-sportx-widget="match"]')) {
    el.dataset.matchId = id;
  }
</script>
<script type="module" src="https://bbidt.name/widgets/v1/embed.js"></script>

Documentation