Set Up the Page
Every page with the plugin starts with init. It gives the page your plugin key, and optionally a theme, display and URL sync setting that every plugin on the page shares.
window.SportNinja = window.SportNinja || [];SportNinja.push(['init', { key: 'pk_sn_Y0JtVvplAnMGm1chyf9gOGckpWu8kXMy', theme: { primary: '#1C7ED6' },}]);What You Pass
Section titled “What You Pass”| Option | Required | Type | Default | What it does |
|---|---|---|---|---|
key |
Yes | string | The plugin key, pk_<brand>_…. Decides whose data is shown and which websites may show it. |
|
theme |
No | object | brand default | Colours, fonts, corners and spacing for every plugin on the page. See the Theme Reference. |
display |
No | object | Header, schedule layout, footer, size and alignment for every plugin on the page. See Display. | |
syncUrl |
No | boolean | true |
Keep the plugin’s page in your page’s address. See URL Sync. |
A plugin can still change any theme or display key for itself when you display it.
Good to Know
Section titled “Good to Know”- Order doesn’t matter. A plugin you show before
initruns waits for it, then appears as soon asinitarrives, in the order you asked for the plugins. - Running your setup again is safe. A second
initwith the same key only fills intheme,displayorsyncUrlif the first one didn’t set them, for plugins shown after it. Nothing the first one set changes. Sodata-keyon the script tag and an inlineinitwith a theme work together. - One key per page. An
initwith a different key is ignored with a console warning, and the first key stays. If one plugin really needs another key, passkeywhen you display it. - No key, no init. An
initwithout a key is ignored with a console warning.
Without a Script
Section titled “Without a Script”On a site builder that strips inline scripts, put the key on the script tag instead. It does the same as an init with only key (and syncUrl):
<script src="https://embed.sportninja.com/embed.js" data-key="pk_sn_Y0JtVvplAnMGm1chyf9gOGckpWu8kXMy" async></script>See No-Script Embed.