JavaScript SDK
JavaScript SDK for requesting and rendering ads in HTML, React and Vue.
Platform
| Field | Value |
|---|---|
| Name | Platform name in the dashboard and reports. |
| Website addresses | HTTPS address without a path, e.g. https://chat.example.com. |
platformId | Public platform ID used to configure the SDK. |
| Production / Test | Set at creation. Test: demo ads only, without billing. |
| Frequency | 1, 5 or 10 requests per user. Editable on the platform page. Not applied to demo ads. |
| Origin | Exact scheme, host and port. HTTP allowed only for localhost, 127.0.0.1 and [::1]. |
Installation
Requires platformId and a target container. No API key required.
HTML / JavaScript
<div id="ad-slot"></div><script src="https://sidekick-ads.com/sdk/sidekick-web.js"></script><script>const ads = Sidekick.create({ platformId: "plt_example" });ads.requestAd({target: document.getElementById("ad-slot"),requestId: "chat-42-message-7",context: {question: "Headphones?",answer: "Here are some options…"},test: true,testFormat: "card"});</script>
Test ads
| Parameter | Value |
|---|---|
test | true |
testFormat | text / image / response / card / consent / quiz |
| Production | Live serving: test=false, Production platform. |
Page requirements
| Parameter | Requirement |
|---|---|
| Browser APIs | fetch, Shadow DOM, IntersectionObserver |
| URL | HTTPS / HTTP localhost; file://: unsupported |
| CSP | script-src: SDK; connect-src: API; img-src/media-src: asset origins; style-src: Shadow DOM styles. |