Learn how to open two tabs with different offers by clicking on the link only once.
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:
<a href="Link1" target="_blank" id="ctaSearch">Link text</a>
window.bookingLeaveBehind.on('click', '#ctaSearch', 'Link2');
- Link1 — enter the link to advertising customers website generated using a deep link creation form. The website will open in the new tab. It may be any affiliate program from the Travelpayouts catalog.
- Link2 — enter an affiliate link to Booking.com. It will open in the old tab. It is mandatory to get a link from the deep link creation form.
This is the code with all the links placed:
<a href="https://tp.media/r?marker=78606&p=4114&u=https%3A%2F%2Fwww.aviasales.com" target="_blank" id="ctaSearch">Текст ссылки</a>
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');
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.