How to make Booking.com tab open automatically

Working with affiliate programs on the Travelpayouts platform, we often use links redirecting to advertising customers' websites. From this article, you will find out about a method of opening two tabs with different offers in one click.

It may be useful as it makes sales of additional tourist services more likely. For example, place a link to Aviasales cheap plane tickets website at the end of your article. It redirects users to the new tab with a website, and on the old website, Booking.com will open. As a result, the user may not only book the tickets but also select a hotel for the trip.

Note: for the script to work correctly, you must be connect to the Booking.com affiliate program.

To make everything work, use the following code:

<div>
<a href="Link1" target="_blank" id="ctaSearch">Link text</a>
</div>

<script src="https://q.bstatic.com/static/affiliate_base/js/search_extension.js"></script>
<script>
window.bookingLeaveBehind.on('click', '#ctaSearch', 'Link2');
</script>

This is the code with all the links placed:

<div>
<a href="https://tp.media/r?marker=78606&p=4114&u=https%3A%2F%2Fwww.aviasales.com" target="_blank" id="ctaSearch">Текст ссылки</a>
</div>

<script src="https://q.bstatic.com/static/affiliate_base/js/search_extension.js"></script>
<script>
window.bookingLeaveBehind.on('click', '#ctaSearch', 'https://tp.media/r?marker=235971&p=2076&u=https%3A%2F%2Fbooking.com%2Fsearchresults.html%3Faid%3D818288%3Bcheckin%3D2020-11-20%3Bcheckout%3D2020-11-25%3Bdest_type%3Dcity%3Bdest_id%3D-406131%3Blabel%3Dsee-cob-304142-click_brand-partner%3Bselected_currency%3DEUR');
</script>

The script itself is stored at the address: https://q.bstatic.com/static/affiliate_base/js/search_extension.js. Due to window.bookingLeaveBehind.on, script is initiated on a click on the link with id ctaSearch, and the user is redirected to the mentioned address.