Widget Integration Guide
Step-by-step guide for embedding the WeatherIt Checkout Widget into partner checkout and confirmation pages.
This guide covers everything a partner development team needs to embed the WeatherIt Checkout Widget into their site.
1. Add the Script Tag
Load embed.js on any page that will contain a WeatherIt component. The script registers all three custom elements — only components present in the DOM will activate.
Production:
<script src="https://widget.weatherit.ai/embed.js" async></script>Versioned (immutable, 1-year cache):
<script src="https://widget.weatherit.ai/v1/embed.js" async></script>Sandbox (for testing):
<script src="https://widget-sandbox.weatherit.ai/embed.js" async></script>
Always include theasyncattribute. The widget initialises independently and should not block page rendering.
2. Checkout Page Setup
Add two components to your checkout page — typically on the "extras" or "add-ons" step.
weatherit-widget — Protection Selector
The main component. Fetches a quote and displays protection options.
<weatherit-widget
partner="{WEATHERIT_PARTNER_ID}"
lat="{location.latitude}" lon="{location.longitude}"
suburb="{location.suburb}" state="{location.state}"
start="{booking.checkin}" end="{booking.checkout}"
amount="{booking.total}" booking="{booking.reference}"
type="{booking.type}" experience="{property.name}"
product_name="{booking.productType}"
></weatherit-widget>Attribute Reference:
| Attribute | Type | Required | Example | Description |
|---|---|---|---|---|
partner | string | Yes | Partner UUID | Your WeatherIt partner identifier |
lat | number | Yes | -20.287 | Location latitude |
lon | number | Yes | 148.679 | Location longitude |
suburb | string | Yes | Airlie Beach | Location suburb |
state | string | Yes | QLD | State (2-letter code) |
start | date | Yes | 2026-07-01 | Protection start date (YYYY-MM-DD) |
end | date | Yes | 2026-07-04 | Protection end date (YYYY-MM-DD) |
amount | number | Yes | 651.00 | Booking value |
booking | string | Yes | BK-123456 | Your booking reference |
type | string | Yes | camping | Experience type |
experience | string | Yes | BIG4 Airlie Beach | Experience name |
product_name | string | Yes | Twin Cabin | Product name |
currency | string | No | AUD (default) | Currency code |
country | string | No | AU (default) | Country code |
lang | string | No | en (default) | Language code |
Attribute-to-API Mapping:
| Widget Attribute | API Field (POST /quotes body) |
|---|---|
lat, lon | location.latitude, location.longitude |
suburb | suburb |
state | state |
start | startDate |
end | endDate |
amount | bookingValue |
booking | partnerQuoteId |
type | eventType |
experience | experienceName |
product_name | productName |
weatherit-cart-item — Cart Line Item
A passive component that displays the selected protection as a line item in the cart sidebar. No API calls — it listens for Custom Events from weatherit-widget.
<weatherit-cart-item partner="{WEATHERIT_PARTNER_ID}"></weatherit-cart-item>| Attribute | Type | Required | Description |
|---|---|---|---|
partner | string | Yes | Your WeatherIt partner identifier |
The component is hidden by default and appears when the customer selects a protection tier.
3. Confirmation Page Setup
On your booking confirmation page (a separate URL from checkout), add the confirmation component.
<weatherit-confirmation
partner="{WEATHERIT_PARTNER_ID}"
booking="{booking.reference}"
policy-id="{policy.id}"
quote-id="{quote.id}"
></weatherit-confirmation>| Attribute | Type | Required | Description |
|---|---|---|---|
partner | string | Yes | Your WeatherIt partner identifier |
booking | string | Yes | Your booking reference |
policy-id | string | No | Policy ID (from purchase API response) |
quote-id | string | No | Quote ID (from weatherit:coverage-selected event) |
hide-on-confirmed | flag | No | When present, hides the component if a policy exists |
Passpolicy-idandquote-idwhen available. This gives the best experience — the component can show the correct state immediately without additional API calls. See the Components Reference for full state details.
4. RoomStay Integration (Event-Based)
For partners using the RoomStay SDK, the widget can receive booking data from RoomStay events instead of HTML attributes.
When it activates: If the weatherit-widget element has no booking data attributes (lat, start, etc.), it listens for RoomStay SDK events instead.
SDK event: The widget listens for the checkoutView event (camelCase, as registered via roomstay.on()).
Required event payload: The RoomStay event must include location details alongside booking data:
| Payload field | Required | Description |
|---|---|---|
searchParams.arrive | Yes | Check-in date |
searchParams.depart | Yes | Check-out date |
searchParams.adults | Yes | Number of adults |
searchParams.children | Yes | Number of children |
basket.total | Yes | Booking total |
property.latitude | Yes | Location latitude |
property.longitude | Yes | Location longitude |
property.suburb | Yes | Location suburb |
property.state | Yes | Location state |
RoomStay HTML example:
<script src="https://widget.weatherit.ai/embed.js" async></script>
<!-- No booking attributes — widget listens for RoomStay events -->
<weatherit-widget partner="{WEATHERIT_PARTNER_ID}"></weatherit-widget>
<weatherit-cart-item partner="{WEATHERIT_PARTNER_ID}"></weatherit-cart-item>5. Full Integration Examples
Big4 (Attribute-Based)
<script src="https://widget.weatherit.ai/embed.js" async></script>
<!-- Checkout page — Extras step -->
<weatherit-widget
partner="{WEATHERIT_PARTNER_ID}"
lat="{park.latitude}" lon="{park.longitude}"
suburb="{park.suburb}" state="{park.state}"
start="{booking.checkin}" end="{booking.checkout}"
amount="{booking.total}" booking="{booking.reference}"
type="camping" experience="{park.name}" product_name="{booking.siteType}"
></weatherit-widget>
<weatherit-cart-item partner="{WEATHERIT_PARTNER_ID}"></weatherit-cart-item>
<!-- Confirmation page (separate URL) -->
<weatherit-confirmation
partner="{WEATHERIT_PARTNER_ID}"
booking="{booking.reference}"
policy-id="{policy.id}"
></weatherit-confirmation>RoomStay / Daydream Island (Event-Based)
<script src="https://widget.weatherit.ai/embed.js" async></script>
<!-- Checkout page — no attributes, listens for RoomStay events -->
<weatherit-widget partner="{WEATHERIT_PARTNER_ID}"></weatherit-widget>
<weatherit-cart-item partner="{WEATHERIT_PARTNER_ID}"></weatherit-cart-item>
RoomStay events must include property location (latitude,longitude,suburb,state) in the payload. The widget does not fetch location from partner config.
6. Content Security Policy
If your site uses a Content Security Policy, add these directives:
script-src: widget.weatherit.ai
connect-src: api.weatherit.ai
For sandbox testing:
connect-src: api-sandbox.weatherit.ai
7. Environments
| Environment | Widget CDN | API Base URL |
|---|---|---|
| Production | widget.weatherit.ai | api.weatherit.ai |
| Sandbox | widget-sandbox.weatherit.ai | api-sandbox.weatherit.ai |
8. Analytics
The widget fires GA4 conversion funnel events when analytics are enabled. These track the customer journey through quoting and selection:
widget_loaded,quote_received,coverage_viewedcoverage_selected,coverage_changed,coverage_declinedlearn_more_openedconfirmation_upsell_shown,confirmation_upsell_clicked
All events include partner_id.
A/B testing: Append ?force_variant=challenger to the page URL to force a specific widget variant during testing.
Visual placeholder — A screenshot or demo of the widget embedded in a checkout page will be added here.
Updated 7 months ago
