Why you'd want this
Most tutorials on sports data APIs walk you through fetching JSON and rendering it yourself, which makes sense if you are building something custom. But a lot of the time you don't need custom. You need a live scoreboard sitting on a page, today, without a frontend sprint attached to it, and you'd rather not own the WebSocket reconnect logic for something that is not your core product.
This is a quick walkthrough of embedding a live score widget directly into a page with a script tag, instead of building the scoreboard UI from raw API responses.
Before you start
You'll want an API key even for the widget, since it authenticates the feed behind the scenes. Orbistats has a free tier that covers this: https://orbistats.com/signup.html
If you want to see what the widget looks like before wiring it into your own page, there's a preview on the widgets page itself: https://orbistats.com/widgets.html
The embed
The general pattern for this kind of widget is a small script tag plus a container element it mounts into. Something like this:
html
Check the exact snippet on the widgets page before shipping it, since widget embed conventions can vary slightly: https://orbistats.com/widgets.html
Match center instead of just scores
If a single scoreboard isn't enough and you want a full match center, drilling into one game with stats and events, the pattern is the same idea with a different widget type and a match identifier instead of a sport-wide feed:
html
You'd get the match id the same way you'd get one from the REST API, by listing fixtures for the day and picking the one you want to display.
Styling it to fit your page
Drop-in widgets are only useful if they don't look like they were dropped in. Most implementations expose a handful of CSS variables or a theme parameter for background, text color, and accent color rather than full style overrides, since that keeps the underlying markup stable across updates. Worth checking what's exposed before assuming you need to fight the widget with your own CSS overrides.
When to skip the widget entirely
If you already have a design system the scoreboard needs to sit inside pixel-for-pixel, or you need interactions the widget doesn't support, hand-rolling it against the REST or WebSocket API directly is the better call. The widget buys you speed, not infinite flexibility. Full API reference if that's the route: https://orbistats.com/developers/api-reference.html
Where to go from here
This covers embedding, not building your own from the raw feed. If you want that version instead, the developer docs cover both the REST and WebSocket paths depending on how live you need it: https://orbistats.com/developers/documentation.html
Curious if anyone here has gone the widget route and later ripped it out for a custom build, or the other way around. What was the actual trigger for switching?

Top comments (0)