Configuration
Configuration of this widget occurs through a configuration options object. See below.
Options Object
The following options are available:
| Property | Type | Description |
|---|---|---|
| orgId | String | Your organization's identifier. |
| token | String | Your organization's public authentication token. |
| chat.chatId | String | A chat identifier given to you by Sitata. |
| ui.inputStyle | [String] | An array of styles for the inputs. Default is ['outlined']. Use one of 'outlined', 'filled', 'underlined', 'solo', or 'plain'. |
| contactEmail | String | A contact email address given to you by Sitata. |
| merchantOfRecord | Bool | Set to true if you wish your organization to be merchant of record. Your organization must be a distributor for Sitata for option to have any effect. Options are 'true', 'false', and 'choice'. If your organization is a distributor and the value is set to 'choice' then the end-user will have an option in the interface to choose who is merchant of record - either your organization or Sitata. |
| lang | String | The widget will attempt to determine the user's language automatically. This will force a language selection instead. Use two character languages codes. e.g. 'es' for Spanish. |
| noQuoteProcess | String | Values are either: 'assist', 'sitata', or 'plain'. This option tells the widget how to behave if an insurance quote is not possible. Specify 'assist' if you would like to offer your customer's Sitata's Travel Assistance plans without insurance. Specify 'sitata' for an error message and a link back to Sitata. Specify 'plain' for a simple error message an no alternative options for your customer. The default is 'assist'. |
| ui.originCountryPref | [String] | When given an array of country codes, will prioritize those countries first in the departure / origin country dropdown selection. Uses ISO 3166 Alpha 2 character codes. e.g. ["CA", "US", "GB"]. (This is the correct key; a previously-documented priorityOriginCountries option has no effect.) |
| trip | Trip | Trip object to pre-populate widget with trip cost and destinations. |
| user | User | User object to pre-populate widget with for purchaser info. |
| otherTravellers | [Beneficiary] | List of beneficiaries to pre-populate the widget for additional traveller info. |
| departureCountryCode | String | ISO 3166 Alpha 2 character code of the departure country if pre-populating the widget. e.g. "CA" for Canada. |
| residentState | String | ISO 3166 character code of regional state of departure. e.g. US-CA for California, United States. |
| existingSubId | String | Specify an existing subscription identifier to close/refund when creating and charging for a new subscription. |
| apiBase | String | The REST API base URL. Default is https://www.sitata.com/api/v2. |
| httpBase | String | Base URL used for images and assets. Default is https://www.sitata.com. |
| affiliateId | String | An affiliate company identifier used for sales attribution (e.g. a travel agency affiliate). |
| forceMode | String | Restrict the widget to a single product family. Use 'health' or 'travel'. |
| productTypes | [String] | Restrict the widget to the given product types. If unset and more than one exists, the user chooses. |
| showAssist | Bool | If true, allow purchasing an assistance-only subscription up front (not only as a no-quote fallback). Default is false. |
| hideBranding | Bool | If true, hide Sitata branding. Default is false. |
| enableUnbounce | Bool | Enable Unbounce tracking. Only takes effect on *.sitata.com pages. Default is false. |
| pkeys | [Object] | Per-product Stripe publishable keys for payment, given as [{ pids, k }] where pids is an array of product identifiers (or ['*'] for all products) and k is the Stripe publishable key. |
| ui.btnPrimaryStyle | [String] | Style class(es) applied to primary buttons. |
| ui.btnSecondaryStyle | [String] | Style class(es) applied to secondary buttons. |
| gmapToken | String | Your Google Maps API key, used for place lookups. |
| mapboxToken | String | Your Mapbox access token, used for place lookups. |
| googleAnalyticsId | String | Your GA4 measurement id to receive the widget's analytics events. Defaults to Sitata's own. |
| googleAnalyticsAppName | String | The application name reported to Google Analytics. |
| fbPixelId | String | Your Facebook pixel id. Defaults to Sitata's own. |
| twitterPixelId | String | Your Twitter/X pixel id. Defaults to Sitata's own. |
| tiktokPixelId | String | Your TikTok pixel id. Defaults to Sitata's own. |
| bingId | String | Your Microsoft/Bing Ads id. Defaults to Sitata's own. |
| clarityId | String | Your Microsoft Clarity id. Defaults to Sitata's own. |
info
The analytics/pixel ids above default to Sitata's own accounts. Provide your own values to route the widget's tracking events to your accounts instead.
Example
The following example shows a setup with many of the options explained above.
<script>
var el = document.getElementById("insure")
window.document.addEventListener('sitata:insureReady', function () {
let widget = new window.Sitata.insure(el, {
orgId: orgId,
token: token,
chat: {
chatId: chatId
},
contactEmail: '[email protected]',
merchantOfRecord: false,
// merchantOfRecord: true,
// merchantOfRecord: 'choice',
ui: {
inputStyle: ['filled'],
originCountryPref: ['US', 'GB', 'CA']
},
departureCountryCode: 'US',
residentState: 'US-CA',
user: {
birthday: '1968-04-09',
email: '[email protected]',
home_country: 'US',
name: 'Jimmy Bean'
},
otherTravellers: [
{
name: 'Susan Jekins',
birthday: '1970-04-09',
relation: 0
}
],
trip: {
currency_code: 'GBP',
destinations: [
{
country_code: 'CH',
friendly_name: 'Switzerland',
entry_date: '2023-11-21',
exit_date: '2023-11-23',
type: 0
},
{
country_code: 'ES',
friendly_name: 'Spain',
entry_date: '2023-11-24T00:00:00+00:00',
exit_date: '2023-11-29T23:59:59+00:00',
type: 0
}
],
finish: '2023-11-29T23:59:59+00:00',
start: '2023-11-21T00:00:00+00:00',
total_cost: 100000
}
}
);
widget.run()
});
</script>
<script src="assets/sitata-insure.js"></script>
Functions
The following functions are available:
| Function | Arguments | Description |
|---|---|---|
| setUser | (User) | Set the user object to pre-populate widget with for purchaser info. |
| setOtherTravellers | ([`Beneficiary]`) | Set the list of beneficiaries to pre-populate the widget for additional traveller info. |
| setDepartureCountryCode | (String) | Set the ISO 3166 Alpha 2 character code of the departure country if pre-populating the widget. |
| setResidentState | (String) | Set the ISO 3166 character code of regional state of departure. |
| setTrip | (Trip) | Set the trip object to pre-populate widget with trip cost and destinations. |
| setMerchantOfRecord | (boolean or 'choice') | Sets if you wish your organization to be merchant of record. |
| setExistingSubId | (String) | Specify an existing subscription identifier to close/refund when creating and charging for a new subscription. |
| setTripDepositDate | (String) | Set the trip deposit date (format YYYY-MM-DD), used where cancellation cover depends on when the trip was paid for. |
| launchChat | () | Programmatically open the embedded support chat (requires chat.chatId to be configured). |