(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":2357,"name":"Budget Truck","cookie_name":"bounceClientVisit2357","domain":"budgettruck.com","ct":"fp_local_storage","ally":0,"ei":0,"tcjs":"","cjs":"/* KK auto-apply/click to apply code */\n(function(){\n\tbouncex.apply_code = function(code) {\n\t\tif (jQuery('#txtCouponCode').length) {\n\t\t\twindow.ApplyCode(code);\n\t\t\tjQuery(\"#txtCouponCode\").val(code);\n\t\t\tbouncex.setv('applied_coupon', code);\n\t\t\tbouncex.setBounceCookie();\n\t\t} else {\n\t\t\twindow.location = 'https://www.budgettruck.com/#bx_autoapply=' + code;\n\t\t}\n\t};\n\tif (window.location.pathname === '/' || window.location.pathname.indexOf('home') > -1 || window.location.href.indexOf('bx_autoapply') > -1) {\n var code = bouncex.utils.getParam('bx_autoapply');\n\n if (!!code && !!jQuery('#txtCouponCode').length) {\n\t\t\tjQuery(\"#txtCouponCode\").val(code);\n\t\t\tbouncex.setv('applied_coupon', code);\n\t\t\tbouncex.setBounceCookie();\n\t }\n\n\t\tvar coupon = bouncex.vars.applied_coupon;\n\n\t\tif (coupon){\n\t\t\tsetTimeout(function(){\n\t\t\t\twindow.ApplyCode(coupon);\n\t\t\t},1000);\n\t\t}\n\t}\n}());","force_https":false,"waypoints":false,"content_width":0,"gai":"UA-6997633-6","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":false,"ete":1,"ettm":false,"etjs":"/* --------------------------------- HELPER --------------------------------- */\nfunction getUrl() {\n return bouncex.utils.url.allowParams();\n}\n\nfunction slugify(txt) {\n return txt.toString().toLowerCase()\n .replace(/\\s+/g, '-')\n .replace(/[^\\w\\-]+/g, '')\n .replace(/\\-\\-+/g, '-')\n .replace(/^-+/, '')\n .replace(/-+$/, '');\n}\n\n/* ------------------------------ TRACK SUBMIT ----------------------------- */\nfunction fireAtc() {\n var reservationObject = {},\n replenItem = {},\n itemurl,\n imagePathName;\n\n /* Note: fires item event on truck search page */\n bouncex.et.onTrue(function () {\n itemurl = getUrl();\n imagePathName = jQuery('img#btrLogo').attr('src');\n return itemurl && imagePathName;\n },\n function () {\n bouncex.push(['item', {\n 'item:id': 'truckrrental',\n 'item:copy': 'Truck Rental',\n 'item:url': itemurl,\n 'item:imageurl': 'https://www.budgettruck.com' + imagePathName\n }]);\n }, 5);\n\n // ensures necessary replen keys exist & contain only truthy values. couponCode is optional\n bouncex.et.onTrue(function () {\n reservationObject = getReservationObject();\n replenItem = {\n pickUpLocation: reservationObject.PickupLocation,\n pickUpDate: reservationObject.PickupDate,\n pickUpTime: bouncex.vars.pick_up_time,\n transactionType: reservationObject.TransactionTypeCode,\n dropOffLocation: reservationObject.DropOffLocation,\n couponCode: reservationObject.CouponCode\n };\n replenItem.eventTimestamp = new Date(replenItem.pickUpDate + \" \" + replenItem.pickUpTime).valueOf() || 0;\n replenItem.eventTriggerstamp = new Date().valueOf();\n\n for (var key in replenItem) {\n if (!replenItem[key] && key !== \"couponCode\") {\n return false;\n }\n }\n\n return true;\n }, function () {\n bouncex.push(['add to cart', {\n 'item:id': 'truckrrental',\n 'cart:item': bouncex.stringify(replenItem)\n }]);\n return;\n }, 10);\n\n /* Note: will fire item & add to cart event after selecting a truck */\n bouncex.et.on(bouncex.document, 'click.bxatc', function () {\n var itemCopy,\n itemId;\n\n bouncex.et.onTrue(function () {\n // pulls in reservation data and if object truthy\n reservationObject = getReservationObject();\n replenItem = {\n pickUpLocation: reservationObject.PickupLocation,\n pickUpDate: reservationObject.PickupDate,\n pickUpTime: bouncex.vars.pick_up_time,\n transactionType: reservationObject.TransactionTypeCode,\n dropOffLocation: reservationObject.DropOffLocation,\n couponCode: reservationObject.CouponCode\n };\n replenItem.eventTimestamp = new Date(replenItem.pickUpDate + \" \" + replenItem.pickUpTime).valueOf() || 0;\n replenItem.eventTriggerstamp = new Date().valueOf();\n\n for (var key in replenItem) {\n if (!replenItem[key] && key !== \"couponCode\") {\n return false;\n }\n }\n\n itemCopy = jQuery('#selectedTruckRow img').attr('title');\n imagePathName = jQuery('picture img[src]').attr('src');\n itemurl = getUrl();\n return itemCopy && itemurl && imagePathName;\n },\n function () {\n itemId = slugify(itemCopy);\n\n bouncex.push(['add to cart', {\n 'item:id': itemId,\n 'cart:item': bouncex.stringify(replenItem)\n }]);\n\n bouncex.push(['item', {\n 'item:id': itemId,\n 'item:copy': itemCopy,\n 'item:url': itemurl,\n 'item:imageurl': 'https://www.budgettruck.com' + imagePathName\n }]);\n }, 10);\n }, 'button.btn-primary');\n\n return;\n}\n\nfunction getReservationObject() {\n var jsonString = jQuery(\"script[type='text/javascript']:contains(dataLayer = [)\").first().text().trim()\n .replace(/^(.*)\\[/, '') // removes first [ & everything before\n .replace(/]+$/, '') // removes trailing ]\n .replace(/'/g, '\"'); // replaces single quotes with double quotes. Needed for parseJSON\n\n return bouncex.parseJSON(jsonString, {});\n}\n\nfunction initializeCartEvents() {\n var pickUpLocationSelector = \"#txtPickupLocation\",\n pickUpDateSelector = \"#pickUpDate\",\n pickUpTimeSelector = \"#ddlPickupTimes\",\n dropOffLocationSelector = \"#txtDropOffLocation\";\n\n // excluding coupon code, this is optional. We are also excluding pickUpDateSelector. This is added after the rest of the items\n function didThisReplen() {\n return jQuery(pickUpLocationSelector).val() &&\n jQuery(pickUpTimeSelector).val() &&\n jQuery(dropOffLocationSelector).val();\n }\n\n // adds comma to City, ST location format\n function addCommaIfCityState(pickUpLocation) {\n pickUpLocation = pickUpLocation || \"\";\n pickUpLocation = pickUpLocation.toString();\n\n var stateRegEx = / [A-Z]{2}$/g;\n stateMatchArr = pickUpLocation.match(stateRegEx) || [\"\"],\n stateMatchString = stateMatchArr[0];\n\n if (stateMatchString) {\n pickUpLocation = pickUpLocation.replace(stateRegEx, \",\" + stateMatchString);\n }\n\n return pickUpLocation;\n }\n\n function setCouponCode(itemCouponCode) {\n var couponCode = bouncex.utils.url.getParam(\"bx_autoapply\") || itemCouponCode;\n if (couponCode) {\n bouncex.utils.getNestedProp(\"ApplyCode\", function () { return null })(couponCode);\n bouncex.setVar(\"applied_coupon\", couponCode);\n }\n return;\n }\n\n function formatDate(date) {\n date = date || \"\";\n\n var dateArr = date.split(\"/\"),\n formattedDate = [];\n\n for (var i = 0; i < dateArr.length; i++) {\n var val = dateArr[i];\n\n if (val.length < 2) {\n val = \"0\" + val;\n }\n\n formattedDate.push(val);\n }\n\n return formattedDate.length === 3 && formattedDate.join(\"/\");\n\n }\n\n function setReplenDate(pickUpDate) {\n if (!pickUpDate) {\n return;\n }\n\n var dateButtonSelector = \".ui-state-active\";\n\n jQuery(pickUpDateSelector).val(formatDate(pickUpDate));\n bouncex.et.onTrue(function () {\n jQuery(pickUpDateSelector).focus();\n jQuery(dateButtonSelector).last().click();\n return jQuery(pickUpDateSelector + \":visible\").length;\n }, function () {\n jQuery(pickUpDateSelector).focus();\n bouncex.setTimeout2(function () {\n jQuery(dateButtonSelector).last().click();\n }, 500);\n })\n }\n\n\n bouncex.et.cart.init({\n replenish: function (cart) {\n // we are setting up our eligibility where our cart.items will be a length of 1 with our event being replenished\n var item = cart.items && cart.items.pop() || {};\n\n bouncex.setTimeout2(function () {\n jQuery(pickUpLocationSelector).val(addCommaIfCityState(item.pickUpLocation));\n jQuery(dropOffLocationSelector).val(addCommaIfCityState(item.dropOffLocation));\n jQuery(pickUpTimeSelector).val(item.pickUpTime);\n jQuery(\"#radio-value-OW\").click();\n\n bouncex.setTimeout2(function () {\n setReplenDate(item.pickUpDate);\n setCouponCode(item.CouponCode);\n if (didThisReplen()) {\n bouncex.push([\"cart replenish\", { success: true, count: 1, replentype: \"custom\" }]);\n } else {\n bouncex.push([\"cart replenish\", { success: false, count: 0, replentype: \"custom\" }]);\n }\n }, 1000);\n\n }, 1000);\n\n return;\n },\n replenishmentType: 'custom'\n });\n\n return;\n}\n/* --------------------------- INITIALIZE TRACKING -------------------------- */\nfunction isValidDomain() {\n return getUrl().indexOf('https://www.budgettruck.com') > -1;\n}\n\nfunction isEn() {\n var lang = jQuery('html').attr('lang');\n return lang === 'en' || lang === 'en-US';\n}\n\nfunction isValidForTracking() {\n return isValidDomain() && isEn();\n}\n\nfunction init() {\n if (!isValidForTracking()) {\n return;\n }\n\n if (getUrl().indexOf(\"/truck\") > -1) {\n fireAtc();\n }\n\n initializeCartEvents();\n\n return;\n}\n\ninit();\n","dge":false,"bxidLoadFirst":false,"pie":false,"cme":false,"gbi_enabled":0,"bpush":false,"pt":null,"els":null,"vars":[{"name":"one_way","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"bouncex.utils.getNestedProp('window.dataLayer[0].TransactionTypeCode') === 'OW' || jQuery(\"#txtDropOffLocation:visible\").length > 0 || jQuery(\"script[type='text/javascript']:contains(dataLayer):contains('OW')\").text().trim().length > 0;","trigger":""},{"name":"homepage_discount_applied","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var onClickText = jQuery(\"[class*='couponbook']a[onclick]\").attr(\"onclick\") || \"\",\n defaultCoupon = onClickText.split(\"('\").pop().split(\"')\")[0] || \"20DIS\",\n appliedCoupon = jQuery(\"#txtCouponCode\").val(),\n otherCoupons = ['2BMF0'];\n\n if (appliedCoupon) {\n return otherCoupons.indexOf(appliedCoupon) > -1 || appliedCoupon === defaultCoupon;\n }\n return null;\n})();","trigger":""},{"name":"cart","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null","trigger":""},{"name":"res_expired","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":""},{"name":"applied_coupon","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":""},{"name":"pickup_date","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var pickup = typeof window.objPickUpDate !== 'undefined' ? objPickUpDate : jQuery('#pickUpDate').val();\n if (pickup){\n var pickupDate = new Date(pickup);\n return pickupDate.format('MM/dd/yyyy');\n }\n return null;\n})();","trigger":""},{"name":"pickup_location","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function() {\n if(window.dataLayer && dataLayer[0] && dataLayer[0].PickupLocationId) {\n return window.dataLayer[0].PickupLocationId;\n }\n return null;\n})();\n","trigger":""},{"name":"pickup_date_date","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var dateVal = jQuery('#pickUpDate').val() || bouncex.utils.getNestedProp('window.dataLayer[0].PickupDate');\n \n if(dateVal){\n var date = new Date(dateVal);\n return date.format('yyyyMMdd');\n } else {\n return null;\n }\n})();","trigger":"pageload"},{"name":"drop_off_date","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var dateVal = bouncex.utils.getNestedProp('window.dataLayer[0].DropOffDate');\n \n if(dateVal){\n var date = new Date(dateVal);\n return date.format('yyyyMMdd');\n } else {\n return null;\n }\n})();","trigger":"pageload"},{"name":"pickup_city","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var pickUpInputVal = jQuery('#txtPickupLocation').val() || jQuery('.bt-lo-header:contains(Pick-up Location) + .bt-location-well span[data-bind$=\"Zip\"]').text(),\n city = false;\n \n if (pickUpInputVal && pickUpInputVal.indexOf(',') > -1) {\n city = pickUpInputVal.split(',')[0];\n }\n \n return city || null;\n})();","trigger":"pageload"},{"name":"pickup_state","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var pickUpInputVal = jQuery('#txtPickupLocation').val(),\n pickUpLocationText = jQuery('.bt-lo-header:contains(Pick-up Location) + .bt-location-well span[data-bind$=\"Zip\"]').text(),\n state = false;\n \n if (pickUpInputVal && pickUpInputVal.indexOf(',') > -1) {\n state = pickUpInputVal.split(',')[1].trim();\n } else if (pickUpLocationText.length > 0) {\n textMatch = pickUpLocationText.match(/(?:,\\s)[A-Z]{2}(?=\\s\\d+)/);\n state = textMatch && textMatch[0].replace(',','').trim();\n }\n \n return state || null;\n})();","trigger":"pageload"},{"name":"drop_off_city","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var dropOffLocationText = jQuery('.bt-lo-header:contains(Drop-off Location) + .bt-location-well span[data-bind$=\"Zip\"]').text(),\n dropOffDataLayer = bouncex.utils.getNestedProp('window.dataLayer[0].DestinationCityState'),\n city = false;\n \n if(dropOffLocationText.length > 0 && dropOffLocationText.indexOf(',') > -1){\n city = dropOffLocationText.split(',')[0].trim();\n } else {\n var match = dropOffDataLayer && dropOffDataLayer.match(/[a-zA-Z\\s]+(?=\\s[a-zA-Z]{2}$)/); \n city = match && match[0];\n }\n\n return city || null;\n})();","trigger":"pageload"},{"name":"drop_off_state","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var dropOffLocationText = jQuery('.bt-lo-header:contains(Drop-off Location) + .bt-location-well span[data-bind$=\"Zip\"]').text(),\n dropOffDataLayer = bouncex.utils.getNestedProp('window.dataLayer[0].DestinationCityState'),\n state = false;\n \n if(dropOffLocationText.length > 0 && dropOffLocationText.indexOf(',') > -1){\n var textmatch = dropOffLocationText.match(/(?:,\\s)[a-zA-Z]{2}(?=\\s\\d+)/);\n state = textmatch && textmatch[0].replace(',','').trim();\n } else {\n var match = dropOffDataLayer && dropOffDataLayer.match(/(?:\\s)[a-zA-Z]{2}$/);\n state = match && match[0].trim();\n }\n\n return state || null;\n})();","trigger":"pageload"},{"name":"pick_up_time","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"","code":"(function() {\n var time = jQuery(\"#ddlPickupTimes\").val();\n\n if (time) {\n return time;\n }\n})();","trigger":"pageload"},{"name":"ancillaries_selected","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function () {\n if (bouncex.calling_url.includes(\"add-ons\")) {\n var protectionOptions = {},\n bundleList = window.bundleList();\n for (var bundle of window.bundleList()) {\n var name = bundle.BundleName(),\n products = bundle.BundleProducts(),\n productIdList = [];\n for (var product of products) {\n productIdList.push(product.ProductServiceCode());\n }\n protectionOptions[name] = productIdList.sort();\n }\n window.sessionStorage.setItem(\"protectionOptions\", JSON.stringify(protectionOptions));\n }\n if (bouncex.calling_url.includes(\"payment\")) {\n var protections = JSON.parse(sessionStorage.getItem(\"protectionOptions\")),\n protectionSelections = dataLayer.find(obj => \"TransactionProducts\" in obj).TransactionProducts.filter(obj => obj.ProductType === \"Protection\").map(obj => obj.ProductId).sort();\n var chosen = [], \n declined = [];\n var checker = (arr, target) => target.every(v => arr.includes(v));\n for (var [key, value] of Object.entries(protections)) {\n if (checker(protectionSelections, value)) {\n chosen.push(key);\n } else {\n declined.push(key);\n }\n }\n bouncex.setVar('ancillaries_declined', declined.length > 0 ? declined.toString() : false);\n if (chosen.length) {\n return chosen.toString();\n }\n return false;\n }\n})();","trigger":"pageload"},{"name":"ancillaries_declined","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cookie_modal_present","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('#onetrust-banner-sdk').is(':visible');","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":1,"mibcx":1,"te":1,"cart_rep":{"get":"","set":""},"ulpj":null,"cus":"","miw_exclude":"","enabled":1},"etjson":null,"osre":true,"osru":"osr.bounceexchange.com/v1/osr/items","checkDfp":false,"gamNetwork":"","spa":0,"spatm":1,"preinit_cjs":"","crs":{"integrations":null,"pageCount":null},"mat":0,"math":0,"cpnu":"coupons.bounceexchange.com","dfpcms":0,"sms":{"optm":"","eventSharing":false,"shqId":"","enabled":1},"pde":false,"fmc":["US","CA"],"fme":true,"fmx":"","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},"ga4_property_id":"387489551","ga4_measurement_id":"G-PRWXCNFHG9","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":"1f1fac7dbadf36334a3843590881e91b","creativesBaseStyles":"a53944a2","gpsAuction":"bbb80866120d17013073bb6d284cbd6b","inbox":"75060a85c1a4aebcc6f779b9e84db722","onsite":"abbdf7a49be9b52b097917b7b527b262","sms":"e39203556bab2366e56296ce42e974a7","websdk":"0df0ee1d39c3e46e93a5041146975258"}; 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_4afe8dd903977b9d19edc00301c05eab.br.js'); script.setAttribute('async', 'async'); document.body.appendChild(script); bouncex.initializeTag = function() {}; }; runtime.onload = bouncex.initializeTag; document.body.appendChild(runtime); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();