(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":4821,"name":"Zales","cookie_name":"bounceClientVisit4821","domain":"zales.com","ct":"multi_cookie","ally":0,"ei":0,"tcjs":"","cjs":"/* enable.feature.SHARED_RUNTIME */","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":[{"prop":"contains","val":"uat2.zales.com"},{"prop":"contains","val":"uat.zales.com"},{"prop":"contains","val":"perf.zales.com"}],"ple":false,"fbe":true,"mas":2,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"/* ---------------------------- SHARED VARIABLES ---------------------------- */\nvar globalConfig = {\n '4821': {\n domain_origin: 'www.zales.com'\n },\n '4820': {\n domain_origin: 'www.kay.com'\n }\n},\n config = globalConfig[bouncex.website.id];\n\n/* ---------------------------- SHADOWROOT SITE ON MOBILE ONLY ---------------------------- */\n/* everything is wrapped inside iframe-like root-shadow element */\n\nfunction getShadow() {\n var root = jQuery('#wmHost');\n if (root && root.length && root[0] && root[0].shadowRoot) {\n return root[0].shadowRoot;\n }\n return false;\n}\n\nfunction isShadowSite(shadow) {\n return !!jQuery(shadow).length;\n}\n\n/* --------------------------------- HELPERS -------------------------------- */\n\nfunction getUrl() {\n return bouncex.utils.url.allowParams(['text']);\n}\n\nfunction decodeUrl(url) {\n var decodedUrl = url ? decodeURIComponent(url) : '';\n return !!decodedUrl && decodedUrl !== 'undefined' ? decodedUrl : '';\n}\n\nfunction getItemIdFromUrl(url) {\n var noParams = url ? decodeUrl(bouncex.utils.url.allowParams([], url)) : '';\n return noParams.split('/').pop();\n}\n\nfunction setVarAndCookie(varName, value) {\n bouncex.setVar(varName, value);\n bouncex.setBounceCookie();\n\n\n}\n\n/* ------------------------------ ITEM TRACKING ----------------------------- */\nfunction getItem() {\n var url = getUrl(),\n itemId = getItemIdFromUrl(url),\n shadow = getShadow();\n\n if (!itemId) {\n return {};\n }\n\n return {\n id: itemId,\n copy: jQuery('.product-detail__name').text() || jQuery(shadow).find('#pdp-wrapper').find('.pdp-header-wrapper h1').text() || jQuery('.pdp-info-container .name').text().trim(),\n category: bouncex.utils.getNestedProp('window.dataLayer.product.dl_orderItem[0].filter1') || window.dataLayer['product.dl_orderItem[0].productCategory'] || 'Zales',\n url: url,\n imageurl: 'https://' + window.location.host + '/productimages/processed/' + itemId + '_0_800.jpg?pristine=true',\n instock: isShadowSite(shadow) ? !getShadowInStockForm(shadow).find('#showNotifyMe').is(':visible').length : getStandardInStockMeta() !== 'out of stock'\n };\n}\n\nfunction getStandardInStockMeta() {\n return jQuery('meta[property=\\'og:availability\\']').attr('content');\n}\n\nfunction getShadowInStockForm(shadow) {\n return jQuery(shadow).find('#standard-cart-form');\n}\n\nfunction isPersonalized(str) {\n return str.toLowerCase().indexOf('personalized') > -1;\n}\n\nfunction isExcluded(item) {\n var shadow = getShadow();\n return item.url.indexOf('egift-card') > -1 ||\n isPersonalized(item.url) ||\n isPersonalized(jQuery('.product-detail__tagline').text()) ||\n isPersonalized(item.category) ||\n isShadowSite(shadow) && isPersonalized(jQuery(shadow).find('#disp-product-tag-api').text());\n}\n\n// we are setting this RTV b/c of our SPA fix. We want to make sure the item metadata is loaded. ID and copy are the two that will denote changes\nfunction setLastFiredItemMetadata(item) {\n setVarAndCookie('last_fired_id', item.id);\n setVarAndCookie('last_fired_copy', item.copy);\n\n}\n\nfunction initializeItemEvents() {\n var item,\n shadow;\n bouncex.et.onTrue(\n function () {\n item = getItem();\n shadow = getShadow();\n return !!item.id &&\n !!item.copy &&\n !!item.category &&\n !!item.url &&\n !!item.imageurl &&\n item.id !== bouncex.vars.last_fired_id &&\n item.copy !== bouncex.vars.last_fired_copy &&\n shadow ? !!getShadowInStockForm(shadow).length : !!getStandardInStockMeta();\n },\n function () {\n if (isExcluded(item)) {\n return;\n }\n\n bouncex.push(['item', item]);\n fireViewItem(item.id);\n setLastFiredItemMetadata(item);\n\n },\n 10\n );\n\n\n}\n\nfunction fireViewItem(itemId) {\n bouncex.push(['view item', {\n 'item:id': itemId,\n 'item:itemgroupid': itemId.replace('V-', '')\n }]);\n\n}\n\n/* ---------------------------- CATEGORY TRACKING --------------------------- */\n\nfunction getItemIdsCat() {\n var ids = [],\n $tiles = jQuery('.product-item'),\n i = 0,\n id = '';\n\n for (i; i < $tiles.length; i++) {\n id = $tiles.eq(i).attr('data-product-id') || '';\n\n if (!id || ids.indexOf(id) > -1) {\n continue;\n }\n\n ids[ids.length] = id;\n }\n\n return ids.join(',');\n}\n\n// ShadowRoot Category Tracking (Mobile - Zales only)\nfunction getItemIdsCatMobileShadowRoot(shadow) {\n var ids = [],\n $tiles = jQuery(shadow).find('#product-list').find('.product'),\n i = 0,\n id = '';\n\n for (i; i < $tiles.length; i++) {\n id = $tiles.eq(i).attr('data-code') || '';\n\n if (!id || ids.indexOf(id) > -1) {\n continue;\n }\n\n ids[ids.length] = id;\n }\n\n return ids.join(',');\n}\n\nfunction getCategoryObject() {\n var shadow = getShadow(),\n itemIds = isShadowSite(shadow) ? getItemIdsCatMobileShadowRoot(shadow) : getItemIdsCat();\n return {\n 'page:url': getUrl(),\n 'items:ids': itemIds\n };\n}\n\n\nfunction initializeCategoryEvents() {\n var categoryObj;\n\n bouncex.et.onTrue(\n function () {\n categoryObj = getCategoryObject();\n return !!categoryObj['items:ids'].length &&\n !!categoryObj['page:url'];\n },\n function () {\n bouncex.push(['view category', categoryObj]);\n },\n 10\n );\n\n\n}\n\n/* ------------------------------- CART EVENTS ------------------------------ */\nfunction initializeATCListeners() {\n if (isShadowSite(getShadow())) {\n addATCListenerMobile();\n } else {\n addATCListener();\n }\n\n}\n\n\nfunction fireAddToCart(replenItem) {\n if (bouncex.vars.last_fired_id) {\n bouncex.push([\n 'add to cart',\n {\n 'item:id': bouncex.vars.last_fired_id,\n 'cart:item': bouncex.stringify(replenItem)\n }\n ]);\n setVarAndCookie('cart', true);\n }\n}\n\nfunction addATCListener() {\n bouncex.off(jQuery(document), 'ajaxComplete.bx');\n bouncex.et.on(jQuery(document), 'ajaxComplete.bx', function (e, xhr, settings) {\n if (\n settings.url.indexOf('/cart/add') > -1\n && !bouncex.utils.url.getParam('bx_cart')\n ) {\n var replenItem = {\n 'qty': bouncex.utils.getParam('qty', settings.data),\n 'productCodePost': bouncex.utils.getParam('productCodePost', settings.data),\n 'plan_pcode': bouncex.utils.getParam('plan_pcode', settings.data),\n 'plandesc': bouncex.utils.getParam('plandesc', settings.data),\n 'planprice': bouncex.utils.getParam('planprice', settings.data),\n 'CSRFToken': bouncex.utils.getParam('CSRFToken', settings.data)\n };\n\n if (!replenItem.qty || !replenItem.productCodePost || !replenItem.CSRFToken) {\n return;\n }\n\n fireAddToCart(replenItem);\n }\n\n });\n}\n\n// ShadowRoot Cart Tracking (Mobile - Zales only)\nfunction fireItemShadowRootMobile() {\n var shadow = getShadow(),\n cartForm = jQuery(shadow).find('#cart-form-list'),\n replenItem = {\n 'qty': cartForm.find('[name=\"qty\"]').attr('value'),\n 'wompAddCart': cartForm.find('[name=\"wompAddCart\"]').attr('value'),\n 'plan_pcode': cartForm.find('[name=\"plan_pcode\"]').attr('value'),\n 'plandesc': cartForm.find('[name=\"plandesc\"]').attr('value'),\n 'planprice': cartForm.find('[name=\"planprice\"]').attr('value'),\n 'productCodePost': cartForm.find('[name=\"productCodePost\"]').attr('value')\n };\n\n if (!replenItem.productCodePost) {\n return;\n }\n fireAddToCart(replenItem);\n}\n\nfunction addATCListenerMobile() {\n bouncex.et.onVarChange('cart_qty', function (oldVal, newVal) {\n if (newVal > oldVal) {\n fireItemShadowRootMobile();\n }\n\n\n });\n\n}\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 setVarAndCookie('cart', false);\n }\n\n\n });\n\n\n}\n\nfunction initializeCartEvents() {\n bouncex.et.cart.init({\n replenishmentType: 'ajax',\n replenish: function (cart) {\n var $deferreds = [];\n\n cart.items.forEach(function (item) {\n $deferreds.push(makeAjaxATCFunc(item));\n });\n\n $deferreds\n .reduce(\n function (promise, func) {\n return promise.then(function () {\n return func();\n });\n },\n jQuery.Deferred().resolve([])\n )\n .then(replenComplete);\n\n\n }\n });\n\n function makeAjaxATCFunc(replenItem) {\n return function () {\n return jQuery.ajax({\n type: 'POST',\n url: 'https://' + config.domain_origin + '/cart/add',\n data: bouncex.utils.url.generateQuerystring(replenItem)\n });\n };\n }\n\n function replenComplete() {\n window.location.href = window.location.origin +\n window.location.pathname +\n '?bx_replen=true';\n\n\n }\n\n emptyCart();\n\n\n}\n\n/* ------------------------------ USER TRACKING ----------------------------- */\n\nfunction fireUserEvent(email, source) {\n if (email && source) {\n bouncex.push([\n 'user',\n {\n 'email': email,\n 'source': source\n }\n ]);\n }\n}\n\nfunction initializeUserTracking() {\n if (!bouncex.vars.logged_in || !!bouncex.vars.logged_in_identified) {\n return;\n }\n\n var userEmail;\n\n bouncex.et.onTrue(\n function () {\n userEmail = bouncex.utils.getNestedProp('window.dataLayer.user.dl_Email', '').split('_').pop();\n return bouncex.utils.validate.email(userEmail);\n },\n function () {\n fireUserEvent(userEmail, 'LoggedIn');\n bouncex.setVar('logged_in_identified', true);\n },\n 5\n );\n}\n\nfunction initializeAttentiveTracking() {\n if (bouncex.vars.attentive_identified) {\n return;\n }\n\n var userEmail;\n\n bouncex.et.onVarChange('attn_email_avail', function (oldVal, newVal) {\n if (newVal) {\n bouncex.et.onTrue(\n function () {\n userEmail = bouncex.parseJSON(bouncex.utils.getNestedProp('localStorage._attn_', {})).email;\n return bouncex.utils.validate.email(userEmail);\n },\n function () {\n fireUserEvent(userEmail, 'Attentive');\n bouncex.setVar('attentive_identified', true);\n },\n 5\n );\n }\n });\n}\n\n/* --------------------------- INITIALIZE TRACKING -------------------------- */\n\n// we do not want to track uat sites\nfunction isValidDomain() {\n return getUrl().indexOf(config.domain_origin) > -1 && !window.location.host.match(/uat[0-9]/g);\n}\n\nfunction isValidForTracking() {\n var validDomain = isValidDomain(),\n english = isShadowSite(getShadow()) ? true : isEn();\n return validDomain && english;\n}\n\nfunction isEn() {\n return jQuery('html').attr('lang') === 'en';\n}\n\nfunction init() {\n if (!isValidForTracking()) {\n return;\n }\n\n initializeUserTracking();\n initializeCartEvents();\n initializeAttentiveTracking();\n\n switch (bouncex.website.pts) {\n case 'product':\n initializeItemEvents();\n bouncex.setTimeout2(initializeATCListeners, 2000);\n break;\n case 'category':\n case 'search':\n initializeCategoryEvents();\n break;\n default:\n setLastFiredItemMetadata({ id: '', copy: '' });\n break;\n }\n\n\n}\n\ninit();\n","dge":true,"bxidLoadFirst":false,"pie":true,"cme":true,"gbi_enabled":0,"bpush":false,"pt":{"cart":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('.template-pages-CartPageTemplate.pageLabel-cart').length > 0;"},{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/cart"}],[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"zales.com/"}]]},"category":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/c/"}],[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"zales.com/"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"personalized"}]]},"checkout":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/checkout/"}],[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"zales.com/"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"document.querySelectorAll('[rel=\"canonical\"][href=\"https://www.zales.com\"]').length > 0;"}]]},"product":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/p/"}],[{"activation":"current_page_url","prop":"not_contains","prop2":"","prop3":"","val":"/customize"}],[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"zales.com/"}]]},"search":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/search?"}],[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"zales.com/"}]]}},"els":{"blank_site_element":""},"vars":[{"name":"logged_in","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"(function () {\n\tvar email = bouncex.utils.getNestedProp('dataLayer.user.dl_Email', 'anonymous');\n\t\n\tif (email === '') return null\n\n\treturn email !== 'anonymous'\n})();","trigger":""},{"name":"ever_logged_in","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.logged_in || null;","trigger":""},{"name":"cart_qty","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function() {\n var qty = jQuery('.shopping-cart-total:first').text()\n return qty.length ? Number(qty) : null;\n})()","trigger":""},{"name":"cart_value","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function(){\n if(bouncex.website.pts === 'cart') {\n return Number(jQuery('.cart-totals-body .est-subtotal, .mini-cart-totals .value').text().replace(/[^0-9.]/g,''));\n }\n if(jQuery('#shoppingBag').attr('aria-label') && jQuery('#shoppingBag').attr('aria-label').indexOf('0 items') > -1) {\n return 0;\n }\n if(jQuery('.mini-cart-totals .value').length) {\n return Number(jQuery('.mini-cart-totals .value').text().replace(/[^0-9.]/g,''));\n }\n return null;\n})()","trigger":""},{"name":"submitted_onsite","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(function() {\n var postMsg = jQuery('.join-list .join-header-text').text();\n return postMsg.indexOf('Thank you') > -1 || postMsg.indexOf('subscribed') > -1 || null;\n})()","trigger":""},{"name":"page_url","polling":"none","persist":"no","page_types":["category","search"],"testmode":true,"default":"false","code":"","trigger":""},{"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":"cart","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"cookie_modal_present","polling":"all","persist":"no","page_types":[],"testmode":true,"default":"false","code":"null;","trigger":"pageload"},{"name":"page_type","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.website.pts;","trigger":"pageload"},{"name":"logged_in_identified","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"last_fired_id","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"last_fired_copy","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"attentive_identified","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"attn_email_avail","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"!!bouncex.parseJSON(bouncex.utils.getNestedProp('localStorage._attn_', {})).email;","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":{"bxid":"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":"","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":["AW","AI","AG","AR","BS","BB","BZ","BM","BO","BQ","BR","CA","KY","CL","CO","CR","CU","CW","DM","DO","EC","SV","GF","GL","GD","GT","GP","HT","HN","JM","MQ","MX","MS","NI","PA","PY","PE","PR","PM","MF","BL","KN","LC","VC","SX","SR","TT","US","UM","UY","VE","VG","VI"],"fme":true,"fmx":"#recipientEmail","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); var deviceGraphScript = document.createElement('script'); deviceGraphScript.setAttribute('src', '//assets.bounceexchange.com/assets/smart-tag/versioned/cjs_min_3a843477d8e318f67237a66d0a58c542.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() {}; }; document.body.appendChild(runtime); } } if (document.readyState === "loading") { document.addEventListener("DOMContentLoaded", bxBootstrap); } else { bxBootstrap(); }})();