Advertisement
Guest User

Untitled

a guest
Feb 21st, 2018
59
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. travelsearch.js:
  2. function completeTravelSearch(fullData, windowID, travelType, location, checkin, checkout, stayOnPage, poc) {
  3.    
  4.     var hasUserHash = checkIfUserHash();
  5.  
  6.     if (hasUserHash) {
  7.         // add user_hash to serialized data
  8.         var user_hash = encodeURIComponent(getCookie('user_hash'));
  9.         fullData += '&hash=' + user_hash;
  10.     }
  11.  
  12.     if (utm_source) {
  13.         fullData += '&utm_source=' + utm_source;
  14.     }
  15.  
  16.     if (utm_medium) {
  17.         fullData += '&utm_medium=' + utm_medium;
  18.     }
  19.  
  20.     if (utm_campaign) {
  21.         fullData += '&utm_campaign=' + utm_campaign;
  22.     }
  23.  
  24.     if (gclid) {
  25.         fullData += '&gclid=' + gclid;
  26.     }
  27.  
  28.     windowID = makeID();
  29.     window.open(window.location.origin + '/lp/loading?' + fullData, windowID);
  30.  
  31.     if (travelType === 'flight') {
  32.         $('#travel-search-flight').foundation('close');
  33.     } else {
  34.         $('#travel-search-hotel').foundation('close');
  35.     }
  36.  
  37.     searchCount++;
  38.  
  39.     // send to analytics
  40.     ga_logTravelSearchComplete(travelType, poc);
  41.  
  42.     if (Object.keys(optout).length > 0) {
  43.         ga_logOptOut(travelType, poc, optout);
  44.     }
  45.  
  46.     // check if this is their first search or if they've already been forwarded once
  47.     if (firstSearch(window.location.href, searchCount)) {
  48.         forwardToPage(travelType, location, checkin, checkout, stayOnPage, poc);
  49.     }
  50. }
  51.  
  52. loading.js:
  53. briteVerify(email, function(accepted) {
  54.  
  55.             if (accepted) {
  56.  
  57.                 // Make a POST ajax call to /pocSubscription
  58.                 // with all the url query strings as requests
  59.                 // back to Larael.
  60.                 $.ajax({
  61.                     type: "POST",
  62.                     url: "/lp/pocSubscription",
  63.                     data: urlData,
  64.                     // On Success, get the returned data,
  65.                     // extract the URL and send it to the
  66.                     // Booking buddy function
  67.                     success: function(data) {
  68.                         sendDataToSmarterTravel(urlData);
  69.                         sendDataToBookingBuddy(data);
  70.                     },
  71.                     // On error, as a fall back, take the user
  72.                     // to the deals page.
  73.                     error: function () {
  74.                         // this didn't work, go straight to the deals page
  75.                         setTimeout(function (){
  76.                             $('#loading').fadeOut();
  77.                             window.location = window.location.origin + '/deals';
  78.                         }, 100);
  79.                     }
  80.                 });
  81.             }
  82.         });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement