Websites & CMS
Embed Microsoft Bookings in an HTML website
If you can edit the HTML of your pages, whether they are hand-written, generated by a static site tool or served by your own app, this is the whole install. Add the loader script once, put the element where the calendar belongs, and publish. Every other guide on this site is a variation of this one.
- Integration
- HTML website
- Plan: Free
- Works on every plan, including Free ($0, no card).
- In short
- One script tag and one element in any HTML page, hand-written or generated, with popup, floating and no-JavaScript options.
- Microsoft Bookings
- Stays your system of record. Bookings land in Outlook and Teams and Microsoft sends the invites and reminders.
What happens with HTML website
- The loader at bookingsxp.com/embed/v1.js is about 8 KB gzipped and loads with async, so it does not hold up your page. Including it twice is harmless.
- It finds each <bookingsxp-widget> element, or <div data-bookingsxp>, and draws an iframe inside it that resizes to its content on every step.
- Because the loader runs on your page, it pushes bookingsxp.* events to window.dataLayer, calls gtag when it is present, and reads the visit's UTM parameters and ad click IDs.
- Popup and floating modes draw a button on your page and open the widget in a dialog appended to body. The no-JavaScript iframe works too, without events or resizing.
Set up HTML website
Step 1: Add the loader once per page
Put the script anywhere in the page; just before </body> or in <head> are both fine. On a site with a shared layout or template, add it there once.
HTML <script src="https://bookingsxp.com/embed/v1.js" async></script>Step 2: Put the widget where the calendar goes
Use your widget ID from the dashboard, or booking-url with your public Microsoft Bookings link if you have no account. The element takes the width of its container and sets its own height.
HTML <bookingsxp-widget widget="w_8fk2m1qz"></bookingsxp-widget> <!-- or, with no account --> <bookingsxp-widget booking-url="https://outlook.office.com/book/YourBusiness@example.com/"></bookingsxp-widget>Step 3: Or a popup or floating button
Popup draws a button where the element is; floating pins one to the bottom-right corner of the page. Include accent so the button has your colour before the widget's saved settings load.
HTML <bookingsxp-widget widget="w_8fk2m1qz" mode="popup" button-text="Book a call" accent="#4f46e5"></bookingsxp-widget> <bookingsxp-widget widget="w_8fk2m1qz" mode="floating" button-text="Book now" accent="#4f46e5"></bookingsxp-widget>Step 4: Or open it from a button you already have
Call BookingsXP.open() from your own link or button. The queue stub lets this run even if your code loads before the script.
HTML <a href="#book" id="book-demo">Book a demo</a> <script> window.BookingsXP = window.BookingsXP || { q: [] }; document.getElementById("book-demo").addEventListener("click", function (e) { e.preventDefault(); BookingsXP.q.push(["open", { widget: "w_8fk2m1qz", accent: "#4f46e5" }]); }); </script>Step 5: If you send a Content-Security-Policy
Allow the loader and the widget frame. Without these, the console shows a script-src or frame-src violation and nothing appears.
Text script-src https://bookingsxp.com; frame-src https://bookingsxp.comStep 6: Check it is live
Open the published page over https in a private window. Type BookingsXP.version in the browser console: a version number means the loader is running. Step through the widget and type dataLayer to see the bookingsxp.* events, then make a test booking and cancel it in Microsoft Bookings.
Outcomes and caveats
What you get
- The full feature set: inline, popup and floating, auto-height, every page event and campaign attribution.
- No build step, package or framework needed. The same two lines work in a static site generator's templates.
- A no-JavaScript iframe for pages where scripts are not allowed.
Limits and caveats
- Open the page from a web server, even a local one, rather than as a file:// URL. Some browsers give file pages an opaque origin, which the widget's messages cannot be checked against.
- The no-JavaScript iframe has a fixed height and sends no events to your page.
- Markdown renderers and HTML sanitisers often strip unknown tags and script elements. Put the snippet in the layout template, or use the div form.
Troubleshooting
- Nothing appears where the element is.
- Open the browser console. A Content-Security-Policy error means the CSP above is missing. If BookingsXP is undefined, the script was not loaded: check the tag is in the published HTML (view source), and that an optimisation tool is not delaying or combining it.
- The widget is a thin strip or zero pixels wide.
- The element takes its container's width. Inside a flex or grid row, give it width: 100% or a min-width, for example <bookingsxp-widget style="display:block;width:100%">.
- The element is gone from the published page.
- Your CMS or Markdown renderer stripped the unknown tag. Use <div data-bookingsxp data-widget="w_…"></div>, which the loader treats the same way, and keep the script in the page template.
- The widget says "This booking widget isn't enabled on this website."
- Allowed websites is set on the widget and this domain is not on it. Add the domain, including any staging host you test on, or clear the list.
HTML website questions
Start free, no card
One widget, four templates, GTM and GA4 events and attribution in every booking. No card, no time limit.
No Microsoft sign-in or admin consent. Free plan, no card.