Skip to content
Documentation menu
SDKWebJavaScript SDK

JavaScript SDK

JavaScript SDK for requesting and rendering ads in HTML, React and Vue.

Platform

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.
Production / TestSet at creation. Test: demo ads only, without billing.
Frequency1, 5 or 10 requests per user. Editable on the platform page. Not applied to demo ads.
OriginExact 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

ParameterValue
testtrue
testFormattext / image / response / card / consent / quiz
ProductionLive serving: test=false, Production platform.

Page requirements

ParameterRequirement
Browser APIsfetch, Shadow DOM, IntersectionObserver
URLHTTPS / HTTP localhost; file://: unsupported
CSPscript-src: SDK; connect-src: API; img-src/media-src: asset origins; style-src: Shadow DOM styles.