Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <!-- Google Tag Manager -->
- <script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
- new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
- j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
- 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
- })(window,document,'script','dataLayer','GTM-5MCMDZD');</script>
- <!-- End Google Tag Manager -->
- if (window.location.href === "https://app.cover.is/b59/book#/choose-dates") {
- window.dataLayer = window.dataLayer || []
- window.dataLayer.push({
- 'event': 'Choose-Dates',
- 'start_date': booking_object.date_arrival,
- 'end_date': booking_object.date_departure,
- });
- }
- <script>
- function confirmation_tag(booking_object) {
- if (booking_object['booked_rooms'] && booking_object['booked_rooms'].length > 0) {
- items = [];
- var pagePath = location.href;
- var pageTitle = 'Confirmation Page - Booking';
- booking_object['booked_rooms'].forEach((booked_room) => {
- items.push({
- id: booked_room.room['short_code'],
- name: booked_room.room['name'],
- quantity: booked_room.count,
- price: booked_room.full_price
- })
- })
- booking_object['booked_extras'].forEach((booked_extra) => {
- items.push({
- id: booked_extra.title,
- name: booked_extra.title,
- quantity: booked_extra.count,
- price: booked_extra.price
- })
- })
- window.dataLayer = window.dataLayer || [];
- window.dataLayer.push({
- event: 'purchase',
- ecommerce: {
- currency: 'booking_object['currency']',
- value: booking_object['amount'],
- affiliation: 'Booking Factory',
- transaction_id: 'booking_object['token']',
- page_path": pagePath,
- page_title": pageTitle
- items:[{
- item_name:'booked_room.room['name']',
- item_id: 'booked_room.room['short_code']',
- price: 'booked_room.full_price',
- item_brand: 'Herbergi',
- quantity: 'booked_room.count',
- start_date': booking_object.date_arrival,
- end_date': booking_object.date_departure,
- },{
- item_name: 'booked_extra.title',
- item_id: 'booked_extra.title',
- price: 'booked_extra.price',
- item_brand: 'Aukahlutir',
- quantity: 'booked_extra.count'
- start_date': booking_object.date_arrival,
- end_date': booking_object.date_departure,
- }},]
- }
- });
- }
- }
- </script>
- function(){ var capturedText = document.querySelector("h1").innerText.trim(); return capturedText; } // Room Name - Step 3 - Item Name
- function(){ var capturedText = document.querySelector(".OfferOption__title").innerText.trim(); return capturedText; } // Offer available - Offer Name
- function(){ var capturedText = document.querySelector(".OfferOption__price").innerText.match(/^.{4}(.*).{0}/i)[1].trim(); return capturedText; } // Item Price - Offer Price
- function(){ var capturedText = document.querySelector(".OfferOption__price").innerText.match(/^(.*).{7}/i)[1].trim(); return capturedText; } // Item Currency
- // 1 - Veldu Dagsetningar
- start_date': booking_object.date_arrival,
- end_date': booking_object.date_departure,
- // 2 - Valið herbergi
- function(){ var capturedText = document.querySelector(".selectedDatesAndOcc__occupancy").innerText.match(/^(.*).{9}/i)[1].trim(); return capturedText; } // Dates Selected
- // 3 - Valinn flokkur
- function(){ var capturedText = document.querySelector("h1").innerText.trim(); return capturedText; } // Room Name - Step 3 - Item Name
- function(){ var capturedText = document.querySelector(".OfferOption__title").innerText.trim(); return capturedText; } // Offer available - Offer Name
- function(){ var capturedText = document.querySelector(".OfferOption__price").innerText.match(/^.{4}(.*).{0}/i)[1].trim(); return capturedText; } // Item Price - Offer Price
- function(){ var capturedText = document.querySelector(".OfferOption__price").innerText.match(/^(.*).{7}/i)[1].trim(); return capturedText; } // Item Currency
- // 4 - Skoða samantekt
- function(){ var capturedText = document.querySelector(".col-6-12.summaryRoom__title").innerText.trim(); return capturedText; } // Item Name
- function(){ var capturedText = document.querySelectorAll(".lang__is>.container.summary-container>.summaryContentWrapper>.grid>.summaryControls.summaryControls__totals.col-6-12>.summaryTotalRow.summaryTotalRow__grandTotal>.summaryTotalRow__value")[0].innerText.trim(); return capturedText; } // Item Price
- // 5 - Bæta við upplýsingum og greiðslu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement