function getISOdateAsString(us_date_str){ let year = us_date_str.slice(6); let month = us_date_str.slice(0, 2); let day = us_date_str.slice(3, 5); return year + '-' + month + '-' + day; } // get variables from query // current query example: confirmationId=10077&property=450151&checkin=12/09/2021&checkout=12/12/2022 const queryString = window.location.search; const urlParams = new URLSearchParams(queryString); const confirmation_id = urlParams.get('confirmationId'); const transaction_total = Number(urlParams.get('total')); const transaction_tax = Number(urlParams.get('tax')); const unit_id = urlParams.get('property'); const unit_name = urlParams.get('propertyname'); const number_of_guests = urlParams.get('guests'); // dates manipulations let date_in_str = urlParams.get('checkin'); let date_out_str = urlParams.get('checkout'); let date_in = new Date(date_in_str); let date_out = new Date(date_out_str); const date_range = getISOdateAsString(date_in_str) + ' - ' + getISOdateAsString(date_out_str); const number_of_nights = Math.ceil((date_out - date_in) / (1000 * 60 * 60 * 24)); //-------------------------------------------------------\\ // Universal Analytics(UA) eCommerce dataLayer.push Code \\ //-------------------------------------------------------\\ // The following code needs to be placed in the section of the confirmation/thank you page. // (It can be placed before or after the GTM container script as we will be calling to this snippet by the custom event name of "ua_purchase"). // The first variable name must be kept as is and the second variable will need to be updated to pull the proper corresponding information from the booking. // Example: 'transactionId': 'confirmation_id'; update the variable of 'confirmation_id' // Not all variables are required but do offer addtional information and context in the Google Analytics reports. window.dataLayer = window.dataLayer || []; dataLayer.push({ 'event': 'ua_purchase', // REQUIRED // Do NOT change this line. 'transactionId': confirmation_id, // REQUIRED // Confirmation ID/booking number (String). 'transactionTotal': transaction_total, // REQUIRED // Total cost of booking including tax (Numeric). 'transactionTax': transaction_tax, // OPTIONAL // Total tax associated with the booking (Numeric). 'transactionProducts': [{ 'sku': unit_id, // REQUIRED // ID of the unit (String). 'name': unit_name, // REQUIRED // Name of the unit (String). 'category': 'unit', // OPTIONAL // Type of unit; Home, Condo, etc. (String). 'price': transaction_total, // REQUIRED // The total cost of the booking (Numeric). 'quantity': 1 // REQUIRED // Defaulted to 1 (Numeric). }] }); //-------------------------------------------------------\\ // Google Analytics 4(GA4) eCommerce dataLayer.push Code \\ //-------------------------------------------------------\\ // The following code needs to be placed in the section of the confirmation/thank you page. // (It can be placed before or after the GTM container script as we will be calling to this snippet by the custom event name of "purchase"). // (It can be placed either before or after the Universal Analytics(UA) eCommerce dataLayer.push Code). // Please follow the same conventions as called to above for the Universal Analytics(UA) eCommerce dataLayer.push Code. // Not all variables are required but do offer addtional information and context in the Google Analytics reports. // Please note that if you do intend to add each of the item_category variables to the code base that it not only pulls the number but attaches on to it the identifier (Example posted following the standard script) dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object. dataLayer.push({ event: "purchase", // REQUIRED // Do NOT change this line. ecommerce: { transaction_id: confirmation_id, // REQUIRED // Confirmation ID/booking number (String). affiliation: "HORA", // OPTIONAL // Name of YOUR company. value: transaction_total, // REQUIRED // Total cost of booking including tax (Numeric). tax: transaction_tax, // OPTIONAL // Total tax associated with the booking (Numeric). currency: "USD", // REQUIRED // Do NOT change this line. items: [ { item_id: unit_id, // REQUIRED // ID of the unit (String). item_name: unit_name, // REQUIRED // Name of the unit (String). affiliation: "HORA", // OPTIONAL // Name of YOUR company. currency: "USD", // REQUIRED // Do NOT change this line. item_brand: "unit", // OPTIONAL // Type of unit; Home, Condo, etc. (String). item_category: number_of_guests, // OPTIONAL // Number of guests selected by user in the booking details + identifier (String). item_category2: date_range, // OPTIONAL // Date range of the booking details. YYYY-MM-DD - YYYY-MM-DD format (String). item_category3: number_of_nights, // OPTIONAL // Number of nights/length of stay + identifier (String). price: transaction_total, // REQUIRED // The total cost of the booking (Numeric). quantity: 1 // REQUIRED // Defaulted to 1 (Numeric). } ] } });
top of page

Thank You

400dpilogo.png

We have received your booking, Please see details below

Thank you for your booking <property name>

Your details can be found below. You will also receive an email confirmation once the charge has been made.

Confirmation ID: 

<confirmationId>

Check-in: 

<checkOut>

<checkIn>

Check-out: 

Something went wrong at this stage, please contact us by phone or email found below in Contact Us section

bottom of page