DocsWidgets
Widgets
Embed the oddsmatcher and the calculators on your own site with one script tag. Live odds need a browser key, available on the Enterprise plan; the calculators need no key.
The script is one file (58 kB gzipped, 207 kB raw) that mounts every data-or-widget element on the page. Each widget renders in a shadow root, so your CSS can't break it and its styles can't reach your page. It loads no fonts, images or iframes.
<div data-or-widget="oddsmatcher"
data-or-region="uk"
data-or-key="or_pub_YOUR_BROWSER_KEY"></div>
<script src="https://oddsrelay.io/widgets/v1/oddsrelay-widgets.js"
crossorigin="anonymous" async></script>Configure a widget and copy its snippet in the widget library.
Script URLs
The same script is served at two URLs. Choose by who decides when your embed updates.
| URL | When to use it |
|---|---|
| /widgets/v1/oddsrelay-widgets.jsCached 5 minutes | Updates with fixes and new widgets automatically. This is what every snippet on this site emits. |
| /widgets/v/<version>/oddsrelay-widgets.jsCached for a year | Never changes, and supports integrity. You choose when to move. |
The original path /widgets/oddsrelay-widgets.js still works and serves the same file as v1.
Don't self-host the script
A copy on your own CDN stops getting fixes, and we can't see which version you run when something goes wrong. If you need a fixed file, use a pinned URL.
Pinning a version
The current version is 0.9.0. Its hash comes from the same build step that produces the bytes, so the value below cannot drift from what the URL serves.
<script src="https://oddsrelay.io/widgets/v/0.9.0/oddsrelay-widgets.js"
integrity="sha384-0wMNhY6MUTnS9iqW4j8mJn3SxnMnTUchZnk5rZzEAG3WqxKT4cnIg3xqJgPFp4mr"
crossorigin="anonymous" async></script>Keep crossorigin="anonymous" on every snippet. Without it the browser ignores integrity, and errors from our script reach your monitoring as a bare "Script error." with no message, stack or line number.
A pinned embed gets no fixes until you change the URL. window.OddsRelay.version shows the version running on a page.
For a security review
- Content-Security-Policy: the directives the script needs
- Consent managers: how to categorise it
- Storage and privacy: what it stores
- Versioning: what can change
- Install and troubleshooting: why it might not render