How it works
From one script tag to a working booking section
No build step, no server of your own and no account on your site. Add the loader, place the widgets you want and decide what happens when a guest picks a room.
Install
Three steps
Each step is one line.
-
01 Add the script
Paste one line
Add the loader once, before the closing body tag. It is small, sets no cookies and works on any page.
Read the guideCode<script src="https://embeds.example.com/embed/stay.js" async></script> -
02 Place a widget
Add an empty element
Put a div where a section should appear and name the widget and your hotel. It fills in and grows to fit its content.
Browse the widgetsCode<div data-stay="rooms" data-hotel="your-hotel" data-layout="bento"></div> -
03 Guests choose
Take it from there
Every choice is an event on your page. Send guests to your booking engine with the stay filled in, handle it yourself, or let the platform take the booking.
How hand-off worksCodeStayEmbed.on('select', (e) => console.log(e.detail.roomName, e.detail.total))
Design
Make it yours
Four settings give a widget your look: an accent, ink and paper colour and a corner style, plus a headline font and a light or dark scheme. Set them once on the hotel, or override them on any widget.
-
Terracotta and cream
Attributesdata-accent="B4532A" data-ink="10292B" data-paper="F6F1E8" data-radius="soft" data-font="serif" -
Pine and linen
Attributesdata-accent="2F6F4E" data-ink="14261C" data-paper="F3F1E7" data-radius="soft" data-font="serif" -
Slate and brass
Attributesdata-accent="C48A00" data-ink="1B2430" data-paper="F2F0EB" data-radius="sharp" data-font="sans" -
Midnight harbour
Attributesdata-accent="E0A458" data-ink="0B1B2B" data-paper="EDE8DC" data-radius="round" data-font="serif" data-scheme="dark"
After the guest chooses
You decide what happens next
When a guest picks a room and a rate, the hotel chooses one of four behaviours. Nothing changes on your page.
-
Send them to your booking engine
The guest lands on your engine's page with the room, dates, guests and rate already filled in.
Examplehttps://book.example.com/?room={room}&checkin={checkin}&checkout={checkout}&adults={adults}Best when you already use a booking engine.
-
Tell your own page
The widget sends an event with the whole stay and does nothing else. Your code opens your own form or basket.
ExampleStayEmbed.on('reserve', (e) => openMyBasket(e.detail))Best when you have your own checkout.
-
Take the booking here
The platform checks the stay, holds the room, takes a deposit on Stripe's page, confirms the booking and emails the guest and the hotel.
ExampleHand-off Take the booking here Payments Stripe, 25% deposit Room held 30 minutesBest when you have no booking engine.
-
Use the demo checkout
A short form and a confirmation screen so you can see the whole flow. Nothing is saved, emailed or charged.
For demos and testing, not for taking bookings.
Taking bookings
Take the booking and the deposit yourself
With no booking engine, the platform can take the booking: it checks the stay, holds the room, collects a deposit on Stripe's page, confirms the booking and emails the guest and the hotel. Four things to set up, once.
-
01 Stripe
Add your Stripe key, or let us collect
Choose Stripe as the payment provider and paste your secret key, so deposits are paid straight to you. A test key (sk_test_…) takes test payments only, so try card 4242 4242 4242 4242 with any future date first. No Stripe account? Leave the key empty and we collect your deposits and pay you once a month.
CodePayments Stripe Secret key sk_test_… -
02 Webhook
Tell Stripe where to report
In Stripe's dashboard, add this address as a webhook endpoint, send it checkout.session.completed, checkout.session.expired and charge.refunded, and paste its signing secret into the hotel's record. Only messages signed with it are believed.
Codehttps://embeds.example.com/wp-json/stay/v1/stripe -
03 Email
Choose your emails
In your dashboard, open Emails and switch each one on or off: a confirmation, a cancellation and refund notice, a reminder the day before arrival, a thank you after the stay and your own notices. Choose the name your guests see and where their replies go, and send yourself an example of any of them first.
CodeConfirmation to the guest on Reminder before arrival on Thank you after the stay off Booking notice to you front-desk@your-hotel.com -
04 Deposit
Choose what is paid now
A percentage of the stay, the first night or a fixed amount. We suggest 25%: it keeps card fees small, because they apply to the deposit only, and the guest pays the rest at the hotel. Prepaid rates are paid in full. If a guest does not arrive, the deposit is not refunded. The room is held while the guest pays.
CodeDeposit 25% of the stay Room held 30 minutes
Events
Listen to what guests do
Every choice is an event on your page. Listen with the loader, with a DOM event, or send them to Google Tag Manager by adding one attribute.
// 1. The loader's API
StayEmbed.on('select', (e) => console.log(e.detail.roomName, e.detail.total))
// 2. A DOM event
window.addEventListener('stay:event', (e) => console.log(e.detail.type, e.detail.detail))
// 3. Google Tag Manager
<div data-stay="availability" data-analytics="dataLayer"></div>
| Event | When | In detail |
|---|---|---|
ready | A widget has loaded. | widget, height |
search | A guest chose dates or guests. | checkin, checkout, nights, adults, children |
select | A guest picked a room and a rate and pressed Reserve. | hotel, room, roomName, rate, checkin, checkout, nights, adults, children, total, currency, offer, promo |
reserve | In "tell my page" mode: the stay to book. | the same as select |
confirm | The demo checkout was confirmed. | reference, room, checkin, checkout, total, currency, demo |
open | A widget asked for another widget to open in the overlay. | widget, params |
Integrations
Where it fits
Plain HTML is enough. For the places most sites are built, the package has a shortcut.
-
WordPress
A one-file plugin adds shortcodes for every widget and a button that opens the booking overlay.
WordPress[stay widget="rooms" hotel="your-hotel" layout="bento"] [stay_book_button hotel="your-hotel"]Book now[/stay_book_button] -
React
A small component loads the script once and mounts a widget. Props are the options.
React<StayWidget widget="rooms" hotel="your-hotel" layout="bento" onEvent={(e) => track(e)} /> -
A plain iframe
No script on your page? Use an iframe. It has a fixed height, so it cannot grow with its content or open the overlay.
A plain iframe<iframe src="https://embeds.example.com/embed/rooms/?hotel=your-hotel&layout=grid" title="Rooms" loading="lazy" style="width:100%;height:1500px;border:0"></iframe> -
Tag manager
Add one attribute and every event is pushed to the data layer, ready for your analytics.
Tag manager<div data-stay="availability" data-hotel="your-hotel" data-analytics="dataLayer"></div>
Reference
Options every widget understands
On an element they are data attributes; on an iframe they are query parameters. Each widget adds its own, shown on the widgets page.
| Option | What it does | Default |
|---|---|---|
hotel | Which hotel (its slug). | the default hotel |
accent, ink, paper | Colours, as 6-digit hex without the #. | the hotel's own |
radius | sharp, soft or round corners. | the hotel's own |
font | serif or sans headlines. | the hotel's own |
scheme | light, dark or auto (follows the visitor). | the hotel's own |
bg | transparent to sit on your own page colour. | solid |
flush | 1 removes the outer padding, to line up with your own columns. | off |
h | The heading level the widget starts at (1 to 5), so it fits your page outline. | 2 |
title | 0 to hide the widget's own title. | 1 |
lang | A locale such as en-GB or de-DE for dates and money. | the hotel's |
height, height-sm | The first height in pixels (and for an element under 640 px wide) before the widget reports its own. | per widget |
min-height | The frame never shrinks below this. | none |
scroll | off stops the page scrolling to the widget after it changes screen. | on |
offset | Pixels to leave above the widget when the page scrolls to it (a sticky header). | 0 |
analytics | dataLayer pushes every event to window.dataLayer. | off |
The package
Get the package
The loader, an example page for every widget, a complete example hotel website, a WordPress plugin, a React component and a written guide, in one zip.
- The loader script
- An example page for every widget
- A whole example hotel website
- A WordPress plugin with shortcodes
- A React component
- A guide to every option and event
stay-embed-package.zip
22 files, 27 KB
Download the package Read the guidePlain files. Nothing to install on your server.