(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":3638,"name":"Oakley SI","cookie_name":"bounceClientVisit3638","domain":"oakleysi.com","ct":"fp_local_storage","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":1,"gmp":0,"whitelist_check":0},"burls":[{"prop":"contains","val":"stg.oakleysi"},{"prop":"contains","val":"stg.oakley"}],"ple":false,"fbe":true,"mas":2,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"var OAKLEY_STANDARD_ISSUE_DOMAIN = 'https://www.oakleysi.com/',\n\tACCOUNT_PATH = 'en-us/my-account/profile',\n\tEMPTY_CART_SELECTOR = '.emptyCartContainer';\n\n/** *********** HELPERS **************/\n\nfunction getUrl(param = []) {\n\treturn bouncex.utils.url.allowParams(param);\n}\n\nfunction isEn() {\n\treturn getUrl().indexOf('en-us') > -1;\n}\n\nfunction isValidDomain() {\n\tvar currentUrl = getUrl();\n\treturn currentUrl.indexOf(OAKLEY_STANDARD_ISSUE_DOMAIN) > -1;\n}\n\nfunction isAccountPage() {\n\treturn getUrl().indexOf(ACCOUNT_PATH) > -1;\n}\n\n/* Different tracking is needed for all custom product and category pages */\nfunction isCustomPage() {\n\treturn getUrl().indexOf('custom') > -1;\n}\n\nfunction formatItemIdFromUrl(itemUrl) {\n\tif (itemUrl) {\n\t\treturn itemUrl.split('?')[0].split('/')[itemUrl.split('/').length - 1];\n\t}\n\n}\n\nfunction setVariable(rtvName, value) {\n\tbouncex.setv(rtvName, value);\n\tbouncex.setBounceCookie();\n}\n\n/** *********** ITEM META DATA **************/\n\nfunction getItemId() {\n\tif (isCustomPage()) {\n\t\treturn formatItemIdFromUrl(getUrl());\n\t}\n\treturn jQuery('.pdhero-ratings-sku .pdhero-sku .pdhero-sku-value').text() || jQuery('.product-info-value.pdhero-sku-value:not([itemprop=\"color\"]').text();\n}\n\nfunction getItemCategory() {\n\tif (jQuery('.breadcrumb .breadcrumbs li:nth-last-child(2)').length) {\n\t\treturn jQuery('.breadcrumb .breadcrumbs li:nth-last-child(2) a span').text();\n\t}\n\treturn 'Global';\n\n}\n\nfunction getItemImage() {\n\tvar defaultImage = jQuery('meta[property=\"og:image').attr('content'),\n\t\tcustomPageImage = jQuery('.fc-display-images > div > div > img').attr('src');\n\n\tif (defaultImage) { return defaultImage; }\n\n\tif (isCustomPage()) {\n\t\treturn customPageImage ? window.location.protocol + customPageImage : null;\n\t}\n\treturn jQuery('.slide.active img').attr('srcset');\n}\n\nfunction itemInStock() {\n\tif (bouncex.vars.logged_in) {\n\t\treturn jQuery('.outOfStockLabel').length === 0;\n\t}\n\treturn jQuery('meta[property=\"product:availability\"]').attr('content') === 'in stock';\n}\n\nfunction isValidItem() {\n\tvar item = getItem();\n\treturn item.id && item.copy && item.category && item.imageurl;\n}\n\nfunction getItem() {\n\treturn {\n\t\tid: getItemId(),\n\t\tcopy: bouncex.vars.prod_name,\n\t\tcategory: getItemCategory(),\n\t\turl: getUrl(['skuCode', 'variant']),\n\t\timageurl: getItemImage(),\n\t\tinstock: itemInStock(),\n\t};\n}\n\nfunction viewItem(itemId) {\n\tbouncex.push(['view item', {\n\t\t'item:id': itemId\n\t}]);\n\tsetVariable('item_id', itemId);\n}\n\nfunction firePdpEvents() {\n\tvar item = getItem();\n\tbouncex.setTimeout2(function () {\n\t\tbouncex.push(['item', item]);\n\t\tviewItem(item.id);\n\t}, 1500);\n}\n\n/** *********** CATEGORY META DATA **************/\n\nfunction getCategoryPageTitle() {\n\tif (bouncex.website.pts === 'search') {\n\t\treturn bouncex.utils.url.getParam('text').replace(/\\+/g, ' ');\n\t}\n\n\tvar pageTitle = jQuery('.plp-title').first().text() ||\n\t\tjQuery('.breadcrumbs li:nth-last-child(1) span:not(.separator)').last().text();\n\n\treturn pageTitle.replace(/[^\\w ]/g, '');\n}\n\nfunction getCustomCategoryIds() {\n\tvar products = jQuery('.prod-tile .preview > a.preview_image.preview_image-primary');\n\tvar productIds = [];\n\tfor (var i = 0; i < products.length; i++) {\n\t\tvar currentProduct = products.eq(i);\n\t\tvar itemUrl = currentProduct.attr('href');\n\t\tif (itemUrl) {\n\t\t\tvar itemId = formatItemIdFromUrl(itemUrl);\n\t\t\tproductIds[productIds.length] = itemId;\n\t\t}\n\t}\n\treturn productIds.join(',');\n}\n\nfunction getStandardCategoryIds() {\n\tvar products = jQuery('.prod-tile');\n\tvar productIds = [];\n\tfor (var i = 0; i < products.length; i++) {\n\t\tvar currentProduct = products.eq(i);\n\t\tvar itemId = currentProduct.find('.owl-item:first a, .colors-carousel_items .thumb-preview').attr('data-sku');\n\t\tif (itemId) {\n\t\t\tproductIds[productIds.length] = itemId;\n\t\t}\n\t}\n\treturn productIds.join(',');\n}\n\n/* Item id is only available on utag_data */\nfunction getPrescriptionCategoryIds() {\n\t// eslint-disable-next-line no-undef\n\tvar object = utag_data && utag_data.Products;\n\tvar productIds = [];\n\tfor (const property in object) {\n\t\tvar itemId = object[property].Sku;\n\t\tif (itemId) {\n\t\t\tproductIds[productIds.length] = itemId;\n\t\t}\n\t}\n\treturn productIds.join(',');\n}\n\nfunction getCategoryIds() {\n\tif (isCustomPage()) {\n\t\treturn getCustomCategoryIds();\n\t}\n\treturn getStandardCategoryIds() || getPrescriptionCategoryIds();\n}\n\nfunction getCategoryObj() {\n\treturn {\n\t\t'page:title': getCategoryPageTitle(),\n\t\t'page:url': getUrl('text'),\n\t\t'items:ids': getCategoryIds()\n\t};\n}\n\n/** *********** CART FUNCTIONALITY **************/\n\nfunction cartOnReplen() {\n\treturn window.location.href.indexOf('bx_replen') > -1 ||\n\t\twindow.location.href.indexOf('bx_cart') > -1;\n}\n\nfunction addToCart(event, xhr, settings) {\n\tif (settings.url.indexOf('/cart/add') >= 0 || settings.url.indexOf('add-to-cart') >= 0 && !cartOnReplen()) {\n\t\tvar itemId = getItemId();\n\t\tif (itemId) {\n\t\t\tfireAddToCart(itemId);\n\t\t\tif (!bouncex.vars.cart_set) {\n\t\t\t\tsetVariable('cart_set', true);\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction fireAddToCart(itemId) {\n\tbouncex.push(['add to cart', { 'item:id': itemId }]);\n}\n\nfunction fireEmptyCart() {\n\tbouncex.push(['empty_cart', {}]);\n\tsetVariable('cart_set', false);\n}\n\n/** *********** INITIALIZE EVENTS **************/\n\n\nfunction initializePdpEvents() {\n\tif (bouncex.website.pts === 'product') {\n\t\tbouncex.et.onTrue(isValidItem, firePdpEvents, 10);\n\t\tbouncex.et.onVarChange('item_sku', function (oldVal, newVal) {\n\t\t\tif (newVal && newVal !== bouncex.vars.item_id) {\n\t\t\t\tfirePdpEvents();\n\t\t\t}\n\t\t});\n\t}\n}\n\nfunction initializeCartEvents() {\n\tbouncex.et.cart.init({\n\t\treplenishmentType: 'single',\n\t\treplenish: function () { },\n\t});\n\tbouncex.et.on(jQuery(document), 'ajaxComplete', addToCart);\n\n\tif (bouncex.website.pts === 'cart' && bouncex.vars.cart_set) {\n\t\tbouncex.et.onVisible(EMPTY_CART_SELECTOR, function () {\n\t\t\tfireEmptyCart();\n\t\t});\n\t}\n}\n\nfunction initializeCategoryEvents() {\n\tif (bouncex.website.pts === 'category' || bouncex.website.pts === 'search') {\n\t\tvar categoryObj;\n\t\tbouncex.et.onTrue(function () {\n\t\t\tcategoryObj = getCategoryObj();\n\t\t\treturn categoryObj['items:ids'].length > 0;\n\t\t}, function () {\n\t\t\tbouncex.push(['view category', categoryObj]);\n\t\t}, 10);\n\t}\n}\n\nfunction initializeLoggedInUser() {\n\tif (!bouncex.vars.logged_in_identified) {\n\t\tif (isAccountPage()) {\n\t\t\tvar userEmail = jQuery('#field-view-email').text();\n\t\t\tif (bouncex.utils.validate.email(userEmail)) {\n\t\t\t\tbouncex.push([\n\t\t\t\t\t'user',\n\t\t\t\t\t{\n\t\t\t\t\t\t'email': userEmail,\n\t\t\t\t\t\t'source': 'LoggedIn'\n\t\t\t\t\t}\n\t\t\t\t]);\n\t\t\t\tbouncex.setv('logged_in_identified', true);\n\t\t\t\tbouncex.setBounceCookie();\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunction initializeClickthroughEvent() {\n\tif (getUrl('ibx_source').indexOf('ibx_source') > -1){\n\t\tbouncex.push(['wknd_email_clickthrough']);\n\t}\n}\n\nif (isValidDomain() && isEn()) {\n\tinitializePdpEvents();\n\tinitializeCategoryEvents();\n\tinitializeCartEvents();\n\tinitializeLoggedInUser();\n\tinitializeClickthroughEvent();\n}","dge":false,"bxidLoadFirst":false,"pie":false,"cme":false,"gbi_enabled":0,"bpush":false,"pt":{"cart":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/cart"}]]},"category":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.template-categorypagetemplate, .category-header, .template-collectionspagetemplate').length > 0 && document.querySelectorAll('.template-homepagetemplate').length === 0 && document.querySelectorAll('.page-homepagecontentpage').length === 0;"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"/search"}]]},"checkout":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/checkout"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"/orderConfirmation/"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.page-homepagecontentpage').length > 0;"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.page-homepage').length > 0;"}]]},"product":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.page-customproductpage, .page-productpage, .page-rxproductpage').length > 0;"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.page-productpage').length > 0;"}]]},"search":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/search"}]]}},"els":{"CART - Checkout Button":"","CART - Promo Code Apply Button":"","CART - Promo Code Box":"","CAT - Product Grid Image":"","CAT - Quickview Box":"","CAT-AddtoCartButton":"","CAT-QuickviewAddtoCart":"","Footer":"","Navigation bar":"","PDP - Add to Cart Button":"","PDP - Color Option":"","PDP - Hero Image":"","PDP - Product Name":"","PDP - Product Price":"","PDP - Quantity Option":"","PDP - Review Stars":"","PDP - Size Option":"","PDP - Thumbnail Image":"","SEARCH - Product Grid Image":""},"vars":[{"name":"logged_in","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('[data-dropdown-id=\"loggedUser\"]').length > 0;","trigger":""},{"name":"ever_logged_in","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.logged_in ? true : null;","trigger":""},{"name":"cart_qty","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"0","code":"Number(jQuery('.cart-button .count:not(.mobile-count)').text().replace(/[^0-9.]/g, ''));","trigger":""},{"name":"cart_value","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function(){\n\tif (jQuery('.cart-flyout .costsSummary').length > 0) {\n\t\treturn jQuery('.cart-flyout .costsSummary .subtotal').text().replace(/[^0-9.]/g, '');\n\t} else if (jQuery('.cart-flyout .headline:contains(\"Your cart is empty\")').length > 0) {\n\t\treturn 0;\n\t} else if (bouncex.website.pts === 'cart') {\n\t\treturn Number(jQuery('.totals .subtotal-price').text().replace(/[^0-9.]/g, ''));\n } else if (bouncex.website.pts === 'checkout') {\n\t\treturn jQuery('.totals .total-price').text().replace(/[^0-9.]/g, '');\n\t} else {\n\t\treturn null;\n\t}\n})();","trigger":""},{"name":"prod_price","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"0","code":"bouncex.website.pts === 'product' && jQuery('[data-dropdown-id=\"loggedUser\"]').length > 0 ? Number(jQuery('#salePrice').text().replace(/[^0-9.]/g, '') || jQuery('#mnt_pst').text().replace(/[^0-9.]/g, '') || jQuery('.osi-rx-price:visible').text().replace(/[^0-9.]/g, '') || jQuery('meta[property=\"product:price:amount\"]').attr('content')) : false;","trigger":""},{"name":"prod_name","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === 'product' ? jQuery('h1.pdp-hero-name').text().trim() || jQuery('.breadcrumbs li').last().find('span[itemprop=\"name\"]').text().trim() || jQuery('.fc-product-name').text() || jQuery('.pdhero-name').text() : false;","trigger":""},{"name":"in_stock","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts === 'product' && jQuery('.oos-options-panel').length === 0 && jQuery('.pdp-area, #configureContainer').length > 0 && jQuery('.price-ratings').text().indexOf('Coming Soon') === -1;","trigger":""},{"name":"submitted_onsite","polling":"all","persist":"permanent","page_types":[],"testmode":true,"default":"false","code":"jQuery('#SignUpModal .thank_you, #footer-newsletter-locator-form + .thanks_message').is(':visible') || null;","trigger":""},{"name":"item_id_product","polling":"vars","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"(function() {\n if (bouncex.website.pts === 'product') {\n var url = jQuery('link[rel=\"canonical\"]').attr('href');\n var match = url && url.match(/product\\/([\\w-]+)/);\n if (match && match[1]) {\n return match[1];\n } \n }\n})();\n","trigger":""},{"name":"item_id_quickview","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"","trigger":"event"},{"name":"item_id_hover","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"","trigger":"event"},{"name":"items_ids","polling":"none","persist":"no","page_types":["category","search"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_url","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_image_url","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_category","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_price","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_in_stock","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"page_url","polling":"none","persist":"no","page_types":["category","search"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"page_title","polling":"none","persist":"no","page_types":["category"],"testmode":true,"default":"false","code":"","trigger":""},{"name":"item_copy","polling":"none","persist":"no","page_types":["product"],"testmode":true,"default":"false","code":"","trigger":"pageload"},{"name":"cart_token","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart_items","polling":"none","persist":"no","page_types":[],"testmode":true,"default":"false","code":"null;","trigger":"pageload"},{"name":"id_status","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"has_converted_purchased","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"window.location.href.indexOf('/checkout/orderConfirmation') > -1 || null;","trigger":"pageload"},{"name":"has_converted_registered","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"window.location.href.indexOf('?signup=true') > -1 || null;","trigger":"pageload"},{"name":"cart_promo_value","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"jQuery('.markdown-price.promo').text().replace(/[^0-9.]/g, '') || null;","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":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cart_set","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"item_id","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"item_sku","polling":"vars","persist":"no","page_types":[],"testmode":false,"default":"false","code":"jQuery('.product-info-value.pdhero-sku-value:not([itemprop=\"color\"]').text();","trigger":"pageload"},{"name":"default_sku","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","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":{"bxid":"espemailid"},"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":0},"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":"","ga4_measurement_id":""} ; 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: 0 }; bouncex.assets = {"ads":"44fda29a3ca8b3798fe72ceb2caeade8","creativesBaseStyles":"a53944a2","gpsAuction":"1375a7b38c31e98d14fe7f396b72da14","inbox":"02aca5df0e176b8810a86da97ac05424","onsite":"0e56ab6ba004ee080ce3deb3edae35e9","sms":"e39203556bab2366e56296ce42e974a7","websdk":"0704dae1eb637cbeb4a847506058402d"}; bouncex.push = function(pushData) { bouncex.pushedData.push(pushData); } var runtime = document.createElement('script'); runtime.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/runtime_6459738026535cda4232dc813c61447d.js'); runtime.setAttribute('async', 'async'); runtime.setAttribute('onload', 'bouncex.initializeTag()'); bouncex.initializeTag = function() { var script = document.createElement('script'); script.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/main-v2_b0f9dea1e3910d3b6e492e0d6dab8565.js'); script.setAttribute('async', 'async'); document.body.appendChild(script); bouncex.initializeTag = function() {}; }; document.body.appendChild(runtime); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();