(function() { function bxBootstrap() { var re = /bot|crawl|slurp|spider|mediapartners|headlesschrome|snap-prefetch|remotasks|woorank|uptime\.com|facebookexternalhit|facebookcatalog/i; if (re.test(navigator.userAgent) || navigator.userAgent == '') { return; } if (!(window.bouncex&&bouncex.website)) { var pushedData = []; if(window.bouncex && bouncex.push && bouncex.length){ pushedData = bouncex; } window.bouncex = {}; bouncex.pushedData = pushedData; bouncex.website = {"id":7844,"name":"Hertz","cookie_name":"bounceClientVisit7844","domain":"hertz.comrentacarreservation","ct":"bind_to_domain","ally":0,"ei":0,"tcjs":"","cjs":"","force_https":false,"waypoints":false,"content_width":900,"gai":"","swids":"","sd":0,"ljq":"auto","campaign_id":0,"is_preview":false,"aco":{"first_party_limit":"3500","local_storage":"1"},"cmp":{"gdpr":0,"gmp":0,"whitelist_check":0},"burls":[],"ple":false,"fbe":true,"ffs":"","mas":2,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"/* ---------------------------- SHARED VARIABLES ---------------------------- */\n\nvar HERTZ_PARAMS = ['CDP','age','ddate','did','pCountryCode','pdate','pid','rateQuoteIds','sippCode','travelType', 'vehicles', 'itinerary', 'review-and-book', 'resetSipp'],\n HERTZ_URL = bouncex.utils.url.allowParams(HERTZ_PARAMS),\n CLEAN_URL = bouncex.utils.url.allowParams(),\n ATC_ID_SELECTOR = '#checkout-summary h6:contains(\"or similar\"), .rd-vehicle .rd-info-left strong:contains(\"or similar\"), #checkout-vehicle-description h6:contains(\"or similar\")';\n\n/* --------------------------------- HELPERS -------------------------------- */\n\nfunction slugify(copy) {\n copy = copy || '';\n return copy.replace(/\\s/g, '_').toLowerCase();\n}\n\n/* ------------------------------ ITEM TRACKING ----------------------------- */\n\nfunction getItem($item) {\n var copy = $item.find('[id*=\"-make_model\"]').text().trim(),\n src = $item.find('img[id*=\"-vehicle_image\"]').attr('src') || '',\n imageurl = '',\n subcopy = $item.find('[id*=\"-vehicle_type\"]').text().trim(),\n price = $item.find('.vehicle-total-pricing:contains(\"est. total\")').text().replace(/[^0-9]/g, '');\n\n if (src) {\n imageurl = bouncex.utils.getOrigin() + src;\n }\n\n return {\n id: slugify(copy),\n copy: copy,\n subcopy: subcopy,\n imageurl: imageurl,\n instock: true,\n price: price\n };\n}\n\nfunction getLoggedInItem($item) {\n var carId = $item.attr('data-sipp'),\n copy = $item.find('.gtm-vehicle-header .gtm-vehicle-desc .gtm-vehicle-type').first().text().replace(/\\(.*?\\)/g,'').trim(),\n imageurl = '',\n subcopy = $item.find('h2.gtm-vehicle-title').first().text().trim(),\n price = $item.find('.gtm-vehicle-pricing .gtm-paynow .gtm-price').text().replace(/[^0-9]/g, '');\n\n if (carId) {\n imageurl = `${bouncex.utils.getOrigin()}/content/dam/hertz/us/vehicles/${carId}.rendition.vlarge.png`;\n }\n\n return {\n id: slugify(copy),\n copy: copy,\n subcopy: subcopy,\n imageurl: imageurl,\n instock: true,\n price: price\n };\n}\n\n// some item:imageurl(s) are lazy loaded, so we don't want to add those on page load.\n// some item:subcopy are blank because there are \"manager specials\" item grids\nfunction isValidItem(item) {\n item = item || {};\n\n return !!item.id && !!item.copy && !!item.imageurl;\n}\n\nfunction getItems() {\n var $logInEls = jQuery('#gtm-vehicle-grid .vehicle'),\n $logOutEls = jQuery('.MuiGrid-item'),\n $items = $logInEls.length > 0 ? $logInEls : $logOutEls,\n getFunc = $logInEls.length > 0 ? getLoggedInItem : getItem,\n items = [],\n i = 0;\n\n for (i; i < $items.length; i++) {\n var item = getFunc(jQuery($items[i]));\n if (isValidItem(item)) {\n items[items.length] = item;\n }\n }\n\n return items;\n}\n\nfunction getItemIds(items) {\n var ids = [],\n i = 0;\n\n items = items || getItems();\n\n for (i; i < items.length; i++) {\n var item = items[i].id;\n if (!item) {\n continue;\n }\n ids[ids.length] = item;\n }\n\n return ids.join(',');\n}\n\n/* ------------------------------- CART EVENTS ------------------------------ */\n\nfunction emptyCart() {\n bouncex.et.onVarChange('cart_qty', function (oldVal, newVal) {\n if (bouncex.vars.cart && newVal === 0 && oldVal > 0) {\n bouncex.push(['empty_cart']);\n bouncex.setVar('cart', false);\n }\n });\n}\n\nfunction replenish(cart) {\n var url = cart.url;\n window.location.href = url + '#bx_replen=true';\n}\n\nfunction inCartReplen() {\n\treturn window.location.href.indexOf('bx_cart') > -1;\n}\n\nfunction reportReplenishment(cart) {\n\tif(inCartReplen()) {\n\t\tbouncex.push(['cart replenish attempt', {\n\t\t\t'cart:count': 0,\n\t\t\t'cart:replentype': 'ajax',\n\t\t}]);\n\t}\n\n\tif (bouncex.website.pts === 'checkout') {\n\t\tvar bxReplen = bouncex.utils.url.getParam('bx_replen'),\n\t\t\titemInCart = getReservationItemId();\n\n\t\tif(bxReplen && itemInCart) {\n\t\t\tbouncex.push(['cart replenish', {\n\t\t\t\t'cart:success': true,\n\t\t\t\t'cart:count': 1\n\t\t\t}]);\n\t\t}\n\t}\n}\n\nfunction initializeCartEvents() {\n bouncex.et.cart.init({\n replenish: replenish,\n replenishmentType: 'ajax',\n reportReplenishment: reportReplenishment,\n });\n\n emptyCart();\n}\n\n/* ------------------------------ USER TRACKING ----------------------------- */\n\nfunction initializeUserTracking() {\n var userEmail;\n\n bouncex.et.onTrue(\n function () {\n if (!bouncex.vars.logged_in || !!bouncex.vars.logged_in_identified) {\n return;\n }\n userEmail = jQuery('.section-row .txt-normal-cont:contains(\"Email\") .email-wrap, .current-email #email-address-original').text().trim() || jQuery('#checkout-member-personal-details p.MuiTypography-root').last().text().trim();\n return bouncex.utils.validate.email(userEmail);\n },\n function () {\n bouncex.push([\n 'user',\n {\n 'email': userEmail,\n 'source': 'LoggedIn'\n }\n ]);\n\n bouncex.setVar('logged_in_identified', true);\n },\n 20\n );\n}\n\n/* ------------------------------ CUSTOM USER TRACKING ----------------------------- */\n\nfunction initializeCustomFieldMapping() {\n var $inputs = jQuery('input'),\n version = bouncex.vars.hertz_site_version;\n\n if (version === 'OLD') {\n bouncex.et.onVisible('input', function(){\n bouncex.off($inputs, 'blur.bxusercustomerevent');\n bouncex.on($inputs, 'blur.bxusercustomerevent', function(){\n var $el = jQuery(this),\n id = $el.attr('id') || '',\n val = $el.val() || $el.text();\n \n bouncex.log('input changes: ', val);\n if (bouncex.utils.validate.email(val)) {\n bouncex.push([\n 'user',\n {\n 'email': val,\n 'source': 'input',\n 'input_id': id\n }\n ]);\n }\n });\n });\n }\n}\n\n/* --------------------------- RESERVATION LOGIC -------------------------- */\n\n// removes item url smart tag validation. Emails drive user back to reservation\n// page. Vehicle PDP's do not exists.\nfunction setItemTrackingRequirements() {\n var requirements = bouncex.et.item.requirements || [],\n excludedReqs = ['url'],\n newReqs = [],\n i = 0;\n\n for (i; i < requirements.length; i++) {\n if (excludedReqs.indexOf(requirements[i].name) > - 1) {\n continue;\n }\n newReqs[newReqs.length] = requirements[i];\n }\n\n bouncex.et.item.requirements = newReqs;\n}\n\nfunction makeReservationEvent(ids) {\n var pickupParam = bouncex.utils.url.getParam('pdate', HERTZ_URL),\n localPickup = localStorage.getItem('PICK_UP_DATE'),\n pickupDate = pickupParam ? new Date(pickupParam) : new Date(localPickup),\n timestamp = pickupDate.getTime(),\n event = {\n 'pickup:date': pickupDate,\n 'page:url': HERTZ_URL,\n 'items:ids': ids,\n 'item:id': ids,\n 'cart:url': HERTZ_URL,\n 'cart:pickuptimestamp': timestamp\n };\n\n return event;\n}\n\nfunction isValidReservationEvents(resEvent) {\n resEvent = resEvent || {};\n\n return !!resEvent['items:ids'] && !!resEvent['page:url'] &&\n !!resEvent['pickup:date'];\n}\n\nfunction initializeReservationEvents() {\n var items,\n ids,\n event,\n i = 0;\n\n bouncex.et.onVisible('#gtm-vehicle-grid .vehicle, .MuiGrid-item', function() {\n bouncex.log('visible search items, waiting 1 second');\n bouncex.setTimeout2(function(){\n items = getItems();\n ids = getItemIds(items);\n event = makeReservationEvent(ids);\n\n setItemTrackingRequirements();\n\n for (i; i < items.length; i++) {\n var item = items[i];\n if (!isValidItem(item)) {\n continue;\n }\n bouncex.push(['item', item]);\n }\n\n if (!isValidReservationEvents(event)) {\n bouncex.log('view search - isValidReservationEvents logic failed');\n bouncex.push(['view search', event]);\n return;\n }\n\n bouncex.setVar('fired_search_event', true);\n bouncex.push(['view search', event]);\n }, 1000);\n });\n\n bouncex.setTimeout2(function(){\n if (!bouncex.vars.fired_search_event) {\n bouncex.log('view search - event failed to fire; firing empty event');\n bouncex.push(['view search', {}]);\n }\n }, 3000);\n}\n\nfunction getReservationItemId() {\n return slugify(jQuery(ATC_ID_SELECTOR).first().text().replace(/\\(.*?\\)/g,'').replace(' ', ' ').trim());\n}\n\nfunction initializeSessionTracking() {\n // Sometimes Hertz will display a modal that indicates \"Oops! Your Session Timed-Out ...\"\n // We should indicate that the user flow was canceled\n // Users are generally brought back to the search page\n bouncex.et.onVisible('[role=\"presentation\"] h3:contains(\"Oops! Your Session Timed-Out ...\")', function() {\n bouncex.push([\n 'session timeout',\n {}\n ]);\n });\n}\nfunction initializeBrowseEvents() {\n bouncex.push([\n 'view browse',\n {\n 'page:url': CLEAN_URL\n }\n ]);\n}\n\nfunction initializeAddToCart() {\n // itemId of single reservation\n var itemId,\n event;\n\n bouncex.et.onVisible(ATC_ID_SELECTOR, function() {\n bouncex.log('visible atc item');\n itemId = getReservationItemId();\n event = makeReservationEvent(itemId);\n\n if (!isValidReservationEvents(event)) {\n bouncex.log('add to cart - isValidReservationEvents logic failed');\n return;\n }\n\n bouncex.push(['add to cart', event]);\n bouncex.setv('cart', true);\n });\n}\n\n/* --------------------------- INITIALIZE TRACKING -------------------------- */\n\nfunction isValidDomain() {\n return CLEAN_URL.indexOf('www.hertz.com') > -1;\n}\n\nfunction isEn() {\n var lang = bouncex.html.attr('lang') || '';\n return /^en/.test(lang);\n}\n\nfunction isCorrectCountry(){\n return bouncex.state.geo.country_code === 'US';\n}\n\nfunction isValidForTracking() {\n return isValidDomain() && isEn() && isCorrectCountry();\n}\n\nfunction init() {\n if (!isValidForTracking()) {\n bouncex.log('isValidForTracking logic failed');\n return;\n }\n\n initializeSessionTracking();\n initializeUserTracking();\n initializeCartEvents();\n\n switch (bouncex.website.pts) {\n case 'browse':\n initializeBrowseEvents();\n break;\n case 'search':\n bouncex.log('search page');\n initializeReservationEvents();\n break;\n case 'checkout':\n bouncex.log('checkout page');\n initializeAddToCart();\n initializeCustomFieldMapping();\n break;\n default:\n break;\n }\n}\n\ninit();\n","dge":true,"bxidLoadFirst":false,"pie":true,"cme":true,"gbi_enabled":0,"bpush":false,"pt":{"ancillary":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"(function() {\n var url = bouncex.utils.url.allowParams(['itinerary', 'vehicles', 'extras', 'review-and-book']),\n ancillaryUrlv1 = 'https://www.hertz.com/us/en/book/ancillaries/coverage',\n ancillaryUrlv2 = 'https://www.hertz.com/us/en/book/ancillaries/extras';\n ancillaryUrlv3 = 'https://www.hertz.com/rentacar/reservation/#extras';\n return url === ancillaryUrlv1 || url === ancillaryUrlv2 || url === ancillaryUrlv3;\n})();\n"}]]},"browse":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"(function() {\n var url = bouncex.utils.url.allowParams(['itinerary', 'vehicles', 'extras', 'review-and-book']),\n browseUrlv1 = 'https://www.hertz.com/rentacar/reservation/',\n browseUrlv2 = 'https://www.hertz.com/rentacar/reservation/#itinerary';\n return url === browseUrlv1 || url === browseUrlv2;\n})();\n"}]]},"checkout":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"(function() {\n var url = bouncex.utils.url.allowParams(['itinerary', 'vehicles', 'extras', 'review-and-book']),\n checkoutUrlv1 = 'https://www.hertz.com/us/en/book/checkout',\n checkoutUrlv2 = 'https://www.hertz.com/rentacar/reservation/#review-and-book';\n return url === checkoutUrlv1 || url === checkoutUrlv2;\n})();\n"}]]},"search":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"(function() {\n var url = bouncex.utils.url.allowParams(['itinerary', 'vehicles', 'extras', 'review-and-book']),\n searchUrlv1 = 'https://www.hertz.com/us/en/book/vehicles',\n searchUrlv2 = 'https://www.hertz.com/rentacar/reservation/#vehicles';\n return url === searchUrlv1 || url === searchUrlv2;\n})();\n"}]]}},"els":{},"vars":[{"name":"logged_in","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('#loggedInMember').length > 0 || !!bouncex.parseJSON(localStorage.getItem('member'), {memberId:''}).memberId;","trigger":"pageload"},{"name":"ever_logged_in","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.logged_in || null;","trigger":"pageload"},{"name":"cart_qty","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function() {\n var page = bouncex.website.pts;\n\n if (page === 'browse' || page === 'search') {\n return 0;\n }\n\n return page === 'ancillary' || page === 'checkout' ? 1 : null;\n})();\n","trigger":"pageload"},{"name":"logged_in_identified","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"submitted_onsite","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"jQuery('.success-msg:visible, .signup-confirmation:visible').text().trim().toLowerCase().indexOf('thanks for signing up!') > -1 || null;","trigger":"pageload"},{"name":"cookie_modal_visible","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.cc-window:not(.cc-invisible)').length > 0;","trigger":"pageload"},{"name":"fired_search_event","polling":"none","persist":"no","page_types":["search"],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"hertz_site_version","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var event = dataLayer.find((item) => item.event === \"raw_virtualPageview\"),\n\t\tversion = event && event.raw && event.raw.systemID || null;\n\treturn version === 'vulcan' ? 'NEW' : version === 'IRAC' ? 'OLD' : version;\n})();","trigger":"pageload"}],"dgu":"pixel.cdnwidget.com","dgp":false,"ba":{"enabled":0,"fbte":0},"biu":"assets.bounceexchange.com","bau":"api.bounceexchange.com","beu":"events.bouncex.net","ibx":{"tjs":"","cjs":"","miw":0,"mibcx":1,"te":1,"cart_rep":{"get":"","set":""},"ulpj":{"sfmc_s":"espemailid"},"cus":"","miw_exclude":"","enabled":1},"etjson":null,"osre":true,"osru":"osr.bounceexchange.com/v1/osr/items","checkDfp":false,"gamNetwork":"","spa":1,"spatm":0,"preinit_cjs":"SinglePageApp.setCustomParams({\n currentPageIdentifier: function() {\n var HERTZ_PARAMS = ['CDP','age','ddate','did','pCountryCode','pdate','pid','rateQuoteIds','sippCode','travelType', 'vehicles', 'itinerary', 'review-and-book', 'resetSipp'];\n return bouncex.utils.gtmLookup('pageName') || bouncex.utils.url.allowParams(HERTZ_PARAMS);\n }\n});","crs":{"integrations":null,"pageCount":null},"mat":0,"math":0,"cpnu":"coupons.bounceexchange.com","dfpcms":0,"sms":{"optm":"","eventSharing":false,"shqId":"","enabled":0},"pde":true,"fmc":["US"],"fme":true,"fmx":"","uid2":true,"sdk":{"android":{"enabled":false,"enabledVersions":[],"eventModifications":null},"ios":{"enabled":false,"enabledVersions":[],"eventModifications":null}},"onsite":{"enabled":1},"ads":{"enabled":0},"pubs":{"enabled":0},"websdk":{"enabled":0,"devMode":0},"ga4_property_id":"340661424","ga4_measurement_id":"3028476861","tag_state_domain":"api.bounceexchange.com"} ; bouncex.tag = 'tag3'; bouncex.$ = window.jQuery; bouncex.env = 'production'; bouncex.restrictedTlds = {"casl":{"ca":1},"gdpr":{"ad":1,"al":1,"at":1,"ax":1,"ba":1,"be":1,"bg":1,"by":1,"xn--90ais":1,"ch":1,"cy":1,"cz":1,"de":1,"dk":1,"ee":1,"es":1,"eu":1,"fi":1,"fo":1,"fr":1,"uk":1,"gb":1,"gg":1,"gi":1,"gr":1,"hr":1,"hu":1,"ie":1,"im":1,"is":1,"it":1,"je":1,"li":1,"lt":1,"lu":1,"lv":1,"mc":1,"md":1,"me":1,"mk":1,"xn--d1al":1,"mt":1,"nl":1,"no":1,"pl":1,"pt":1,"ro":1,"rs":1,"xn--90a3ac":1,"ru":1,"su":1,"xn--p1ai":1,"se":1,"si":1,"sj":1,"sk":1,"sm":1,"ua":1,"xn--j1amh":1,"va":1,"tr":1}}; bouncex.client = { supportsBrotli: 1 }; bouncex.assets = {"ads":"7b352b1295e35e9c90089d9dd48e488f","creativesBaseStyles":"a53944a2","gpsAuction":"bbb80866120d17013073bb6d284cbd6b","inbox":"75060a85c1a4aebcc6f779b9e84db722","onsite":"abbdf7a49be9b52b097917b7b527b262","sms":"e39203556bab2366e56296ce42e974a7","websdk":"fd6a81d9d51cda3a3a55d6ab16eb7ac5"}; bouncex.push = function(pushData) { bouncex.pushedData.push(pushData); } var runtime = document.createElement('script'); runtime.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/runtime_c81e76ee00d795b1eebf8d27949f8dc5.br.js'); runtime.setAttribute('async', 'async'); bouncex.initializeTag = function() { var script = document.createElement('script'); script.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/main-v2_44fe2c098b60c8c639efcfedbd11da35.br.js'); script.setAttribute('async', 'async'); document.body.appendChild(script); var deviceGraphScript = document.createElement('script'); deviceGraphScript.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/cjs_min_6ef1802500d8367a80105e664862d0d7.js'); deviceGraphScript.setAttribute('async', 'async'); var dgAttrs = [{"Key":"id","Value":"c.js"},{"Key":"async","Value":"true"},{"Key":"data-apikey","Value":"2^HIykD"},{"Key":"data-cb","Value":"bouncex.dg.initPostDeviceGraph"},{"Key":"data-bx","Value":"1"},{"Key":"data-gm","Value":"1"},{"Key":"data-fire","Value":"1"}]; if (dgAttrs) { for (var i = 0; i < dgAttrs.length; i++) { deviceGraphScript.setAttribute(dgAttrs[i].Key, dgAttrs[i].Value); } } document.body.appendChild(deviceGraphScript); bouncex.initializeTag = function() {}; }; runtime.onload = bouncex.initializeTag; document.body.appendChild(runtime); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();