(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":2761,"name":"ThirdLove","cookie_name":"bounceClientVisit2761","domain":"thirdlove.com","ct":"fp_local_storage","ally":0,"ei":0,"tcjs":"","cjs":"/* what is used to set the current_bra_size variable */\nvar currentBraSize;\nif(localStorage.bxCurrentBraSizeObj && JSON.parse(localStorage.bxCurrentBraSizeObj)){\n currentBraSize = JSON.parse(localStorage.bxCurrentBraSizeObj); \n var modCupSize;\n \n currentBraSize.cup.indexOf('(') > -1 ? modCupSize = currentBraSize.cup.split('(')[0].trim() : modCupSize = currentBraSize.cup;\n \n var urlUpdateDesktop = setInterval(function(){\n if(window.location.href.indexOf('bra_brand_and_size_questions') > -1){\n clearInterval(urlUpdateDesktop);\n jQuery('input[name=\"favorite_bra_band_size_'+currentBraSize.band+'\"]').click();\n jQuery('input[name=\"favorite_bra_cup_size_'+modCupSize+'\"]').click(); \n } \n }, 1000);\n \n var urlUpdateMobile = setInterval(function(){\n if(window.location.href.indexOf('bra_size_band_question') > -1){\n jQuery('input[name=\"favorite_bra_band_size_'+currentBraSize.band+'\"]').click();\n } \n \n if(window.location.href.indexOf('bra_size_cup_question') > -1){\n clearInterval(urlUpdateMobile);\n jQuery('input[name=\"favorite_bra_cup_size_'+modCupSize+'\"]').click(); \n }\n }, 1000);\n}else{\n currentBraSize = {\n 'band': '',\n 'cup': ''\n }; \n \n jQuery(document.body).on('click', 'input[data-label*=\"favorite_bra_band_size\"]', function(){\n var band_size = jQuery(this).val();\n currentBraSize.band = band_size;\n \twindow.localStorage.setItem('bxCurrentBraSizeObj', bouncex.stringify(currentBraSize));\n });\n \n \n jQuery(document.body).on('click', 'input[data-label*=\"favorite_bra_cup_size\"]', function(){\n var cup_size = jQuery(this).val();\n currentBraSize.cup = jQuery(this).val();\n \twindow.localStorage.setItem('bxCurrentBraSizeObj', bouncex.stringify(currentBraSize));\n });\n}\n\n\nbouncex.loyaltyTierDiscount = {\n 'Admirer' : {\n 2 : '15',\n 3 : '25',\n 4 : '40'\n },\n 'Enthusiast' : {\n 2 : '15',\n 3 : '25',\n 4 : '40'\n },\n 'Devotee' : {\n 2 : '15',\n 3 : '30',\n 4 : '50'\n }\n};\n\n\n/* MW: add to GA function: https://www.wrike.com/open.htm?id=211010240, https://www.wrike.com/open.htm?id=239968622 */\nvar original_ga = bouncex.report_ga;\nbouncex.report_ga = function(action, label, bypass) {\n original_ga(action, label, bypass);\n \n var label1 = label.split(':')[0];\n var label2 = label.split(':')[1];\n var purpose = (label1 && label1.split('-')[0] && label1.split('-')[0].trim()) || '';\n var parName = (label1 && label1.split('-')[2] && label1.split('-')[2].trim()) || '';\n var varName = (label2 && label2.split('-')[2] && label2.split('-')[2].trim()) || '';\n \n var event = \"bouncex_\" + action;\n \n if (window.heap && typeof heap.track === 'function') {\n heap.track(event, {\n campaign_name: parName, // parent name\n type: purpose, // purpose\n message: varName // variation name\n });\n }\n};\n\n\n/* store email in session storage https://www.wrike.com/open.htm?id=222212638 */\nbouncex.infoStore = {\n\tsessionStorageIdentifier: 'bxInfoStore',\n\tset: function(data) {\n\t var hashedData = bouncex.lz.compressToURI(JSON.stringify(data));\n\t try {\n\t\tsessionStorage.setItem(this.sessionStorageIdentifier, hashedData);\n\t } catch(e) {\n\t\tbouncex.err('session storage failure');\n\t }\n\t},\n\tget: function() {\n\t var email = sessionStorage.getItem(this.sessionStorageIdentifier);\n\t\t return email ? JSON.parse(bouncex.lz.decompressFromURI(email)) : '';\n\t},\n\tinfoIsStored: function() {\n\t return !!sessionStorage.getItem(this.sessionStorageIdentifier);\n\t},\n\tpopulateFields: function(fields) {\n\t if (!this.infoIsStored()) return;\n\t \n\t var data = this.get();\n\t for (var field in fields) {\n\t\tif (fields.hasOwnProperty(field)) {\n\t\t fields[field].val(data[field]);\n\t\t}\n\t }\n\t}\n };\n \nbouncex.on(bouncex.window, 'bxVarsChange', function(event, resp) {\n var rtv_change = resp.filter(function(rtv){ return rtv.name === \"pdp_modal_visible\"; });\n if (rtv_change.length) {\n window.bouncex.bxISR.init();\n }\n});\n \n \nwindow.bouncex.triggerReactEventAndSubmit = function(eventName, inputSelector, submitSelector) {\n var element = document.querySelector(inputSelector);\n var tracker = element._valueTracker;\n var $submitButton = jQuery(submitSelector);\n var newEvent;\n\n if (typeof Event === 'function') {\n newEvent = new Event(eventName, { bubbles: true});\n } else {\n // IE doesn't use event constructor\n newEvent = document.createEvent('Event');\n newEvent.initEvent(eventName, true, true);\n }\n\n if (tracker) {\n try {\n tracker.setValue('');\n element.dispatchEvent(newEvent);\n setTimeout(function() {\n $submitButton.click();\n }, 1000);\n } catch(e) {\n bouncex.err(e);\n }\n }\n};\n\n\n /*START ISR AK:https://www.wrike.com/open.htm?id=255213500*/ \n (function () {\n window.bouncex = window.bouncex || {};\n\n window.bouncex.bxISR = {\n /* --- INITIALIZATION --- */\n version: 'Version 8.2 | 10/25/17',\n startTime: Date.now(),\n settings: {\n currentProduct: {},\n general: {\n pdpIdentifier: bouncex.vars.pdp_modal_visible,\n productPageIdentifier: (bouncex.vars.pagetype === 'product' || jQuery('.QuickView-QuickView__qv-modal__interior:visible').length > 0) && jQuery('.message-page:contains(\"find the page\")').length === 0,\n categoryPageIdentifier: bouncex.vars.pagetype === 'category',\n maxProducts: 20,\n categoryHistory: JSON.parse(window.localStorage.getItem('bxCatHist')) || [],\n productHistory: JSON.parse(window.localStorage.getItem('bxProdHist')) || [],\n categoryHistoryLength: 0,\n productHistoryLength: 0\n }\n },\n\n init: function () {\n if(this.settings.general.productPageIdentifier && !bouncex.vars.pdp_modal_visible){\n this.productMap();\n this.setItemHistoryLengths();\n this.trackProductHistory(\"product\", \"bxProdHist\");\n this.maxProducts();\n if (jQuery('#bx-isr-boilerplate').length === 0) {\n bouncex.addCss('.bxc.bx-custom .bx-isr-preventclicks { pointer-events: none; cursor: pointer;}', bouncex.body.get(0), 'bx-isr-boilerplate');\n }\n \n \n }else if(this.settings.general.categoryPageIdentifier){\n var thisIsr = this;\n jQuery('.Collection-ProductTile__quick-view-button, .tl-quick-view').off('click.bx-click');\n jQuery('.Collection-ProductTile__quick-view-button, .tl-quick-view').on('click.bx-click',function(){\n setTimeout(function(){\n thisIsr.quickViewProductMap();\n thisIsr.setItemHistoryLengths();\n thisIsr.trackProductHistory(\"product\", \"bxProdHist\");\n thisIsr.maxProducts(); \n if (jQuery('#bx-isr-boilerplate').length === 0) {\n bouncex.addCss('.bxc.bx-custom .bx-isr-preventclicks { pointer-events: none; cursor: pointer;}', bouncex.body.get(0), 'bx-isr-boilerplate');\n } \n },1500);\n\n });\n } else if (bouncex.vars.pdp_modal_visible) {\n var modalShowing = setInterval2(function(){\n if (jQuery('.QuickView-Header__qv-header__title').text().trim().length > 0) {\n clearInterval(modalShowing);\n window.bouncex.bxISR.quickViewProductMap();\n window.bouncex.bxISR.setItemHistoryLengths();\n window.bouncex.bxISR.trackProductHistory(\"product\", \"bxProdHist\");\n window.bouncex.bxISR.maxProducts();\n if (jQuery('#bx-isr-boilerplate').length === 0) {\n bouncex.addCss('.bxc.bx-custom .bx-isr-preventclicks { pointer-events: none; cursor: pointer;}', bouncex.body.get(0), 'bx-isr-boilerplate');\n }\n }\n }, 500);\n }\n },\n\n productMap: function () {\n if (!this.settings.general.productPageIdentifier) { return; }\n \n var productValues; \n \n if (bouncex.vars.pdp_modal_visible) {\n productValues = {\n url: window.location.origin + jQuery('.QuickView-Meta__qv__view-more').attr('href'),\n name: jQuery('.QuickView-Header__qv-header__title').text().trim(),\n mainImgUrl: bouncex.vars.imageurl,\n timeStamp: Date.now(),\n viewCount: 1,\n sessionId: window.bouncex.cookie.vid\n };\n } else {\n productValues = {\n url: bouncex.utils.url.allowParams() || window.location.origin + jQuery('.QuickView-Meta__qv__view-more').attr('href'),\n name: bouncex.vars.prod_name || jQuery('.QuickView-Header__qv-header__title').text().trim(),\n mainImgUrl: bouncex.vars.imageurl,\n timeStamp: Date.now(),\n viewCount: 1,\n sessionId: window.bouncex.cookie.vid\n };\n }\n\n this.settings.currentProduct = productValues;\n },\n \n quickViewProductMap: function(){\n var productValues = {\n url: window.location.origin + jQuery('.QuickView-Meta__qv__view-more').attr('href'),\n name: jQuery('.QuickView-Header__qv-header__title').text().trim(),\n mainImgUrl: 'https:' +jQuery('.QuickView-Images__qv-images img').attr('src'),\n timeStamp: Date.now(),\n viewCount: 1,\n sessionId: window.bouncex.cookie.vid\n };\n\n this.settings.currentProduct = productValues;\n },\n\n /* --- END OF INITIALIZATION --- */\n /* --- HELPER FUNCTIONS --- */\n\n addProductToHistory: function (product) {\n var productHistory = this.settings.general.productHistory;\n productHistory.unshift(product);\n this.setProductHistory(productHistory);\n },\n\n addCategoryToHistory: function (currentCategory) {\n var categoryHistory = this.settings.general.categoryHistory;\n var newCategory = {\n category: currentCategory,\n viewCount: 1,\n timeStamp: Date.now()\n };\n\n categoryHistory.unshift(newCategory);\n window.bouncex.bxISR.setCategoryHistory(categoryHistory);\n },\n\n compareProducts: function (productA, productB) {\n if (productA.mainImgUrl === productB.mainImgUrl) { return true; }\n if (productA.name === productB.name) { return true; }\n if (productA.url === productB.url) { return true; }\n return false;\n },\n\n trackProductHistory: function (type,ls) {\n var productHistory = this.settings.general[type + 'History'];\n if (this.settings.general[type + 'HistoryLength'] > 0) {\n var historyUpdated = false;\n \n for (var i = 0; i < this.settings.general[type + 'HistoryLength']; i++) {\n if (this.compareProducts(productHistory[i], this.settings.currentProduct)) {\n productHistory[i].viewCount++;\n productHistory[i].timeStamp = Date.now();\n productHistory.unshift(productHistory[i]);\n \n productHistory.splice(i + 1, 1);\n historyUpdated = true;\n this.setProductHistory(productHistory,type,ls);\n return;\n }\n }\n \n if (!historyUpdated) {\n this.addProductToHistory(this.settings.currentProduct,type,ls);\n }\n } else {\n this.addProductToHistory(this.settings.currentProduct,type,ls);\n }\n },\n\n trackCategoryHistory: function () {\n var categoryHistory = this.settings.general.categoryHistory;\n if (!this.settings.general.productPageIdentifier) { return; }\n\n var currentCategoriesLength = this.settings.currentProduct.category.length;\n for (var i = 0; i < currentCategoriesLength; i++) {\n var currentCategory = this.settings.currentProduct.category[i];\n\n if (this.settings.general.categoryHistoryLength > 0) {\n var historyUpdated = false;\n for (var j = 0; j < this.settings.general.categoryHistoryLength; j++) {\n if (categoryHistory[j].category.categoryName === currentCategory.categoryName) {\n categoryHistory[j].viewCount++;\n categoryHistory[j].timeStamp = Date.now();\n historyUpdated = true;\n this.setCategoryHistory(categoryHistory);\n }\n }\n\n if (!historyUpdated) {\n this.addCategoryToHistory(currentCategory);\n }\n } else {\n this.addCategoryToHistory(currentCategory);\n }\n }\n },\n\n /* --- END OF HELPER FUNCTIONS --- */\n /* --- GETTER FUNCTIONS --- */\n\n getTopCategories: function (criteria, number) {\n var categories = this.settings.general.categoryHistory;\n if (!number) { number = categories.length; }\n\n if (criteria === 'views') {\n return categories.sort(function (a, b) { return b.viewCount - a.viewCount; }).slice(0, number);\n } else if (criteria === 'time') {\n return categories.sort(function (a, b) { return b.timeStamp - a.timeStamp; }).slice(0, number);\n } else if (criteria === 'recency') {\n return categories.sort(function (a, b) { return b.viewCount - a.viewCount; }).slice(0, number).sort(function (c, d) { return d.timeStamp - c.timeStamp; });\n }\n },\n\n getTopProducts: function (criteria, number) {\n var products = this.settings.general.productHistory;\n if (!number) { number = products.length; }\n if (criteria === 'views') {\n return products.sort(function (a, b) { return b.viewCount - a.viewCount; }).slice(0, number);\n } else if (criteria === 'time') {\n return products.sort(function (a, b) { return b.timeStamp - a.timeStamp; }).slice(0, number);\n } else if (criteria === 'recency') {\n return products.sort(function (a, b) { return b.viewCount - a.viewCount; }).slice(0, number).sort(function (c, d) { return d.timeStamp - c.timeStamp; });\n }\n },\n\n maxProducts: function () {\n var maxProducts = this.settings.general.maxProducts;\n if (this.settings.general.productHistoryLength > maxProducts) {\n var topProducts = this.getTopProducts('time', maxProducts);\n this.setProductHistory(topProducts);\n }\n },\n\n /* --- END GETTER FUNCTIONS --- */\n /* --- SETTER FUNCTIONS --- */\n\n setItemHistoryLengths: function () {\n this.settings.general.categoryHistoryLength = this.settings.general.categoryHistory.length;\n this.settings.general.productHistoryLength = this.settings.general.productHistory.length;\n },\n\n setProductHistory: function (productHistory) {\n window.localStorage.setItem('bxProdHist', JSON.stringify(productHistory));\n this.settings.general.productHistory = productHistory;\n this.settings.general.productHistoryLength = productHistory.length;\n },\n\n setCategoryHistory: function (categoryHistory) {\n window.localStorage.setItem('bxCatHist', JSON.stringify(categoryHistory));\n this.settings.general.categoryHistory = categoryHistory;\n this.settings.general.categoryHistoryLength = categoryHistory.length;\n },\n\n /* --- END SETTER FUNCTIONS --- */\n /* --- CAMPAIGN TEMPLATING --- */\n populateCampaignProductsV2: function (params) {\n if (!params || !params.campaignId || !params.numberProducts) { return false; }\n if (!params.sortBy) { params.sortBy = 'time'; }\n if (!params.productAction) { params.productAction = 'link'; }\n if (!params.linkAction) { params.linkAction = 'new'; }\n\n var campaign = jQuery('#bx-campaign-' + params.campaignId);\n var campaignProductArray = [];\n\n campaignProductElements = {};\n jQuery.each(params.campaignSteps, function (x, y) {\n\n campaignStepProductElements = [];\n for ( var i = 0; i < params.numberProducts; i++ ) {\n var campaignStepProductObject = {};\n if (y.productImages) {\n campaignStepProductObject.img = campaign.find('#bx-form-' + params.campaignId + '-step-' + y.stepNumber + ' .bx-row-line-custom .bx-lineshape:eq(' + i +')');\n }\n if (y.productLinkElems) {\n campaignStepProductObject.link = campaign.find('#bx-form-' + params.campaignId + '-step-' + y.stepNumber + ' .bx-group .bx-row-submit:eq('+i+')').find('button');\n }\n if (y.productHoverStates) {\n campaignStepProductObject.hoverTitle = campaign.find('#bx-form-' + params.campaignId + '-step-' + y.stepNumber + ' .bx-group .bx-row-line-custom:eq(' + i +')').siblings('.bx-row-text').find('div');\n }\n campaignStepProductElements.push(campaignStepProductObject);\n }\n\n campaignProductElements['step-' +x] = campaignStepProductElements;\n });\n\n var productArray = window.bouncex.bxISR.getTopProducts(params.sortBy, params.numberProducts);\n\n var self = this;\n jQuery.each(campaignProductElements, function (x, y) {\n var productAction = function () {};\n\n for ( var i = 0; i < y.length; i++ ) {\n if (params.campaignSteps[(x.split('-')[1])].productsLink) {\n var productLink = (productArray[i].url.indexOf('http') > -1) ? productArray[i].url : window.top.location.origin + productArray[i].url;\n productAction = self.makeProductAction(productLink, params);\n }\n\n if (y[i].img) {\n var imgSrc = productArray[i].mainImgUrl,\n productImageElem = jQuery(y[i].img);\n\n productImageElem.css('background-image', 'url(' + imgSrc + ')').addClass('isr-image isr' + x + '').bind('click.bx_' + params.campaignId + '_isr_' + i, productAction);\n }\n\n if (y[i].link) {\n var productLink = (productArray[i].url.indexOf('http') > -1) ? productArray[i].url : window.top.location.origin + productArray[i].url,\n productLinkElem = jQuery(y[i].link);\n\n productLinkElem.attr('bx-href', productLink).bind('click.bx_' + params.campaignId + '_isr_' + i, productAction);\n }\n\n if (y[i].hoverTitle) {\n var productTitle = productArray[i].name,\n productHoverTitleElem = jQuery(y[i].hoverTitle);\n\n productHoverTitleElem.text(productTitle).bind('click.bx_' + params.campaignId + '_isr_' + i, productAction);\n }\n }\n\n });\n },\n\n makeProductAction: function (productLink, campaignParams) {\n var productAction = function () {};\n\n if (campaignParams.productAction === 'link') {\n if (campaignParams.linkAction === 'new') {\n if (campaignParams.reportClicks) {\n productAction = function () {\n window.bouncex.report(campaignParams.campaignId, 'click');\n window.top.open(productLink);\n };\n } else {\n productAction = function () {\n window.top.open(productLink);\n };\n }\n } else if (campaignParams.linkAction === 'current') {\n if (campaignParams.reportClicks) {\n productAction = function () {\n window.bouncex.report(campaignParams.campaignId, 'click');\n setTimeout(function() {\n window.top.location.replace(productLink);\n }, 100);\n };\n } else {\n productAction = function () {\n window.top.location.replace(productLink);\n };\n }\n }\n }\n\n return productAction;\n }\n };\n\n window.bouncex.bxISR.init();\n})(); \n/*END ISR AK:https://www.wrike.com/open.htm?id=255213500*/","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":"/en-ca/"}],"ple":false,"fbe":true,"mas":2,"map":1,"gar":true,"ete":1,"ettm":false,"etjs":"var ALLOWED_DOMAINS = ['www.thirdlove.com'],\n\tURL_TO_ID_REGEX = /\\/products\\/([0-9a-zA-z-]+)/,\n\tIN_STOCK_SELECTOR = 'meta[property=\"product:availability\"]',\n\tPAGE_TITLE_SELECTOR = 'meta[property=\"og:title\"]',\n\tITEM_IMAGE_SELECTOR = 'meta[property=\"og:image\"]',\n\tMETA_URL = 'meta[property=\"og:url\"]',\n\tITEM_CATEGORY_SELECTOR = 'ShopifyAnalytics.meta.product.type',\n\tGROUP_ID_SELECTOR = 'ShopifyAnalytics.meta.product.id',\n\tSKU_SELECTOR = 'input[name=\"id\"]',\n\tSIZE_SELECTOR = '.native-dropdown option:selected',\n\tNOTIFY_ME_FORM = '.bis-notification-form__content form',\n\tATC_BUTTON_SELECTOR = 'component-pdp-product-variants button.add-to-bag-btn, .product-block__form__btn-submit',\n\tQUICKVIEW_CONTAINER = '.quick-view__container',\n\tQUICKVIEW_CTA = '.quick-view__cta',\n\tCATEGORY_GRID_ITEM = 'div.product-tile',\n\tMOBILE_GRID_ITEM_LINK = 'a.product-tile__mobile-slider-link',\n\tDESKTOP_GRID_ITEM_LINK = 'a.product-tile__link',\n\tEMAIL_SELECTOR = 'window.theme.customer.email',\n\tEMPTY_CART_MESSAGE_SELECTOR = 'div.cart__empty, [data-tltrack=\"fc-empty-bag-link\"], .component-cart-body__cart-empty__title:visible',\n\tFIT_FINDER_ITEM_URL = '#gtm-page-category',\n\tFIT_FINDER_SIZE = 'span.css-o51con-SelectedColor',\n\tCOOKIE_NAME = 'cart';\n\n/** ****** helper functions *********/\nfunction isValidDomain() {\n\treturn ALLOWED_DOMAINS.indexOf(window.location.hostname) > -1;\n}\n\nfunction isEnglish() {\n\treturn jQuery('html').attr('lang') === 'en-US' || jQuery('html').attr('lang') === 'en';\n}\n\nfunction isGiftCard() {\n\treturn window.location.pathname.indexOf('gift-card') > -1;\n}\n\nfunction getPageUrl() {\n\treturn jQuery(META_URL).attr('content');\n}\n\nfunction getIdFromUrl(url) {\n\tif (typeof url !== 'string') {\n\t\treturn false;\n\t}\n\n\tvar idMatch = url.match(URL_TO_ID_REGEX);\n\n\treturn idMatch && idMatch[1] ? idMatch[1] : '';\n}\n\nfunction getPageTitle() {\n\treturn jQuery(PAGE_TITLE_SELECTOR).attr('content') || '';\n}\n\nfunction getPdpImage() {\n var url = getPageUrl();\n var imgUrl;\n if(url.indexOf('kit') > -1 || url.indexOf('set') > -1) {\n imgUrl = jQuery('meta[property=\"og:image\"]').first().attr('content') || '';\n } else {\n imgUrl = jQuery(ITEM_IMAGE_SELECTOR).first().attr('content') || '';\n }\n return imgUrl.indexOf('http') > -1 ? imgUrl : 'https:' + imgUrl;\n}\n\nfunction getPdpCategory(){\n var url = getPageUrl();\n if(url.indexOf('kit') > -1 || url.indexOf('set') > -1) {\n return 'kits';\n } else {\n return bouncex.utils.getNestedProp(ITEM_CATEGORY_SELECTOR).toLowerCase() || 'Global';\n }\n}\n\nfunction getGroupId() {\n\treturn bouncex.utils.getNestedProp(GROUP_ID_SELECTOR);\n}\n\nfunction getSku() {\n\tjQuery(SKU_SELECTOR).attr('value');\n}\n\nfunction isFitFinderResults() {\n\treturn window.location.href.indexOf('/fitting-room/results') > -1\n\t || window.location.href.indexOf('/fit-finder/results') > -1;\n}\n\nfunction getFitFinderId() {\n\treturn jQuery(FIT_FINDER_ITEM_URL).text();\n}\n\n/** ****** item tracking *********/\nfunction trackItem() {\n\tvar item,\n\t groupId;\n\n\tbouncex.et.onTrue(\n\t\tfunction() {\n\t\t\titem = buildItem();\n\t\t\treturn item.id && item.imageurl && item.copy;\n\t\t}, function() {\n\t\t groupId = getGroupId();\n\t\t\tbouncex.push(['item', item]);\n\t\t\tfireViewItem(item.id, groupId);\n\n\t\t\t/* bouncex.et.onVisible(ATC_BUTTON_SELECTOR, trackATC); */\n\t\t\tinitializeATCClickTracking(item.id);\n\t\t},\n\t50);\n}\n\nfunction buildItem() {\n\tvar url = getPageUrl();\n\n\treturn {\n\t\tid: getIdFromUrl(url),\n\t\tcopy: getPageTitle(),\n\t\tcategory: getPdpCategory(),\n\t\timageurl: getPdpImage(),\n\t\turl: url,\n\t\tinstock: jQuery(IN_STOCK_SELECTOR).attr('content') === 'instock'\n\t};\n}\n\nfunction fireViewItem(itemId, groupId){\n var data = {\n\t\t\t'item:id': itemId\n\t\t};\n\n if (groupId){\n\t\tdata['item:itemgroupid'] = groupId;\n\t}\n bouncex.push(['view item', data]);\n\n}\n\n/** ************* Fit Finder Tracking ***************/\nfunction trackFitFinder() {\n\tif(isFitFinderResults()){\n\t\tvar itemId = getFitFinderId();\n\n\t\tif(itemId){\n\t\t\tfireViewItem(itemId);\n\t\t\tbouncex.et.onVisible(ATC_BUTTON_SELECTOR, function(){\n\t\t\t\ttrackATC();\n\t\t\t});\n\t\t}\n\n\t\ttrackAltFitFinder();\n\t}\n}\n\nfunction trackAltFitFinder(){\n bouncex.et.on(jQuery(document), 'click.bx', function(){\n bouncex.setTimeout2(function(){\n var itemId = getFitFinderId();\n\n \t\tif(itemId){\n \t\t\tfireViewItem(itemId);\n \t\t}\n }, 1500);\n }, '.esx4b0b0');\n}\n\n/** ************* Category Tracking ***************/\n\nfunction getItemIdsCat() {\n var ids = [];\n\n jQuery('.product-item .product-img > a').each(function (i, e) {\n var prodUrl = jQuery(e).attr('href') || '',\n trimmedUrl = bouncex.utils.url.allowParams('', prodUrl),\n id = trimmedUrl.split('/').pop();\n\n if (id && ids.indexOf(id) < 0) {\n ids.push(id);\n }\n });\n\n return ids.join(',');\n}\n\nfunction trackCategory(){\n\tvar itemIds;\n\n\tbouncex.et.onTrue(\n\t\tfunction() {\n\t\t\titemIds = getItemIdsCat();\n\t\t\treturn itemIds && itemIds.length > 0;\n\t\t}, function() {\n\t\t\tbouncex.push(['view category', {\n\t\t\t\t'items:ids': itemIds,\n\t\t\t\t'page:title': getPageTitle(),\n\t\t\t\t'page:url': getPageUrl()\n\t\t\t}]);\n\t\t},\n\t50);\n}\n\n/** ************* Quickview Tracking ***************/\nfunction trackQuickview() {\n\tbouncex.et.onVisible(QUICKVIEW_CTA, function () {\n\t\tvar itemUrl = jQuery(QUICKVIEW_CTA).attr('href'),\n\t\t\titemId = getIdFromUrl(itemUrl);\n\n\t\tbouncex.push(['view item', {\n\t\t\t'item:id': itemId\n\t\t}]);\n\t\ttrackATC();\n\t});\n}\n\n/** ****** notify me tracking *********/\nfunction trackNotifyMe() {\n\tbouncex.et.onVisible(NOTIFY_ME_FORM, function () {\n\t\tbouncex.on(jQuery(NOTIFY_ME_FORM), 'submit.bx', function(){\n\t\t\tbouncex.push(['notifyMe', {\n\t\t\t\t'item:id': getIdFromUrl(window.location.href)\n\t\t\t}]);\n\t\t});\n\t});\n}\n\n/** ****** track add to cart *********/\nfunction detectBraItem(formattedSize){\n\treturn /\\d/.test(formattedSize) && !/\\X/.test(formattedSize);\n}\n\nfunction formatSize(size){\n\tvar regex = /[^\\x20-\\x7E]/g;\n\n\tif (regex.test(size)){\n\t\treturn size.replace(/[^\\x20-\\x7E]/g, '1/2');\n\t} else if (size.indexOf('.5') > -1){\n\t\treturn size.replace('.5', '1/2');\n\t}\n\n\treturn size;\n}\n\nfunction trackSize() {\n\tvar qvContainer, scope, sizeContainer, bandSize, cupSize, size, formattedSize;\n\n\tif (isFitFinderResults()) {\n\t\tsize = jQuery(FIT_FINDER_SIZE).text().trim();\n\t}\n\n\tif (!size) {\n\t\tqvContainer = jQuery(QUICKVIEW_CONTAINER);\n\t\tscope = qvContainer.is(':visible') ? qvContainer : jQuery(document);\n\t\tsizeContainer = scope.find(SIZE_SELECTOR);\n\t\tbandSize = sizeContainer.first().text().trim();\n\t\tcupSize = sizeContainer.last().text().trim();\n\t\tsize = bandSize + cupSize;\n\t}\n\n\tif (size){\n\t\tformattedSize = formatSize(size);\n\n\t\tif (detectBraItem(formattedSize)){\n\t\t\tbouncex.push(['customer size', {\n\t\t\t\t'customer_size': formattedSize\n\t\t\t}]);\n\t\t}\n\t}\n}\n\n/** ****** track add to cart *********/\nfunction trackATC() {\n\tbouncex.off(jQuery(ATC_BUTTON_SELECTOR), 'click.bx');\n\tbouncex.on(jQuery(ATC_BUTTON_SELECTOR), 'click.bx', function(){\n\t\tvar itemUrl, itemId;\n\n\t\tif(jQuery(QUICKVIEW_CONTAINER).is(':visible')){\n\t\t\titemUrl = jQuery(QUICKVIEW_CTA).attr('href');\n\t\t} else {\n\t\t\titemUrl = window.location.pathname;\n\t\t}\n\n\t\titemId = isFitFinderResults() ? getFitFinderId() : getIdFromUrl(itemUrl);\n\n\t\tfireATCEvent(itemId);\n\t\ttrackSize();\n\t});\n}\n\nfunction initializeATCClickTracking(itemId) {\n\tbouncex.et.on(bouncex.document, 'click.bxatc', function () {\n fireAddToCart(itemId);\n }, ATC_BUTTON_SELECTOR);\n}\n\nfunction fireAddToCart(itemId) {\n\tvar token;\n\n bouncex.et.onTrue(\n function () {\n token = bouncex.getBounceCookie(COOKIE_NAME);\n return token;\n },\n function () {\n bouncex.push([\n 'add to cart',\n {\n 'item:id': itemId,\n 'cart:token': token\n }\n ]);\n\n if (bouncex.vars.cart_set) {\n return;\n }\n\n bouncex.setVar('cart_set', true);\n },\n 10\n );\n}\n\nfunction fireATCEvent(itemId){\n\tvar cookie;\n\n\tif(itemId){\n\t\tbouncex.et.onTrue(function(){\n\t\t\tcookie = bouncex.getBounceCookie(COOKIE_NAME);\n\t\t\treturn cookie;\n\t\t}, function(){\n\t\t\tbouncex.push(['add to cart', {\n\t\t\t\t'item:id': itemId,\n\t\t\t\t'cart:token': cookie\n\t\t\t}]);\n\n\t\t\tif(!bouncex.vars.cart_set){\n\t\t\t\tbouncex.setVarAndReload('cart_set', true);\n\t\t\t}\n\t\t}, 50);\n\t}\n}\n\n/** ****** cart replen *********/\nfunction replenish(cart){\n\tbouncex.utils.cookies.create({\n\t\t'name': COOKIE_NAME,\n\t\t'value': cart.token\n\t});\n\n\twindow.location.href = window.location.pathname + '?bx_replen=true';\n}\n\n/** ************* Empty Cart Tracking ***************/\nfunction trackEmptyCart() {\n\tbouncex.et.onVisible(EMPTY_CART_MESSAGE_SELECTOR, function () {\n\t\tif (bouncex.vars.cart_set) {\n\t\t\tbouncex.push(['empty_cart', {}]);\n\t\t\tbouncex.setVarAndReload('cart_set', false);\n\t\t}\n\t});\n}\n\n/** ************* Initiate Cart Tracking ***************/\nfunction initCartTracking() {\n\tbouncex.et.cart.init({\n\t\treplenishmentType : 'cookie',\n\t\treplenish : replenish,\n\t});\n\ttrackEmptyCart();\n}\n\n/** ****** track logged in user *********/\nfunction trackLoggedInUser() {\n\tvar email;\n\n\tif(!bouncex.vars.logged_in_identified){\n\t\temail = bouncex.utils.getNestedProp(EMAIL_SELECTOR);\n\n\t\tif (bouncex.utils.validate.email(email)) {\n\t\t\tbouncex.push(['user', {\n\t\t\t\temail: email,\n\t\t\t\tsource: 'LoggedIn'\n\t\t\t}]);\n\t\t\tbouncex.setVarAndReload('logged_in_identified', true);\n\t\t}\n\t}\n}\n\n/** ****** itiniate tracking code *********/\nbouncex.setTimeout2(function(){\n\tif (isValidDomain() && isEnglish()) {\n\t\tinitCartTracking();\n\t\ttrackLoggedInUser();\n\t\ttrackQuickview();\n\t\ttrackFitFinder();\n\n\t\tif(!isGiftCard()){\n\t\t\tswitch (bouncex.website.pts) {\n\t\t\t\tcase 'product':\n\t\t\t\t\ttrackItem();\n\t\t\t\t\ttrackNotifyMe();\n\t\t\t\t\tbreak;\n\t\t\t\tcase 'category':\n\t\t\t\t\ttrackCategory();\n\t\t\t\t\tbreak;\n\t\t\t\tdefault:\n\t\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n}, 1000);\n","dge":true,"bxidLoadFirst":false,"pie":true,"cme":true,"gbi_enabled":0,"bpush":false,"pt":{"category":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/collections/"},{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname.indexOf('/pages/') > -1 && document.querySelectorAll('div.product-tile').length > 0;"}]]},"checkout":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname.indexOf('/checkouts/') > -1 || window.location.pathname.indexOf('/carts/') > -1;"}]]},"giftcard":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.href.indexOf('gift-card') > -1;"}]]},"home":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"window.location.pathname === '/';"}]]},"product":{"testmode":false,"val":[[{"activation":"js","prop":"","prop2":"","prop3":"","val":"/\\/products\\//.test(window.location.pathname);"}]]},"search":{"testmode":false,"val":[[{"activation":"current_page_url","prop":"contains","prop2":"","prop3":"","val":"/search?q="}]]}},"els":null,"vars":[{"name":"pagetype","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var p = '';\n if (window.location.href.indexOf('gift-card') > -1) {\n p = 'gift card';\n } else if (window.location.pathname.indexOf('/products/') > -1) {\n p = 'product';\n } else if (window.location.pathname.indexOf('/collections/') > -1) {\n p = 'category';\n } else if (window.location.href.indexOf('/search?q=') > -1 && jQuery('.collection-grid__item').length > 0) {\n p = 'search';\n } else if (window.location.pathname === '/') {\n p = 'home';\n } else if (window.location.pathname.indexOf('/checkouts/') > -1 || window.location.pathname.indexOf('/carts/') > -1) {\n p = 'checkout';\n } else if (window.location.href.indexOf('try-before-buying') > -1 || window.location.href.indexOf('fit-finder') > -1) {\n p = 'fit finder';\n }\n return p;\n}());","trigger":""},{"name":"prod_name","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.pagetype == 'product' && jQuery('meta[property=\"og:title\"]').attr('content');","trigger":""},{"name":"imageurl","polling":"all","persist":"no","page_types":["product","giftcard"],"testmode":false,"default":"false","code":"jQuery('meta[property=\"og:image\"]').attr('content') || false;","trigger":""},{"name":"prod_price","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"Number(jQuery('.price, .product-block__price-box ins').first().text().replace(/[^0-9.]/g, ''));","trigger":""},{"name":"logged_in","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"!!bouncex.utils.getNestedProp('__st.cid', false);","trigger":""},{"name":"ever_logged_in","polling":"none","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"bouncex.vars.logged_in ? true : null;","trigger":""},{"name":"cart_qty","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function(){\n if (window.location.href.indexOf('/checkouts/') > -1) {\n var total = 0;\n jQuery('.product-thumbnail__quantity').each(function(){\n total += parseInt(jQuery(this).text());\n });\n return total;\n } else if (window.location.href !== 'https://www.thirdlove.com/pages/fit-finder#/' && window.location.href.indexOf('/checkouts/') === -1 ) {\n var cart_number = jQuery('.header-cart-badge').text();\n \n if (!cart_number){\n cart_number = jQuery('.e5q15e10').eq(0).text();\n }\n \n return parseInt(cart_number);\n\n }\n return null;\n}());","trigger":""},{"name":"cart_value","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"0","code":"(function() {\n return bouncex.website.pts === 'checkout' ? null : Number(jQuery('[class*=\"StyledPriceLine\"] [class*=\"StyledPriceTag\"], .js-cart-footer-total').eq(0).text().replace(/[^0-9.]/g, ''));\n})();","trigger":""},{"name":"in_stock","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('[data-add-to-bag-text=\"Add to Bag\"]').is(':visible');","trigger":""},{"name":"fit_finder","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(window.location.pathname.indexOf('fit-finder') > 0) ? (jQuery('[data-label*=\"Fit Finder results\"]').length > 0) : null;","trigger":""},{"name":"bra_size","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(window.location.pathname.indexOf('fit-finder') > 0) ? (jQuery('span[data-tl=\"rp-information-size\"]').text()) : null;","trigger":""},{"name":"current_bra_size","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"(function(){\n\tvar current_size = window.localStorage.getItem('bxCurrentBraSizeObj') ? JSON.parse(window.localStorage.getItem('bxCurrentBraSizeObj')) : [];\n\n\tif (current_size.band && current_size.cup){\n\t current_size = current_size.band + current_size.cup;\n\t}\n\t\n\treturn current_size ? current_size : null;\n})();","trigger":""},{"name":"cart","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"try_before_buying","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":""},{"name":"size_selected","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('.variant-selector__options-toggle').text().toLowerCase().indexOf('add size') === -1;","trigger":""},{"name":"url_hashtag","polling":"all","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function(){\n var hash = window.location.hash.replace('#/', '');\n if(hash.length > 0){\n return hash;\n }\n return false;\n})();","trigger":""},{"name":"submitted_onsite","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('.form-success-message__title').is(':visible') || null;","trigger":""},{"name":"user_identified","polling":"vars","persist":"no","page_types":[],"testmode":false,"default":"false","code":"!!(bouncex.cookie.uid || bouncex.getBounceCookie('__ibxu'));","trigger":"pageload"},{"name":"pdp_modal_visible","polling":"all","persist":"no","page_types":["product"],"testmode":false,"default":"false","code":"jQuery('.js-gallery-zoom-container').length > 0;","trigger":"pageload"},{"name":"bouncex_impression","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"false;","trigger":"pageload"},{"name":"cart_set","polling":"all","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"logged_in_identified","polling":"none","persist":"visit","page_types":[],"testmode":false,"default":"false","code":"null;","trigger":"pageload"},{"name":"taken_fittingroomquiz","polling":"all","persist":"permanent","page_types":[],"testmode":false,"default":"false","code":"jQuery('[data-label=\"Fitting Room results - Update Answers\"]').length > 0 || null;","trigger":"pageload"},{"name":"quiz_submitted_phone","polling":"none","persist":"no","page_types":[],"testmode":false,"default":"false","code":"(function() {\n if (window.location.href.indexOf('/fitting-room/results/') > -1) {\n return !!bouncex.utils.getNestedProp('__PRELOADED_STATE__.resultsPageData.metadata.phone', false) || jQuery('script:contains(\"SMS_subscribed\"), script:contains(\"SMS_Subscribed_pending\")').length > 0;\n }\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":1,"mibcx":1,"te":1,"cart_rep":{"get":"","set":""},"ulpj":{"bxid":"espemailid"},"cus":"","miw_exclude":"form.yotpo-referral-widget-form input.yotpo-email-input","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":true,"fmc":["US","CA"],"fme":true,"fmx":"form.yotpo-referral-widget-form input.yotpo-email-input","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":"250858362","ga4_measurement_id":"G-8054JYYDT0"} ; 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":"f6ef5f3573bdc7473184a65f6e98703e","creativesBaseStyles":"a53944a2","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_d49d982a8e116dabad949c3944ed85a3.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(); }})();