Configuration Model

Customize Trip Element for your needs

Configure Trip Element

The Trip Element can be customized through a configuration object that is included at the time of element creation.

const elementConfig = {
  ...
}

$sherpa.V2.createElement('trip', elementConfig).mount('#sherpa-widget')

Configuration Model

AttributeRequiredTypeDescriptionExample
languageOptionalStringdefault: en-US
View supported languages
Localize the Trip Element
placementRequiredStringName of booking stage or page the element is embedded on. Used for measuring engagement in analytics reports.
Following are Sherpa suggested values:

homePage - Home Page
discovery - Generic pre-booking marketing page
mmb - Manage My Booking
search - Search
bookingConfirmation - Booking Confirmation
destinationPage - dedicated marketing page for a destination
covidPage - dedicated page for COVID-19 resources
Basic Discovery Placement
segmentsOptionalArray of ObjectsView Segment ModelReturn Trip
travellersOptionalArray of ObjectsView Traveller ModelDefining a Traveller
queryParamsOptionalObjectView Analytics Model
featuresOptionalObjectView Features Model
cookieConsentPreferencesOptionalArray of StringsAn optional list of cookie consent type names that constitute a cookie policy that should apply to this Element (and to all other existing or future Embedded Elements or Application Widgets). See Setting a Cookie Policy for a list of valid cookie consent type names. If no cookie consent preference is specified, the new Element will use the most recently specified cookie policy (set either when creating a previous Embedded Element or Application Widget or by using the setCookiePreferences() method on the SDK). If there is no previously specified cookie policy, a minimal cookie policy will be employed that allows only those cookies that are needed for the Element to function.Setting a Cookie Policy

Segment Model

Describe the trip using a set of Segments.

An example of the segment model using the all of the attributes in the table below can be found here.

AttributeRequiredTypeDescription
segmentTypeRequiredString
OUTBOUND, RETURN
Direction of the flight.
segmentSubTypeRequired for connecting flight.String
TRANSIT
Is this a connecting flight.
originOptional if features.showResults is false;
Required otherwise
ObjectView Location Model
destinationOptional if features.showResults is false;
Required otherwise
ObjectView Location Model
travelModeOptionalString
AIR
Default: AIR
departureDateOptional. If omitted, this date will default to the current day for OUTBOUND segmentTypes and to one week from the current day for RETURN segmentTypes.String
YYYY-MM-DD
Date of departure
departureTimeOptionalString
HH:MM:SS
Time of departure
arrivalDateOptional. If omitted, this date will default to the current day for OUTBOUND segmentTypes and to one week from the current day for RETURN segmentTypes.String
YYYY-MM-DD
Date of arrival
arrivalTimeOptionalString
HH:MM:SS
Time of arrival

Location Model

One of the following attributes is required.

AttributeRequiredTypeDescriptionExamples
countryCodeOptional, if one other is specifiedStringISO3 Country Code, e.g. CAN for CanadaeVisa Trip Element Pre-Configuration
airportCodeOptional, if one other is specifiedStringIATA Airport Code e.g. YYZ for Pearson International Airport, Toronto, CanadaUsing Airport and Region Code
regionCodeOptional, if one other is specifiedStringalpha3 Region Code e.g. US-TX for Texas, USAUsing Airport and Region Code

Traveller Model

AttributeRequiredTypeDescriptionExample
nationalityOptionalStringISO3 Country Code, e.g. CAN for CanadaDefining a Traveller
vaccinationsOptionalArray of ObjectsView Vaccination ModelDefining a Traveller

Vaccination Model

AttributeRequiredTypeDescription
typeOptionalStringCurrently only value 'COVID_19'
statusOptionalString
FULLY_VACCINATED, NOT_VACCINATED
Indication of being fully vaccinated or not

Analytics Model

Pass analytics attributes to the segment element. The parameters will be appended to the iFrame url where the Trip Element is rendered, and appear in your reports.

AttributeRequiredTypeDescriptionExample
utm_sourceOptionalStringUTM source. Example: emailBetter Reporting
utm_mediumOptionalStringUTM medium. Example: newsletterBetter Reporting
utm_campaignOptionalStringUTM campaign. Example: summer-return-to-travelBetter Reporting

Features Model

Customize the appearance of the Trip Element by enabling & disabling feature flags.

AttributeRequiredTypeDescriptionExample
showSegmentsOptionalBooleanShow/hide navigation between segments
Default: true
Hide segments
showTitleOptionalBooleanShow/hide title
Default: true
Hide title
enableSegmentEditorOptionalBooleanShow/hide the UI to edit a trip, including "Edit my trip" button.Hide Segment Editor
showFilterPassportOptionalBooleanShow/hide Select Passport UIShow Filter Passport
showFilterVaccinatedOptionalBooleanShow/hide Vaccination Toggle UIShow Filter Vaccinated
showResultsOptionalBooleanShow/hide travel restrictions results on load
Default: true
Show Results

❗️

showResults Feature

showResults is true by default, if this is true origin and destination has to be specified. Set this to false to load the widget with no destination and origin specified.