Skip to main content

Best Price Widget

Try Now

How to request 

SHS Customers should contact their Account Manager for details on cost and to request access to use widgets.  Customers will need to provide the list of Chains, Brands, and Hotels that will be using widgets, as well as a list of domains for the websites on which they will be placed. 

Access Control 

SHS controls access to widgets through an API Key provided to customers during implementation.  Web developers will include the API Key in the configuration parameters of the widget.  The API Key will restrict access to the specific chains, brands, and hotels configured for that API Key.  The widgets will not display on websites or for hotels/chains that do not belong to the API Key in use. 

Customers should speak with their account managers if changes to chains, brands, hotels, and domains associated with the API Key are required after initial implementation. 

Installation Steps

SHS Widgets are implemented as Web Components that can be added to any website regardless of the technology stack or libraries used.  More information on Web Components can be found at    

Step 1: Link Widget Library and CSS 

Add the JavaScript libraries and CSS files required by the widget to the HEAD section of the HTML document on which they will be displayed.  Some widgets have dependencies on other widgets that they use internally, so files for more than one widget may need to be added.  See the "Widget Installation" tab for specific requirements for this widget.

It is recommended that the standard HTML 5 DOCTYPE declaration be used, as well as meta tags for utf-8 encoding and responsive web design.  

Example: HTML HEAD Requirements 

<!DOCTYPE html>  
    <!-- Meta tags for utf-8 and responsive design -->  
    <meta charset="utf-8">  
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">  

    <!-- Script for the Widget -->  
    <script charset="utf-8" src="{{widget-type}}/web-component-with-libs.js"></script>

    <!-- CSS file for the Widget, if the widget supports one. -->  
    <link href="{{widget-type}}/web-component-with-libs.css" rel="stylesheet">  

    <!-- Boostrap link  -->  
    <link rel="stylesheet" href="">  


Replace {{widget-type}} placeholder above with the actual widget type identifier.  Currently supported widget-types include:

  • shs-widgets-best-price
  • shs-widgets-calendar
  • shs-widgets-search-bar

Note: the shs-widgets-best-price type does not have a default CSS file, so omit the <link> element.

SHS widgets inherit from a Bootstrap CSS file.  If the site already uses Bootstrap, there will be no need to add the reference to the Bootstrap CSS library above.  The widgets will automatically inherit the branding and styling of the parent Bootstrap site.  

The domain name used in file references ( should match the SBE domain of the environment being used.  If a white label domain is used for SBE, this should be the white label domain.  

Step 2: Add Web Components to HTML body 

Second, place web component elements within the HTML document where they should show.  These may be place directly in the HTML like any other HTML tag.  

Example: Best Price Widget Web Component Declaration 

<!-- add a best price widget --> 
    . . . other config params . . . 

Replace the placeholders in brackets (e.g. {{api_key}}) with actual values.

Step 3: Customize Widget Parameters 

Additional parameters can be added to each web component declaration in Step 2 to customize the behavior of each widget instance.   A detailed list of parameters supported by this widget is included on the Configuration tab.

Some things to note about parameter values:

  • Parameters values follow the same rules for quotation as standard HTML elements.
  • It is recommended to use double quotes except when the value is a JSON object.
  • For values that are JSON objects to parse correctly, single quotes should surround the object, and double quotes used within the JSON itself (e.g. param='{"one": 1, "two: 2}').
  • Properly escape quotes used within values if they match the quote type surrounding the value as a whole.

Example: Customized Example of Calendar Widget Web Component 

<!-- Example of best price widget with custom parameters --> 
    "numberOfMonths": "2" 
    "shs-widgets--calendar.noCheckIn": "No Arrival", 
    "shs-widgets--calendar.noCheckOut": "No Departure" 
  render-not-available='<span class="error">Sorry. We are sold out!</span>' 

Custom Labels 

Each widget supports a parameter named “labels” that takes a string encoded JavaScript (JSON) object as value.  The object may contain key/value pairs to override the default text labels provided by the widget.  All text can be customized by adding the custom text as value for the associated label key.

All labels supported by this widget can be found on the Configuration tab.

The widgets currently support default labels for English only.  Text may be shown in other languages by overriding all labels with the translated text to be used.  

Example: Overriding Default Labels 

<!-- Example syntax of the labels parameter overriding default text --> 
    "shs-widgets--calendar.noCheckIn": "No Arrival", 
    "shs-widgets--calendar.noCheckOut": "No Departure", 
    "shs-widgets--calendar.infoMessage": "%{type} price shown in %{currency} for a %{los}-night stay" 

Some labels contain named placeholders for dynamic values that will be replaced by the widget (e.g.  %{type} price shown in %{currency}).  Variables are identified by a percent sign followed by a name surrounded by curly braces (e.g. %{currency}).  When overriding or translating labels, the variable name (e.g. currency) should NOT be changed.  

Callback Methods 

Most widgets support callback methods allowing custom functionality to be triggered in response to an action such as clicking a button, selecting a date range, or receiving data from SynXis Services.  Callback functions must be globally available in scope.  The name of the function should be included as a string (with no parentheses) as the value of the parameter associated with the callback (e.g. on-click="handleClick").  

Callback methods supported by this widget are included in the parameter list on the Configuration page. 

Example: Definition of a Callback Method 

<!-- Define a global JavaScript function --> 
  function onHotelSelectMethod(hotel) { 



Some widgets support JavaScript Events.  Event Listeners may be added in order to execute custom logic when the event is triggered.   

Events can be subscribed to using the window.addEventListener() function including the name of the event and a JavaScript function to be executed.  Event listeners receive a data object as an argument containing Event Data.  A "details" object will be included in the data object containing details specific to the state of the widget.  

Event listeners supported by this widget are listed on the Configuration tab. 

Example: Adding an Event Listener 

<!-- Add event listener to on-click event --> 
    window.addEventListener('shs-widgets-best-price__on-click', eventData => console.log(eventData.detail)); 

Render Templates 

Most widgets support Render Templates that allow web developers to override the HTML template used to render specific components of each widget.  Render template parameter names begin with the word “render” and take Lodash template strings as values (see for information on Lodash templates). 

Each render template supports specific variables that are accessible to the template.  Those variables may be referenced in templates using Lodash template syntax (e.g. <%=myVariable%>).  

The render templates supported for this and the variables supported for each, are listed on the Configuration tab. 

Example: Using a Render Template to Override a Portion of the Widget HTML 

<!-- Override the rendering template that generates the submit button HTML --> 
  function clickMe() { 
    alert("You clicked me!"); 

  render-submit-button='<button onClick="clickMe()">Book for <%=nights%> Nights</button>' 

Note: Because Web Component parameters are passed as strings, developers must be careful when using Boolean and Function variable types within render templates.  For example, a boolean value cannot simply be dropped in place using lodash interpolation, as it will be treated as a string (which always acts as true) even if the string value is "false."

Code Example 10 – Interpolation of Boolean in Render Templates 

<!-- This will NOT work as expected -->
  render-template='<button disabled=<%=isSubmitDisabled%>My Button</button>'

<!-- If false the above will render as the string value "false" 
     and all strings are treated as true. -->
 <button disabled="false">My Button</button> 

<!-- Instead use the boolean in template logic to replace what is interpolated -->
    render-template='<button <% if(isSubmitDisabled){ %>disabled="disabled"<%}%>>My Button</button>' 

<!-- Interpolated properly if true -->
<button disabled="disabled">My Button</button> 

<!-- Interpolated properly if false -->
<button >My Button</button> 

Example: Interpolation of Function Reference in Render Templates 

<!-- This will NOT work as expected if onSubmit contains a function because the  function will be converted to a string as part of the interpolation --> 
   render-template='<button onClick=<%=onSubmit%>My Button</button>' 

<!-- instead, assign the function to a window.variable first, then execute --> 
         <% window.myOnSubmitFunction = onSubmit %> 
      <button onClick="myOnSubmitFunction()">My Button</button>' 


Step 4: Style Widgets 

Widget CSS was designed to inherit common settings from Bootstrap stylesheets to minimize extra work required to apply the site’s branding to widgets.  If a site does not use Bootstrap, a link to the Bootstrap stylesheet is required in the HEAD of the HTML document (see Step 1 above).  Web Developers may add custom CSS to override the default CSS in the Bootstrap and Widget stylesheets.   

The stylesheets of each widget type are independent of each other, so each type of widget type may be styled differently without conflict.  The style classes supported by each widget can be viewed by developers inspecting the DOM and by viewing the contents of the default widget stylesheets. 

Example: Styling Widgets 

<!-- Example of overriding the style of the calendar widget box and month outline --> 
  .shs-widgets--calendar { 
    background-color: white; 
    border: 1px solid grey; 
    padding: 10px; 
    margin: 10px; 

  .DayPicker-Month { 
    border: 1px solid grey; 
    margin: 5px;