JavaScript SDK
JavaScript SDK for requesting and rendering ads in HTML, React and Vue.
Platform
Integration requires a platform ID and the addresses of the sites displaying ads.
| 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. |
Each address must match the request Origin exactly: scheme, host and port. List subdomains, including www, separately.
Installation
Load the script, create a client and supply an ad container.
<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>
platformId is your platform ID. Create one client for the app lifetime. The browser SDK does not require an API key.
Test ads
test: true returns a test ad without billing. Set the format with testFormat.
text · image · response · card · consent · quiz
Remove test or set it to false for live ads. Preserve the app response on no-fill or request failure.
An impression is paid once the ad is seen: at least half of the card on screen for at least one second. The SDK confirms the view itself.