Browser SDK
Install
Load staysignals.js on every page of your site and forward the collection ID at checkout.
Add one <script> tag to the <head> of every page. The SDK is designed to observe the full booking flow, so loading it only on checkout leaves most of the useful signal behind.
Script tag
<script
src="https://cdn.staysignals.com/staysignals.js"
data-publishable-key="pk_abc123def456…"
></script>Attributes
Prop
Type
Placement recommendations
- Load the tag in
<head>, not at the bottom of<body>— the SDK should start observing the session before the first page interaction. - Load it on every page of your site — landing, search, hotel detail, cart, checkout. Not just checkout.
Collection ID
The SDK starts collecting automatically for the current browser tab. At checkout, read the current collection ID with window.StaySignals.getCollectionId() and pass it to your server with the rest of the booking payload.
<form id="checkout" method="POST" action="/checkout">
<input type="hidden" name="staysignalsCollectionId" />
<!-- other fields -->
</form>
<script>
const field = document.querySelector('input[name="staysignalsCollectionId"]');
if (field) field.value = window.StaySignals?.getCollectionId() ?? '';
</script>If getCollectionId() returns null, continue without it. StaySignals can still score the booking from the server-side fields in your request.