Skip to content
Documentation menu
SDKWebJavaScript SDK

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.

FieldValue
NamePlatform name in the dashboard and reports.
Website addressesHTTPS address without a path, e.g. https://chat.example.com.
platformIdPublic 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.

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>

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.