Widgets
You can add Yandex Travel widgets to your website to shorten the user's path to booking tickets and hotels. The widget adapts to any device, so it will not interfere with your content.
There are two types of widgets: Top hotels, Hotel search, Selection of hotels and Hotels on map.
The code consists of two parts: the widget embed code and the widget container.
Embed code for the top hotels widget
Add this code to the head
element at the beginning of the page.
<script async src="https://aflt.travel.ya.ru/widgets/api.js" type="text/javascript"></script>
<script type="text/javascript">
(function (w) {
function start() {
w.removeEventListener('YaTravelAffiliateLoaded', start);
w.YaTravelAffiliate.createWidget({
"type": 'topHotels',
"containerId": 'travelWidget',
"urlParams": {
"origin": 'https://travel-test.yandex.ru',
"partner": "distribution",
"params": {
"clid": '6789',
"utm_source": "distribution",
"utm_medium": "cpa"
},
},
"widgetParams": {
"affiliateClid": '6789',
"geoId": 2,
"sorting": 'cheap',
},
});
}
w.YaTravelAffiliate
? start()
: w.addEventListener('YaTravelAffiliateLoaded', start);
})(window);
</script>
Widget container
Add this code to the body
element in the place where you want to display the widget.
<div id="travelWidget"></div>
Parameters of the top hotels widget embed code:
Parameter |
Description |
Acceptable values |
|
Widget type. |
|
|
ID of the element the widget will be rendered in. Must match the ID of the element added to |
|
|
Parameters for creating a link to click through to Yandex Travel. |
The parameter value consists of several parts:
|
|
Using this parameter, set the region to show hotels from in the widget's hotel selection. You can also set the sorting method (by default, the selection shows popular hotels in the chosen region). |
The parameter value should look like this:
Where:
|
The code consists of two parts: the widget embed code and the widget container.
Embed code of the hotel search widget
Add this code to the head
element at the beginning of the page.
<script async src="https://aflt.travel.ya.ru/widgets/api.js" type="text/javascript"></script>
<script type="text/javascript">
(function (w) {
function start() {
w.removeEventListener('YaTravelAffiliateLoaded', start);
w.YaTravelAffiliate.createWidget({
"type": "hotelsSearchForm",
"containerId": "travelWidget",
"widgetParams": {},
"urlParams": {
"origin": "https://travel.yandex.ru/",
"partner": "distribution",
"params": {
"utm_source": "distribution",
"utm_medium": "cpa"
}
}
});
}
w.YaTravelAffiliate
? start()
: w.addEventListener('YaTravelAffiliateLoaded', start);
})(window);
</script>
Widget container
Add this code to the body
element in the place where you want to display the widget.
<div id="travelWidget"></div>
Parameters of the hotel search widget embed code:
Parameter |
Description |
Acceptable values |
|
Widget type. |
|
|
ID of the element the widget will be rendered in. Must match the ID of the element added to |
|
|
Parameters for creating a link to click through to Yandex Travel. |
The parameter value consists of several parts:
|
|
Using this parameter, set the region to show hotels from in the widget's hotel selection. You can also set the sorting method (by default, the selection shows popular hotels in the chosen region). |
If you pass the To pre-fill the search form with a city or region value, pass the following parameter:
Where To pre-fill the search form with the value of a specific hotel, pass the following parameter:
For example: To pre-fill in the check-in and check-out dates, pass the You can pass several parameters at once: for example, pre-fill in the city and the check-in and check-out dates, or the hotel and the check-in and check-out dates. In this case, the parameter value will look like this:
|
The code consists of two parts: the widget embed code and the widget container.
Embed code of the selection of hotels widget
Add this code to the head
element at the beginning of the page.
<script async src="https://aflt.travel.ya.ru/widgets/api.js" type="text/javascript"></script>
<script type="text/javascript">
(function (w) {
function start() {
w.removeEventListener('YaTravelAffiliateLoaded', start);
w.YaTravelAffiliate.createWidget({
"type": "hotelsSet",
"containerId": "travelWidget",
"widgetParams": {
"title": "Selection of hotels",
"slugs": [
"moscow/17-3-kapsulnyi-launzh-otel",
"nizhny-novgorod/marins-park-hotel-nizhnii-novgorod",
"moscow-oblast/vozdvizhenskoe-park-otel"
]
},
"urlParams": {
"origin": "https://travel.yandex.ru/",
"partner": "distribution",
"params": {
"affiliate_clid": "12345",
"service": "hotelsSet",
"utm_source": "distribution",
"utm_medium": "cpa"
}
},
"theme": "light"
});
}
w.YaTravelAffiliate
? start()
: w.addEventListener('YaTravelAffiliateLoaded', start);
})(window);
</script>
Widget container
Add this code to the body
element in the place where you want to display the widget.
<div id="travelWidget"></div>
Parameters of the selection of hotels widget embed code:
Parameter |
Description |
Acceptable values |
|
Widget type. |
|
|
ID of the element the widget will be rendered in. Must match the ID of the element added to |
|
|
Parameters for creating a link to click through to Yandex Travel. |
The parameter value consists of several parts:
|
|
Using this parameter, set the holets IDs to show hotels from in the widget's hotel selection. |
The parameter value should look like this:
Where:
|
The code consists of two parts: the widget embed code and the widget container.
Embed code of the hotels on map widget
Add this code to the head
element at the beginning of the page.
<script async src="https://aflt.travel.ya.ru/widgets/api.js" type="text/javascript"></script>
<script type="text/javascript">
(function (w) {
function start() {
w.removeEventListener('YaTravelAffiliateLoaded', start);
w.YaTravelAffiliate.createWidget({
"type": 'hotelsOnMap',
"containerId": 'travelWidget',
"urlParams": {
"origin": 'https://travel-test.yandex.ru',
"partner": "distribution",
"params": {
"clid": '6789',
"utm_source": "distribution",
"utm_medium": "cpa"
},
},
"widgetParams": {
"affiliateClid": '6789',
"geoId": 2,
},
});
}
w.YaTravelAffiliate
? start()
: w.addEventListener('YaTravelAffiliateLoaded', start);
})(window);
</script>
Widget container
Add this code to the body
element in the place where you want to display the widget.
<div id="travelWidget"></div>
Parameters of the hotels on map widget embed code:
Parameter |
Description |
Acceptable values |
|
Widget type. |
|
|
ID of the element the widget will be rendered in. Must match the ID of the element added to |
|
|
Parameters for creating a link to click through to Yandex Travel. |
The parameter value consists of several parts:
|
|
Using this parameter, set the region to show hotels from in the widget's hotel selection. |
The parameter value should look like this:
Where:
|
Related information
• Main stages and conditions of cooperation