Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- travelsearch.js:
- function completeTravelSearch(fullData, windowID, travelType, location, checkin, checkout, stayOnPage, poc) {
- var hasUserHash = checkIfUserHash();
- if (hasUserHash) {
- // add user_hash to serialized data
- var user_hash = encodeURIComponent(getCookie('user_hash'));
- fullData += '&hash=' + user_hash;
- }
- if (utm_source) {
- fullData += '&utm_source=' + utm_source;
- }
- if (utm_medium) {
- fullData += '&utm_medium=' + utm_medium;
- }
- if (utm_campaign) {
- fullData += '&utm_campaign=' + utm_campaign;
- }
- if (gclid) {
- fullData += '&gclid=' + gclid;
- }
- windowID = makeID();
- window.open(window.location.origin + '/lp/loading?' + fullData, windowID);
- if (travelType === 'flight') {
- $('#travel-search-flight').foundation('close');
- } else {
- $('#travel-search-hotel').foundation('close');
- }
- searchCount++;
- // send to analytics
- ga_logTravelSearchComplete(travelType, poc);
- if (Object.keys(optout).length > 0) {
- ga_logOptOut(travelType, poc, optout);
- }
- // check if this is their first search or if they've already been forwarded once
- if (firstSearch(window.location.href, searchCount)) {
- forwardToPage(travelType, location, checkin, checkout, stayOnPage, poc);
- }
- }
- loading.js:
- briteVerify(email, function(accepted) {
- if (accepted) {
- // Make a POST ajax call to /pocSubscription
- // with all the url query strings as requests
- // back to Larael.
- $.ajax({
- type: "POST",
- url: "/lp/pocSubscription",
- data: urlData,
- // On Success, get the returned data,
- // extract the URL and send it to the
- // Booking buddy function
- success: function(data) {
- sendDataToSmarterTravel(urlData);
- sendDataToBookingBuddy(data);
- },
- // On error, as a fall back, take the user
- // to the deals page.
- error: function () {
- // this didn't work, go straight to the deals page
- setTimeout(function (){
- $('#loading').fadeOut();
- window.location = window.location.origin + '/deals';
- }, 100);
- }
- });
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement