{"version":3,"names":[],"mappings":"","sources":["app.js"],"sourcesContent":["(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i 0) {\r\n\t\treturn \"Replenishment\"\r\n\t} else {\r\n\t\treturn \"Regular\"\r\n\t}\r\n\r\n}\r\n// Specific for Actimirror\r\nfunction getProductOrderType(replen) {\r\n\tif (replen > 0) {\r\n\t\treturn \"Replenishment\"\r\n\t} else {\r\n\t\treturn \"Regular\"\r\n\t}\r\n\r\n}\r\nfunction getProdListData(productJson){\r\n\tvar product={};\r\n\tproduct.id = productJson.masterID;\r\n\tproduct.category = productJson.catid ? productJson.catid : 'N/A';\r\n\tproduct.price = productJson.pricing ? (productJson.pricing.sale ? productJson.pricing.sale : productJson.pricing.minprice) : null;\r\n\tproduct.name = productJson.name;\r\n\tproduct.brand = productJson.brand;\r\n\tproduct.quantity = productJson.quantity;\r\n\tproduct.size = productJson.size;\r\n\tproduct.subCategory = productJson.subcategory ? productJson.subcategory : 'N/A';\r\n\tproduct.subSubCategory = productJson.subsubcategory ? productJson.subsubcategory : 'N/A';\r\n\tproduct.productAutoReplen = productJson.productautoreplenish;\r\n\tproduct.productOutOfStock = productJson.productOutOfStock;\r\n\tproduct.productColor = productJson.productColor;\r\n\tproduct.productType = \"Product\";\r\n\tproduct.productVariantID = productJson.ID;\r\n\tproduct.collectionName = productJson.customBrand;\r\n\tproduct.productNumReviews = productJson.productNumReviews,\r\n\tproduct.productStarRating = productJson.productStarRating,\r\n\tproduct.productOrderType = getProductOrederType();\r\n\treturn product;\r\n}\r\n\r\nfunction getGiaranQuadViewValues(){\r\n\tvar productIdArr = [];\r\n\tvar productColorArr = [];\r\n\tvar products=[];\r\n\t\r\n\tvar multiSplit = $('.multiView-screen.color-applied');\r\n\tmultiSplit.each(function () {\r\n\t\tvar multiViewData = JSON.parse($(this).find('.giaran-data').val());\r\n\t\tvar product = getProdListData(multiViewData);\r\n\t\tproducts.push(product);\r\n\t\tproductIdArr.push(product.productVariantID);\r\n\t\tproductColorArr.push(product.productColor);\r\n\t});\r\n\treturn {\r\n\t\t'productIdArr':productIdArr,\r\n\t\t'productColorArr':productColorArr,\r\n\t\t'products': products\r\n\t}\r\n}\r\n\r\nfunction getPageSubcategory() {\r\n\tswitch (window.Resources.PAGE_CATEGORY) {\r\n\tcase 'foundation-start':\r\n\t\treturn \"Makeup Consultation\"\r\n\t\tbreak;\r\n\tdefault :\r\n\t\treturn window.pageContext.title || \"Content\";\r\n\t\tbreak;\r\n\t}\t\t\r\n}\r\n\r\nfunction getNavLocation(navLocation) {\r\n\tvar navClass;\r\n\tif (($(navLocation).hasClass('sub-menu')) || ($(navLocation).hasClass('column')) || ($(navLocation).hasClass('alternate-categories')) || ($(navLocation).hasClass('level-1'))) {\r\n\t\tnavClass = 'top-navigation';\r\n\t} else if ($(navLocation).hasClass('mobile-courtesy-nav')) {\r\n\t\tnavClass = 'courtesy-nav';\r\n\t}\r\n\telse {\r\n\t\tnavClass = $(navLocation).attr('class');\r\n\t}\r\n\t\t\t\r\n\tswitch (navClass) {\r\n\tcase 'top-navigation':\r\n\t\treturn 'Top Menu'\r\n\t\tbreak;\r\n\tcase 'courtesy-nav':\r\n\t\treturn 'Courtesy Menu'\r\n\t\tbreak;\r\n\tcase 'tertiary-nav':\r\n\t\treturn 'Tertiary Menu'\r\n\t\tbreak;\r\n\tdefault:\r\n\t\tbreak;\t\r\n\t}\r\n}\r\n\r\nfunction getLanguage() {\r\n\tif (window.User.locale.indexOf(\"en\") >= 0) {\r\n\t\treturn \"English\";\r\n\t} else if (window.User.locale.indexOf(\"cn\") >= 0) {\r\n\t\treturn \"Chinese\";\r\n\t} else if (window.User.locale.indexOf(\"es\") >= 0) {\r\n\t\treturn \"Spanish\";\r\n\t} else {\r\n\t\treturn window.User.locale;\r\n\t}\r\n}\r\nfunction dtgetLanguage() {\r\n if (window.location.href.indexOf(\"zh.shiseido\") >= 0) {\r\n return \"Chinese\";\r\n } else if (window.location.href.indexOf(\"es.shiseido\") >= 0) {\r\n return \"Spanish\";\r\n } else {\r\n return \"English\";\r\n }\r\n}\r\nfunction getCountry() {\r\n\treturn \"US\";\r\n}\r\n\r\n// page-specific: Cart, Checkout\r\nfunction getPageError() {\r\n\tvar $errorMsg = $(\".error-form\");\r\n\tif ($errorMsg.length === 0) {\r\n\t\treturn \"\";\r\n\t}\r\n\r\n\treturn $errorMsg.html().trim();\r\n}\r\n\r\nfunction getActiveSortingRule() {\r\n\tvar httpParams = util.getQueryStringParams(window.location.href);\r\n\tvar sortParam = httpParams[\"srule\"];\r\n\r\n\tif (!sortParam) {\r\n\t\treturn null;\r\n\t}\r\n\r\n\treturn sortParam.split(\"-\").map(function (w) {\r\n\t\treturn w[0].toUpperCase() + w.substr(1);\r\n\t}).join(\" \");\r\n}\r\n\r\nfunction pushToDataLayer(o) {\r\n\twindow.dataLayer = window.dataLayer || [];\r\n\twindow.dataLayer.push(util.filterObj(o));\r\n\t//alert(JSON.stringify(util.filterObj(o)));\r\n}\r\n\r\nfunction isScrolledIntoView(elem) {\r\n\tvar docViewTop = $(window).scrollTop();\r\n\tvar docViewBottom = docViewTop + $(window).height() - 150;\r\n\tvar elemTop = $(elem).offset().top;\r\n\tvar result = [];\r\n\tresult.push(((elemTop <= docViewBottom) && (elemTop >= docViewTop)));\r\n\tif ((elemTop <= docViewBottom) && (elemTop >= docViewTop)) {\r\n\t\tresult.push($(elem).parent().attr('class'));\r\n\t}\r\n\treturn result;\r\n}\r\n\r\nfunction getCountry() {\r\n\treturn \"US\";\r\n}\r\n\r\nfunction getpage() {\r\n\tvar url = window.location.href;\r\n\tvar splittedurl = url.split(\"?\");\r\n\tvar page = splittedurl[0].split(\"/\");\r\n\treturn page[page.length - 1]\r\n}\r\n\r\nfunction getNextPage(href) {\r\n\tif(href === \"\"){\r\n\t\treturn \"\";\r\n\t}else{\r\n\t\tvar newUrl = new URL(href);\r\n\t\tvar pageURI = newUrl && newUrl.pathname ? newUrl.pathname : newUrl;\r\n\t\treturn pageURI;\r\n\t}\r\n}\r\n\r\n//page-specific: PLP\r\nfunction getRefinementsFromURL() {\r\n\tvar str = \"\";\r\n\tif (window.location.href.split(\"?\").length > 1) {\r\n\t\tvar urlparam;\r\n\t\tif (window.location.href.split(\"?\")[1].indexOf(\"&\") > -1) {\r\n\t\t\turlparam = window.location.href.split(\"?\")[1].split(\"&\");\r\n\t\t\tvar length = urlparam.length;\r\n\t\t\tvar prefnval, prefnkey, prefvval, prefvkey;\r\n\t\t\tfor (var i = 0; i < length; i++) {\r\n\t\t\t\tvar prefn = urlparam[i].indexOf(\"prefn\");\r\n\t\t\t\tif (prefn > -1) {\r\n\t\t\t\t\tprefnkey = urlparam[i].split(\"=\")[0];\r\n\t\t\t\t\tprefnval = urlparam[i].split(\"=\")[1];\r\n\t\t\t\t\tvar num = prefnkey.charAt(5);\r\n\t\t\t\t\tfor (var a = 0; a < length; a++) {\r\n\t\t\t\t\t\tvar prefv = urlparam[a].indexOf(\"prefv\");\r\n\t\t\t\t\t\tprefvkey = urlparam[a].split(\"=\")[0];\r\n\t\t\t\t\t\tif (prefvkey == \"prefv\" + num) {\r\n\t\t\t\t\t\t\tprefvval = urlparam[a].split(\"=\")[1];\r\n\t\t\t\t\t\t\tstr += \"[\" + prefnval + \":\" + prefvval + \"]\";\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\treturn str;\r\n}\r\n\r\nfunction getPromotionsArr() {\r\n\tvar promotionsArr = [];\r\n\tvar promoDisplayarr = $('.sticky-component .custom-message');\r\n\tpromoDisplayarr.each(function() {\r\n\t\tvar promotions = {};\r\n\t\tpromotions.position=$(this).attr('data-position') || '';\r\n\t\tpromotions.id=$(this).attr('data-id') || '';\r\n\t\tpromotions.creative= $(this).attr('data-creative') || '';\r\n\t\tpromotions.name=$(this).attr('data-name') || '';\r\n\t\tpromotionsArr.push(promotions);\r\n\t})\r\n\treturn promotionsArr;\r\n}\r\n\r\nfunction promotionView() {\r\n\tvar promoElement = $('.top-notification').length ? $('.top-notification') : $('.bottom-notification-message')\r\n\tvar result = promoElement.length ? isScrolledIntoView(promoElement) : '';\r\n\tif (result[0] && promotionViewed < 1) {\r\n\t\tpushToDataLayer({\t\r\n\t\t\t\"eeAction\": \"eePromoView\",\r\n\t\t\t\"event\" : \"eePromoView\",\r\n\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t'promotions': getPromotionsArr()\r\n\t\t})\r\n\t\tpromotionViewed=1;\r\n\t}\t\t\r\n}\r\n\r\nfunction trackConsultationEvent(data) {\r\n\tvar TOOL_TYPES = {\r\n\t\t\"skincareConsultation\": \"Skincare Consultation\"\r\n\t};\r\n\r\n\tpushToDataLayer({\r\n\t\t\"event\": data.event,\r\n\t\t\"pageCategory\": \"Consultation Tool\",\r\n\t\t\"consultationToolType\": TOOL_TYPES[data.toolname] || data.toolname,\r\n\t\t\"consultationQuestion\": data.question,\r\n\t\t\"consultationResponse\": data.answers\r\n\t});\r\n}\r\n\r\nfunction trackConsultationPageview(data) {\r\n\tpushToDataLayer({\r\n\t\t\"event\": \"consultationSteps\",\r\n\t\t\"pageCategory\": \"Consultation Tool\",\r\n\t\t\"consultationToolType\": data.toolname,\r\n\t\t\"consultationStep\": data.pagename\r\n\t});\r\n}\r\nfunction trackOnlineQuizPageview() {\r\n\tpushToDataLayer({\r\n\t\t\"userId\": userid,\r\n\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\"language\": getLanguage(),\r\n\t\t\"websiteCountry\": getCountry()\r\n\t});\r\n}\r\n\r\nfunction trackOnlineQuizResultPageview() {\r\n\tpushToDataLayer({\r\n\t\t\"eeAction\": \"eeListView\",\r\n\t\t\"event\" : \"eeListView\",\r\n\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\"language\": getLanguage(),\r\n\t\t\"websiteCountry\": getCountry(),\r\n\t\t'products': window.onlineQuizResultProdData // Defined in quizresultpage.isml\r\n\t});\r\n}\r\n\r\n\r\nfunction trackOnlineQuizEvent(data) {\r\n\tpushToDataLayer({\r\n\t\t\"event\": data.event,\r\n\t\t\"nextQuestionNumber\": data.nextQuestionNumber,\r\n\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\"language\": getLanguage(),\r\n\t\t\"websiteCountry\": getCountry()\r\n\t});\r\n}\r\n\r\nfunction trackInternalPromotionEvent(data) {\r\n\r\n\tvar promotionURL = data.pageName;\r\n\r\n\tpushToDataLayer({\r\n\t\t\"event\": \"eePromoClick\",\r\n\t\t\"pageSubCategory\": data.pageSubCategory,\r\n\t\t\"pageCategory\": data.pageCategory,\r\n\t\t'promotions': [{\r\n\t\t\t\"position\": data.position,\r\n\t\t\t\"id\": data.id,\r\n\t\t\t\"creative\": data.creative,\r\n\t\t\t\"name\": data.name\r\n\t\t}]\r\n\t}), (function () {\r\n\t\tsetTimeout(function () {\r\n\t\t\tif (promotionURL != undefined) {\r\n\t\t\t\tdocument.location = promotionURL;\r\n\t\t\t}\r\n\t\t}, 1000);\r\n\t})();\r\n}\r\n\r\nfunction trackInternalPromotionPageView(data) {\r\n\tpushToDataLayer({\r\n\t\t\"eeAction\": \"eePromoView\",\r\n\t\t\"event\": \"eePromoView\",\r\n\t\t\"pageSubCategory\": data.pageSubCategory,\r\n\t\t\"pageCategory\": data.pageCategory,\r\n\t\t'promotions': [{\r\n\t\t\t\"position\": data.position,\r\n\t\t\t\"id\": data.id,\r\n\t\t\t\"creative\": data.creative,\r\n\t\t\t\"name\": data.name\r\n\t\t}]\r\n\t});\r\n}\r\n\r\nfunction gtmCouponApplied(data) {\r\n\t// fire when coupon is added after page load.\r\n if($(\".gtpromochecker\").length > 0 && $(\".order-promotion-container\").length > 0){\r\n if(!localStorage.getItem('couponvalidation')){\r\n \tlocalStorage['couponvalidation'] = true;\r\n }\r\n }else if ($(\".gtpromochecker\").length > 0 && $(\".rowcoupons\").length == 0){\r\n localStorage['couponvalidation'] = true;\r\n \r\n }else{\r\n localStorage.removeItem('couponvalidation');\r\n }\r\n}\r\n\r\nfunction spcBillingEvent() {\r\n\tpushToDataLayer({\r\n\t\t\"event\" : \"virtualPageview\",\r\n\t\t\"eeAction\": \"eeCheckout\",\r\n\t\t\"checkoutStep\": \"4\",\r\n\t\t\"funnelType\": basketConfirmation.funnelType,\r\n\t\t\"giftWrapping\": basketConfirmation.giftWrapping,\r\n\t\t\"checkoutErrorMessage\": basketConfirmation.checkoutErrorMessage,\r\n\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\"products\": basketConfirmation.productLineItems\r\n\t})\r\n\tpushToDataLayer({\r\n\t\t\"event\": \"eeCheckoutOption\",\r\n\t\t\"checkoutStep\": \"3\",\r\n\t\t\"checkoutOption\": $('.selection-list li.selected').attr('label')\r\n\t})\r\n}\r\n\r\nfunction sampleNoticeEvent(data) {\r\n\tpushToDataLayer({\r\n\t\t\"event\": \"noSampleNoticeClick\",\r\n\t\t\"interactionType\": data==='modal-btn-select-sample' ? 'Choose Samples' : 'Continue to Checkout',\r\n\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t})\t\r\n}\r\n\r\nfunction couponAppliedEvent() {\r\n\tpushToDataLayer({\r\n\t\t\"event\": \"couponSubmission\",\r\n\t\t\"productCoupon\": $('.promo-codes').last().find('span.value').html(),\r\n\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\"pageCategory\": getPageCategory()\r\n\t})\r\n}\r\n\r\nfunction initializeGlobalEvents() {\r\n\tvar navctr = true;\r\n\tvar gtmNavData = \"\";\r\n\r\n\t$(document)\r\n\t\t.ready(function() {\r\n\t\t\tpromotionView();\r\n\t\t\tswitch (window.Resources.PAGE_CATEGORY) {\r\n\t\t\tcase 'cart-show':\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"eeCheckoutOption\",\r\n\t\t\t\t\t\"checkoutStep\": \"1\",\r\n\t\t\t\t\t\"checkoutOption\": basketConfirmation !=null ? basketConfirmation.paymentMethod : ''\r\n\t\t\t\t})\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'cosinglepagecheckout-start':\r\n\t\t\t\tvar error = basketConfirmation.checkoutErrorMessage ? basketConfirmation.checkoutErrorMessage : $(\".error-form\").text().trim();\r\n\t var errormsgtype = \"\";\r\n\t if(error.indexOf(\"Payment\") > -1){\r\n\t errormsgtype = \"Payment\";\r\n\t }else if(error.indexOf(\"email\") > -1){\r\n\t errormsgtype = \"Email\";\r\n\t }else if(error.indexOf(\"Server\") > -1){\r\n\t errormsgtype = \"Server\";\r\n\t }\r\n\t if(error){\r\n\t pushDtLayer({\r\n\t \"checkoutErrorMessage\": basketConfirmation.checkoutErrorMessage ? basketConfirmation.checkoutErrorMessage : $(\".error-form\").text().trim(),\r\n\t \"event\": \"transactionError\",\r\n\t \"pageSubCategory\": getPageSubcategory(),\r\n\t \"pageCategory\": getPageCategory(),\r\n\t \"checkoutErrorType\" : errormsgtype\r\n\t }); \r\n\t }\r\n\t break;\r\n\t \r\n\t\t\tdefault:\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t})\r\n\t\t// Wish ListAdd-Remove event of Online Quiz Result Page .wishlist-icon.wishlist\r\n\t\t.on(\"click\", \".defend-regenerate .product-tile .wishlist-icon.wishlist\", function (e) {\r\n\t\t\te.stopImmediatePropagation();\r\n\t\t\tvar wishlistadded = $(this).hasClass(\"wishlist-added\");\r\n\t\t\tvar $gtmProductTile = $(this).parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\tvar _event=\"clickSaveForLaterOnlineQuiz\";\r\n\t\t\t//@TODO : Event not provided yet for removing from wishlist.\r\n\t\t\t// if(wishlistadded){\r\n\t\t\t// \t_event=\"removeFromWhishlistOnlineQuiz\";\r\n\t\t\t// }\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\":_event,\r\n\t\t\t\t\"productCategory\": tileVariantData.catid,\r\n\t\t\t\t\"productSubCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\"productName\": tileVariantData.name,\r\n\t\t\t\t\"productId\": tileVariantData.ID,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t});\t\r\n\t\t})\r\n\t\t// Wish ListAdd-Remove event of Visualizer page/ Actimirror Page .wishlist-icon.wishlist\r\n\t\t.on(\"click\", \".actimirror-content .product-tile .wishlist-icon.wishlist\", function (e) {\r\n\t\t\te.stopImmediatePropagation();\r\n\t\t\tvar wishlistadded = $(this).hasClass(\"wishlist-added\");\r\n\t\t\tvar $gtmProductTile = $(this).parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\tvar _event=\"clickSaveForLaterVisualizer\";\r\n\t\t\tif(wishlistadded){\r\n\t\t\t\t_event=\"removeFromWhishlistVisualizer\";\r\n\t\t\t}\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\":_event,\r\n\t\t\t\t\t\"productCategory\": tileVariantData.catid,\r\n\t\t\t\t\t\"productSubCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\t\"productName\": tileVariantData.name,\r\n\t\t\t\t\t\"productId\": tileVariantData.ID,\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\t\"language\": dtgetLanguage(),\r\n\t\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t\t});\t\r\n\t\t})\r\n\t\t// add to wishlist in pdp and quickview\r\n\t\t.on('click', \".wishlist-icon.wishlist\", function (e) {\r\n\t\t\tvar _this = $(this);\r\n\t\t\tvar _event = \"clickSaveForLater\";\r\n\t\t\tif (_this.hasClass(\"wishlist-added\")) {\r\n\t\t\t\t_event = \"removeFromWishlist\";\r\n\t\t\t}\r\n\t\t\tif (_this.parents(\".cart-row\").length > 0) {\r\n\t\t\t\tvar productLineItem = []\r\n\t\t\t\t$.each(basketConfirmation.productLineItems, function(index) {\r\n\t\t\t\t\tif(basketConfirmation.productLineItems[index].productType=='Product') {\r\n\t\t\t\t\t\tproductLineItem.push(basketConfirmation.productLineItems[index])\r\n\t\t\t\t\t}\r\n\t\t\t\t})\r\n\t\t\t\tvar index = _this.parents(\".cart-row\").index()-1;\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\"event\": _event,\r\n\t\t\t\t\t\t\"productCategory\": productLineItem[index].category,\r\n\t\t\t\t\t\t\"productSubCategory\": productLineItem[index].subCategory,\r\n\t\t\t\t\t\t\"productName\": productLineItem[index].name,\r\n\t\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\t\"productId\": productLineItem[index].id\r\n\t\t\t\t\t});\r\n\t\t\t} else {\r\n\t\t\t\tvar prodName = _this.parents('.product-tile').length > 0 ? _this.parents('.product-tile').find('.product-name').html().trim() : _this.attr('data-element-name');\r\n\t\t\t\tvar productCategory = getProductCategory();\r\n\t\t\t\tvar productSubCategory = getProductsubCategory()\r\n\t\t\t\tif ($('.wishlist-container').length > 0) {\r\n\t\t\t\t\tvar $gtmProductTile = _this.parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\t\t\tproductCategory = tileVariantData.catid;\r\n\t\t\t\t\tproductSubCategory= tileVariantData.subcategory;\r\n\t\t\t\t}\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\"event\": _event,\r\n\t\t\t\t\t\t\"productCategory\": productCategory,\r\n\t\t\t\t\t\t\"productSubCategory\": productSubCategory,\r\n\t\t\t\t\t\t\"productName\": prodName,\r\n\t\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\t\"productId\": _this.attr('data-element-pid')\r\n\t\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// newsletter in navigation;\r\n\t\t.on(\"clicknewsletter\", function (e, data) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"newsletterSubscription\",\r\n\t\t\t\t\"siteLocation\": data.siteloc,\r\n\t\t\t\t\"pageSubCategory\": getPageCategory() == \"My Account\" ? getProductsubCategory() : \"\",\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\r\n\t\t// click ask question in pdp\r\n\t\t.on(\"click\", \".bv-ask-question\", function (e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\tpage: getpage(),\r\n\t\t\t\t\"event\": \"askQuestion\",\r\n\t\t\t\tproductCategory: getProductCategory(),\r\n\t\t\t\tpageSubCategory: \"Ask a Question\",\r\n\t\t\t\tproductName: getProductName(),\r\n\t\t\t\tpageCategory: \"Product Page\"\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// Scroll on reviews in pdp\r\n\t\t.on('scroll', function () {\r\n\t\t\tif ($(\".bv-section-summary\").length) {\r\n\t\t\t\tif (isScrolledIntoView(\".bv-section-summary\") && unbind < 1) {\r\n\t\t\t\t\tunbind = 1;\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\tpage: getpage(),\r\n\t\t\t\t\t\tevent: \"productReviewsView\",\r\n\t\t\t\t\t\tproductCategory: getProductCategory(),\r\n\t\t\t\t\t\tpageSubCategory: \"Reviews\",\r\n\t\t\t\t\t\tproductName: getProductName(),\r\n\t\t\t\t\t\tpageCategory: \"Product Page\"\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t\t// for recommendation in pdp and cart, Best Seller and Recently Viewed in Homepage\r\n\t\t\tif ($(\".pi .carousel-recommendations\").length > 0 || $(\".cross-sell .carousel-recommendations\").length > 0) {\r\n\t\t\t\t$('.carousel-recommendations').each(function () {\r\n\t\t\t\t\tvar result = isScrolledIntoView($(this));\r\n\t\t\t\t\tif (result[0]) {\r\n\t\t\t\t\t\tif (result[1] === 'recently-viewed cross-sell rv-section') {\r\n\t\t\t\t\t\t\tif (unbindreccarousel < 1) {\r\n\t\t\t\t\t\t\t\tunbindreccarousel = 1;\r\n\t\t\t\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\t\t\t\t\"eeAction\": \"eeListView\",\r\n\t\t\t\t\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\t\t\t\t\"products\": window.recentforpageload.product\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t} else if (result[1].indexOf('pdp-social-media-section') == -1) {\r\n\t\t\t\t\t\t\tif (unbindcarousel < 1) {\r\n\t\t\t\t\t\t\t\tunbindcarousel = 1;\r\n\t\t\t\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\t\t\t\t\"eeAction\": \"eeListView\",\r\n\t\t\t\t\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\t\t\t\t\"products\": window.forpageload.product\r\n\t\t\t\t\t\t\t\t});\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t})\r\n\r\n\t\t// Click on Reviews in PDP\r\n\t\t.on(\"click\", \".bv-inline-histogram-ratings-star-container\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\tpage: getpage(),\r\n\t\t\t\tevent: \"productReviewsView\",\r\n\t\t\t\tproductCategory: getProductCategory(),\r\n\t\t\t\tpageSubCategory: \"Reviews\",\r\n\t\t\t\tproductName: getProductName(),\r\n\t\t\t\tpageCategory: \"Product Page\"\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// Check balance giftcard in gift card page\r\n\t\t.on('click', \"#CheckBalanceButton\", function () {\r\n\t\t\tif ($(\"#dwfrm_giftcert_balance_giftCertID\").val() != \"\" && $(\"#dwfrm_giftcert_balance_giftCertPIN\").val() != \"\") {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"giftCard\",\r\n\t\t\t\t\t\"pageSubCategory\": \"Gift Card\",\r\n\t\t\t\t\t\"pageCategory\": \"My Account\"\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// Check balance giftcard in checkout page\r\n\t\t.on('click', \".modal-body .gift-cert-balance-submit #check-giftcert-modal\", function (e) {\r\n\t\t\tif ($(\".modal-body .gift-card-number #dwfrm_billing_giftCertCode\").val() != \"\" && $(\".modal-body .gift-card-pin #dwfrm_giftcert_balance_giftCertPIN\").val() != \"\") {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"giftCard\",\r\n\t\t\t\t\t\"pageSubCategory\": \"Payment\",\r\n\t\t\t\t\t\"pageCategory\": \"Checkout\"\r\n\t\t\t\t});\r\n\r\n\t\t\t}\r\n\t\t})\r\n\t\t// Product click event of Visualizer page/ Actimirror Page\r\n\t\t.on(\"click\", \".actimirror-content .tile-top-section .thumb-link,.actimirror-content .tile-top-section .name-link\", function () {\r\n\t\t\tvar $gtmProductTile = $(this).parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\tvar index = $(this).parents(\".product-tile-wrapper\").find(\"#productPosition\").val()-1;\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"eeAction\": \"eeListClick\",\r\n\t\t\t\t\"event\" : \"eeListClick\",\r\n\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"language\": dtgetLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry(),\r\n\t\t\t\t'products': [{\r\n\t\t\t\t\t\"listType\": prodholder[0][index].listType,\r\n\t\t\t\t\t\"listName\": prodholder[0][index].listName,\r\n\t\t\t\t\t\"position\": prodholder[0][index].position,\r\n\t\t\t\t\t\"id\": tileVariantData.ID,\r\n\t\t\t\t\t\"category\": tileVariantData.catid,\r\n\t\t\t\t\t\"price\": tileVariantData.pricing.sale ? tileVariantData.pricing.sale : tileVariantData.pricing.minprice,\r\n\t\t\t\t\t\"name\": tileVariantData.name,\r\n\t\t\t\t\t\"brand\": tileVariantData.brand,\r\n\t\t\t\t\t\"quantity\": tileVariantData.quantity,\r\n\t\t\t\t\t\"size\": tileVariantData.size,\r\n\t\t\t\t\t\"subCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\t\"subSubCategory\": tileVariantData.subsubcategory,\r\n\t\t\t\t\t\"productAutoReplen\": tileVariantData.productautoreplenish,\r\n\t\t\t\t\t\"productOutOfStock\": tileVariantData.productOutOfStock,\r\n\t\t\t\t\t\"productColor\": tileVariantData.productColor,\r\n\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\"productVariantID\": tileVariantData.master ? tileVariantData.defalutvariant : tileVariantData.ID,\r\n\t\t\t\t\t\"collectionName\": tileVariantData.customBrand,\r\n\t\t\t\t\t\"productNumReviews\": tileVariantData.productNumReviews,\r\n\t\t\t\t\t\"productStarRating\": tileVariantData.productStarRating\r\n\t\t\t\t}]\r\n\t\t\t});\r\n\t\t\t\r\n\t\t\tvar targetLocation = $(this).attr(\"href\");\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\tdocument.location = targetLocation;\r\n\t\t\t}, 1000);\r\n\t\t\t\r\n\t\t})\r\n\r\n\t\t// Add to Cart event of Visualizer page/ Actimirror Page\r\n\t\t.on(\"click\", \".actimirror-content .tile-bottom-section .add-to-cart\", function (e) {\r\n\t\t\te.stopImmediatePropagation();\r\n\t\t\tvar $gtmProductTile = $(this).parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"addToCart\", \r\n\t\t\t\t\"addToCartType\": \"Visualizer\",\r\n\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\"pageCategory\":getPageCategory(),\r\n\t\t\t\t\"language\": dtgetLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry(),\r\n\t\t\t\t'products': [{\r\n\t\t\t\t\t\"id\": tileVariantData.ID,\r\n\t\t\t\t\t\"category\": tileVariantData.catid,\r\n\t\t\t\t\t\"price\": tileVariantData.pricing.sale ? tileVariantData.pricing.sale : tileVariantData.pricing.minprice,\r\n\t\t\t\t\t\"name\": tileVariantData.name,\r\n\t\t\t\t\t\"brand\": tileVariantData.brand,\r\n\t\t\t\t\t\"quantity\": tileVariantData.quantity,\r\n\t\t\t\t\t\"size\": tileVariantData.size,\r\n\t\t\t\t\t\"subCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\t\"subSubCategory\": tileVariantData.subsubcategory,\r\n\t\t\t\t\t\"productAutoReplen\": tileVariantData.productautoreplenish,\r\n\t\t\t\t\t\"productOutOfStock\": tileVariantData.productOutOfStock,\r\n\t\t\t\t\t\"productColor\": tileVariantData.productColor,\r\n\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\"productVariantID\": tileVariantData.master ? tileVariantData.defalutvariant : tileVariantData.ID,\r\n\t\t\t\t\t\"productOrderType\":getProductOrderType($(this).parents(\".product-tile-wrapper\").find(\"#replenishmentCycle\").val()),\r\n\t\t\t\t\t\"collectionName\": tileVariantData.customBrand,\r\n\t\t\t\t\t\"productNumReviews\": tileVariantData.productNumReviews,\r\n\t\t\t\t\t\"productStarRating\": tileVariantData.productStarRating\r\n\t\t\t\t}]\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t\r\n\t\t// Tab click event of Visualizer page/ Actimirror Page\r\n\t\t.on(\"click\", \".actmirror-header .session-scores li\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"visualizerTabInteraction\",\r\n\t\t\t\t\"pageCategory\": \"My Account\",\r\n\t\t\t\t\"pageSubCategory\": \"Visualizer\",\r\n\t\t\t\t\"language\":dtgetLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t});\r\n\t\t\t\r\n\t\t})\r\n\r\n\t\t// Tab click event of Visualizer page/ Actimirror Page for Tabs\r\n\t\t.on(\"click\", \".skin-analysis-wrapper-tab-head a\", function () {\r\n\t\t\tvar index = $(this).text();\r\n\t\t\tvar courseName = $(this).attr('data-courseui').toString();\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"visualizerTabInteraction\",\r\n\t\t\t\t\"sectiontab\": index.replace(/(\\r\\n|\\n|\\r)/gm, \"\"),\r\n\t\t\t\t\"course\": courseName,\r\n\t\t\t\t\"pageCategory\": \"My Account\", \r\n\t\t\t\t\"pageSubCategory\": \"Visualizer\", \r\n\t\t\t\t\"language\": dtgetLanguage(), \r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t})\t\r\n\t\t})\r\n\r\n\t\t// Tab click event of Visualizer page/ Actimirror Page for Heading Tabs\r\n\t\t.on(\"click\", \".recommended-section-tab-head-in .tab-head-link\", function () {\r\n\t\t\tvar index = $(this).text();\r\n\t\t\tvar courseName = $(this).attr('data-courseui').toString();\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"visualizerTabInteraction\",\r\n\t\t\t\t\"sectiontab\": index.replace(/(\\r\\n|\\n|\\r)/gm, \"\"),\r\n\t\t\t\t\"course\": courseName,\r\n\t\t\t\t\"pageCategory\": \"My Account\", \r\n\t\t\t\t\"pageSubCategory\": \"Visualizer\", \r\n\t\t\t\t\"language\": dtgetLanguage(), \r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t})\t\t\t\r\n\t\t})\r\n\r\n\t\t// Data layer of learn more link for future actimirror product\r\n\t\t.on('click', '.future-solution-text a', function () {\r\n\t\t\tvar courseName = $(this).parents(\".future-solution-text\").attr('data-courseui').toString();\r\n\t\t\tvar nextUrl = $(this).attr(\"href\");\r\n\t\t\tvar sectTab = $('.tab-head-premiumsolutions').text();\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"visualizerTabInteractionPageClick\",\r\n\t\t\t\t\"sectiontab\": sectTab.replace(/(\\r\\n|\\n|\\r)/gm, \"\"),\r\n\t\t\t\t\"course\": courseName,\r\n\t\t\t\t\"page\": getNextPage(nextUrl),\r\n\t\t\t\t\"pageCategory\": \"My Account\", \r\n\t\t\t\t\"pageSubCategory\": \"Visualizer\", \r\n\t\t\t\t\"language\": dtgetLanguage(), \r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t});\r\n\t\t\treturn true;\r\n\t\t})\r\n\r\n\t\t// Tab click event of Visualizer Page for Carousel Selection Date \r\n\t\t.on(\"click\", \".visualizerResultDateslider .slide a\", function () { \r\n\t\t\tvar resultDateClick = $(this).data('resultdate'); \r\n\t\t\tvar nowDateClick = new Date(resultDateClick);\r\n\t\t\tvar dateClick = nowDateClick.getFullYear()+'.'+(nowDateClick.getMonth()+1)+'.'+nowDateClick.getDate();\r\n\t\t\tpushToDataLayer({ \r\n\t\t\t\t\"event\": \"checkPastConsultationResult\", \r\n\t\t\t\t\"consultationToolType\": \"Skin Visualizer\",\r\n\t\t\t\t\"resultDate\": dateClick \r\n\t\t\t}); \r\n\t\t\t\r\n\t\t})\r\n\r\n\t\t// Tab click event of Visualizer Page for skin condition tabs \r\n\t\t.on(\"click\", \".skin-condition-tabs .skin-condition-btn\", function () { \r\n\t\t\tvar beautyModule = $(this).text();\r\n\t\t\tvar radioData = $(this).attr('data-tab');\r\n\t\t\tvar beautyfilter = $(\".\"+radioData+\" input.skin-condition-radio:checked\").attr('value');\r\n\t\t\tpushToDataLayer({ \r\n\t\t\t\t\"event\": \"beautyCirculationInteraction\", \r\n\t\t\t\t\"consultationToolType\": \"Skin Visualizer\", \r\n\t\t\t\t\"beautyModule\": beautyModule, \r\n\t\t\t\t\"beautyfilter\": beautyfilter ? beautyfilter: \"\"\r\n\t\t\t}); \r\n\t\t\t\r\n\t\t})\r\n\r\n\t\t// Tab click event of Visualizer Page for skin condition tabs radio buttons\r\n\t\t.on(\"click\", \".skin-condition-radio\", function () {\r\n\t\t\tvar beautyfilterRadio = $(this).attr('value'); \r\n\t\t\tvar beautyModuleRadio = $('.skin-condition-tabs .skin-condition-btn.active').text();\r\n\t\t\t\tpushToDataLayer({ \r\n\t\t\t\t\t\"event\": \"beautyCirculationInteraction\", \r\n\t\t\t\t\t\"consultationToolType\": \"Skin Visualizer\",\r\n\t\t\t\t\t\"beautyModule\": beautyModuleRadio,\r\n\t\t\t\t\t\"beautyfilter\": beautyfilterRadio\r\n\t\t\t\t});\r\n\t\t})\r\n\r\n\t\t// Tab click event of Visualizer Page for Beauty tips section\r\n\t\t.on(\"click\", \".beautyTipsSection .beautyTips a\", function () { \r\n\t\t\tvar beautyTips = $(this).find('p').text();\r\n\t\t\tvar clickedURL = $(this).attr(\"href\");\r\n\t\t\tpushToDataLayer({ \r\n\t\t\t\t\"event\": \"selectBeautyTips\", \r\n\t\t\t\t\"consultationToolType\": \"Skin Visualizer\",\r\n\t\t\t\t\"beautyTips\": beautyTips,\r\n\t\t\t\t\"clickedURL\": clickedURL\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// Tab click event of Visualizer Page for checkYourPurchase Button \r\n\t\t.on(\"click\", \".orderHistory a\", function () { \r\n\t\t\tpushToDataLayer({ \r\n\t\t\t\t\"event\": \"checkYourPurchase\", \r\n\t\t\t\t\"consultationToolType\": \"Skin Visualizer\"\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".viewDetails a\", function () { \r\n\t\t\tvar viewProductDetail = $(this).data('viewproductdetail');\r\n\t\t\t\tpushDtLayer({\r\n\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\"pageCategory\": \"Consultation Tool\", \r\n\t\t\t\t\t\"pageSubCategory\": \"Skin Visualizer\", \r\n\t\t\t\t\t\"siteLocation\": \"Skin Visualizer Page\",\r\n\t\t\t\t\t\"products\": viewProductDetail\r\n\t\t\t\t});\r\n\t\t})\r\n\r\n\t\t// Product click event of Online Quiz Page\r\n\t\t.on(\"click\", \".defend-regenerate .tile-top-section .thumb-link,.defend-regenerate .tile-top-section .name-link\", function () {\r\n\t\t\tvar $gtmProductTile = $(this).parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"eeAction\": \"eeListClick\",\r\n\t\t\t\t\"event\" : \"eeListClick\",\r\n\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry(),\r\n\t\t\t\t'products': [{\r\n\t\t\t\t\t\"listType\": \"onlineQuiz\",\r\n\t\t\t\t\t\"listName\": \"Defend & Generate\",\r\n\t\t\t\t\t\"position\": $(this).parents(\".product-tile-wrapper\").find(\"#productPosition\").val(),\r\n\t\t\t\t\t\"id\": tileVariantData.ID,\r\n\t\t\t\t\t\"category\": tileVariantData.catid,\r\n\t\t\t\t\t\"price\": tileVariantData.pricing.sale ? tileVariantData.pricing.sale : tileVariantData.pricing.minprice,\r\n\t\t\t\t\t\"name\": tileVariantData.name,\r\n\t\t\t\t\t\"brand\": tileVariantData.brand,\r\n\t\t\t\t\t\"quantity\": tileVariantData.quantity,\r\n\t\t\t\t\t\"size\": tileVariantData.size,\r\n\t\t\t\t\t\"subCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\t\"subSubCategory\": tileVariantData.subsubcategory,\r\n\t\t\t\t\t\"productAutoReplen\": tileVariantData.productautoreplenish,\r\n\t\t\t\t\t\"productOutOfStock\": tileVariantData.productOutOfStock,\r\n\t\t\t\t\t\"productColor\": tileVariantData.productColor,\r\n\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\"productVariantID\": tileVariantData.master ? tileVariantData.defalutvariant : tileVariantData.ID,\r\n\t\t\t\t\t\"collectionName\": tileVariantData.customBrand,\r\n\t\t\t\t\t\"productNumReviews\": tileVariantData.productNumReviews,\r\n\t\t\t\t\t\"productStarRating\": tileVariantData.productStarRating\r\n\t\t\t\t}]\r\n\t\t\t});\r\n\t\t\tvar targetLocation = $(this).attr(\"href\");\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\tdocument.location = targetLocation;\r\n\t\t\t}, 1000);\r\n\t\t\t\r\n\t\t})\r\n\r\n\t\t// Add to Cart event of Online Quiz Page\r\n\t\t.on(\"click\", \".defend-regenerate .tile-bottom-section .add-to-cart\", function (e) {\r\n\t\t\te.stopImmediatePropagation();\r\n\t\t\tvar $gtmProductTile = $(this).parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"addToCart\", \r\n\t\t\t\t\"addToCartType\": \"onlineQuiz\",\r\n\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\"pageCategory\":getPageCategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry(),\r\n\t\t\t\t'products': [{\r\n\t\t\t\t\t\"id\": tileVariantData.ID,\r\n\t\t\t\t\t\"category\": tileVariantData.catid,\r\n\t\t\t\t\t\"price\": tileVariantData.pricing.sale ? tileVariantData.pricing.sale : tileVariantData.pricing.minprice,\r\n\t\t\t\t\t\"name\": tileVariantData.name,\r\n\t\t\t\t\t\"brand\": tileVariantData.brand,\r\n\t\t\t\t\t\"quantity\": tileVariantData.quantity,\r\n\t\t\t\t\t\"size\": tileVariantData.size,\r\n\t\t\t\t\t\"subCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\t\"subSubCategory\": tileVariantData.subsubcategory,\r\n\t\t\t\t\t\"productAutoReplen\": tileVariantData.productautoreplenish,\r\n\t\t\t\t\t\"productOutOfStock\": tileVariantData.productOutOfStock,\r\n\t\t\t\t\t\"productColor\": tileVariantData.productColor,\r\n\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\"productVariantID\": tileVariantData.master ? tileVariantData.defalutvariant : tileVariantData.ID,\r\n\t\t\t\t\t//\"productOrderType\":getProductOrderType($(this).parents(\".product-tile-wrapper\").find(\"#replenishmentCycle\").val()),\r\n\t\t\t\t\t\"productOrderType\": getProductOrederType(),\r\n\t\t\t\t\t\"collectionName\": tileVariantData.customBrand,\r\n\t\t\t\t\t\"productNumReviews\": tileVariantData.productNumReviews,\r\n\t\t\t\t\t\"productStarRating\": tileVariantData.productStarRating\r\n\t\t\t\t}]\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// add to cart from PDP\r\n\t\t.on('click', '#pdpMain .add-to-cart', function (e) {\r\n\t\t\tif (getPageCategory() == \"Cart Page\") {\r\n\t\t\t\tif (sessionStorage.getItem(\"cartupdate\")) {\r\n\t\t\t\t\tsessionStorage.setItem(\"productUpdate\", \"1\");\r\n\t\t\t\t}\r\n\t\t\t} else {\r\n\t\t\t\twindow.productCache = window.productCache || {};\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"currencyCode\": window.Resources.CURRENCY,\r\n\t\t\t\t\t\"event\": \"addToCart\",\r\n\t\t\t\t\t\"productOrderType\": getProductOrederType(),\r\n\t\t\t\t\t\"addToCartType\": \"Product Page\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\t'products': [{\r\n\t\t\t\t\t\t\"id\": getProductID(),\r\n\t\t\t\t\t\t\"productVariantID\": pdpdata.master ? pdpdata.defalutvariant : pdpdata.ID,\r\n\t\t\t\t\t\t\"category\": window.productCache.catid,\r\n\t\t\t\t\t\t\"price\": $(\".add-to-cart\").data(\"price\"),\r\n\t\t\t\t\t\t\"name\": getProductName(),\r\n\t\t\t\t\t\t\"brand\": getProductBrand(),\r\n\t\t\t\t\t\t\"quantity\": Number($(\".quantity select\").val()),\r\n\t\t\t\t\t\t\"size\": $(\"#pdp-swatches li.selected\").first().text().trim(),\r\n\t\t\t\t\t\t\"subCategory\": window.productCache.subcategory,\r\n\t\t\t\t\t\t\"subSubCategory\": window.productCache.subsubcategory,\r\n\t\t\t\t\t\t\"productAutoReplen\": $(\".add-to-cart\").data(\"replenishable\"),\r\n\t\t\t\t\t\t\"productOutOfStock\": $(\".add-to-cart\").data(\"instock\"),\r\n\t\t\t\t\t\t\"productColor\": $(\"#va-color option:selected\").text().split(\"/\")[0].trim(),\r\n\t\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\t\"collectionName\": pdpdata.customBrand,\r\n\t\t\t\t\t\t\"productNumReviews\": pdpdata.productNumReviews,\r\n\t\t\t\t\t\t\"productStarRating\": pdpdata.productStarRating\r\n\t\t\t\t\t}]\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// Submit ask a question\r\n\t\t.on('click', \".bv-submission-section button:contains('Post Question')\", function (e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"page\": getpage(),\r\n\t\t\t\t\"event\": \"submitQuestion\",\r\n\t\t\t\t\"productCategory\": getProductCategory(),\r\n\t\t\t\t\"question\": $(\"#bv-textarea-field-questionsummary\").val(),\r\n\t\t\t\t\"productName\": getProductName(),\r\n\t\t\t\t\"pageSubCategory\": \"Ask a Question\",\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// remove from cart\r\n\t\t.on('click', \".user-action-remove .button-text[value='Remove']\", function (e) {\r\n\t\t\tvar lineItems = [];\r\n\t\t\tvar productLineItem = [];\r\n\t\t\tvar sampleLineItem = [];\r\n\t\t\tvar bonusLineItem = [];\r\n\t\t\t$.each(basketConfirmation.productLineItems, function(index) {\r\n\t\t\t\tif (basketConfirmation.productLineItems[index].productType=='Product') {\r\n\t\t\t\t\tproductLineItem.push(basketConfirmation.productLineItems[index])\r\n\t\t\t\t} else if (basketConfirmation.productLineItems[index].productType=='Sample') {\r\n\t\t\t\t\tsampleLineItem.push(basketConfirmation.productLineItems[index])\r\n\t\t\t\t} else if (basketConfirmation.productLineItems[index].productType=='Bonus Product') {\r\n\t\t\t\t\tbonusLineItem.push(basketConfirmation.productLineItems[index])\r\n\t\t\t\t}\r\n\t\t\t})\r\n\t\t\tif ($(this).closest('.bonus-products-information').length) {\r\n\t\t\t\tlineItems = bonusLineItem;\r\n\t\t\t\tvar index = $(this).parents(\".bonus-products-information .cart-row\").index();\r\n\t\t\t}\r\n\t\t\telse if ($(this).closest('.sample-products-information').length) {\r\n\t\t\t\tlineItems = sampleLineItem;\r\n\t\t\t\tvar index = $(this).parents(\".sample-products-information .cart-row\").index()-1;\r\n\t\t\t}\r\n\t\t\telse if ($(this).closest('.products-information').length) {\r\n\t\t\t\tlineItems = productLineItem;\r\n\t\t\t\tvar index = $(this).parents(\".products-information .cart-row\").index()-1;\r\n\t\t\t}\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"removeFromCart\",\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t'products': [{\r\n\t\t\t\t\t\"id\": lineItems[index].id,\r\n\t\t\t\t\t\"category\": lineItems[index].category,\r\n\t\t\t\t\t\"price\": lineItems[index].price,\r\n\t\t\t\t\t\"name\": lineItems[index].name,\r\n\t\t\t\t\t\"brand\": getProductBrand(),\r\n\t\t\t\t\t\"quantity\": lineItems[index].quantity,\r\n\t\t\t\t\t\"size\": lineItems[index].size,\r\n\t\t\t\t\t\"subCategory\": lineItems[index].subCategory,\r\n\t\t\t\t\t\"subSubCategory\": lineItems[index].subSubCategory,\r\n\t\t\t\t\t\"productAutoReplen\": lineItems[index].productAutoReplen,\r\n\t\t\t\t\t\"productOutOfStock\": lineItems[index].productOutOfStock,\r\n\t\t\t\t\t\"productColor\": lineItems[index].productColor,\r\n\t\t\t\t\t\"productType\": lineItems[index].productType,\r\n\t\t\t\t\t\"productOrderType\": ($(this).parents(\".cart-row\").find(\".replenishment .replenishmentDays\").length > 0) ? \"Replenishment\" : \"Regular\",\r\n\t\t\t\t\t\"productVariantID\": lineItems[index].productVariantID,\r\n\t\t\t\t\t\"collectionName\": lineItems[index].collectionName\r\n\t\t\t\t}] \r\n\t\t\t})\r\n\r\n\t\t})\r\n\r\n\t\t// remove from minicart\r\n\t\t.on('click', \".mini-cart-image .remove-link\", function (e) {\r\n\t\t\tvar index = $(this).parents(\".mini-cart-product\").index();\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"currencyCode\": window.Resources.CURRENCY,\r\n\t\t\t\t\"event\": \"removeFromCart\",\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t'products': [{\r\n\t\t\t\t\t\"id\": miniBasketConfirmation.productLineItems[index].id,\r\n\t\t\t\t\t\"category\": miniBasketConfirmation.productLineItems[index].category,\r\n\t\t\t\t\t\"price\": miniBasketConfirmation.productLineItems[index].price,\r\n\t\t\t\t\t\"name\": miniBasketConfirmation.productLineItems[index].name,\r\n\t\t\t\t\t\"brand\": getProductBrand(),\r\n\t\t\t\t\t\"quantity\": miniBasketConfirmation.productLineItems[index].quantity,\r\n\t\t\t\t\t\"size\": miniBasketConfirmation.productLineItems[index].size,\r\n\t\t\t\t\t\"subCategory\": miniBasketConfirmation.productLineItems[index].subCategory,\r\n\t\t\t\t\t\"subSubCategory\": miniBasketConfirmation.productLineItems[index].subSubCategory,\r\n\t\t\t\t\t\"productAutoReplen\": miniBasketConfirmation.productLineItems[index].productAutoReplen,\r\n\t\t\t\t\t\"productOutOfStock\": miniBasketConfirmation.productLineItems[index].productOutOfStock,\r\n\t\t\t\t\t\"productColor\": miniBasketConfirmation.productLineItems[index].productColor,\r\n\t\t\t\t\t\"productType\": miniBasketConfirmation.productLineItems[index].productType,\r\n\t\t\t\t\t\"productOrderType\": ($(this).parents(\".cart-row\").find(\".replenishment .replenishmentDays\").length > 0) ? \"Replenishment\" : \"Regular\",\r\n\t\t\t\t\t\"productVariantID\": miniBasketConfirmation.productLineItems[index].productVariantID,\r\n\t\t\t\t\t\"collectionName\": miniBasketConfirmation.productLineItems[index].collectionName\r\n\t\t\t\t}]\r\n\t\t\t})\r\n\r\n\t\t})\r\n\t\t// click zoom in pdp\r\n\t\t.on('click', \".productthumbnail.selected\", function (e) {\r\n\t\t\tif ($('.quickview-modal').length === 0) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"productInteraction\",\r\n\t\t\t\t\t\"productCategory\": getProductCategory(),\r\n\t\t\t\t\t\"productSubCategory\": getProductsubCategory(),\r\n\t\t\t\t\t\"productName\": getProductName(),\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\t\"productId\": getProductID(),\r\n\t\t\t\t\t\"interactionType\": \"Zoom\"\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// click full ingredients in pdp\r\n\t\t.on('click', \"#keyingredients .view-all.button.tertiary\", function (e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"productInteraction\",\r\n\t\t\t\t\"productCategory\": getProductCategory(),\r\n\t\t\t\t\"productSubCategory\": getProductsubCategory(),\r\n\t\t\t\t\"productName\": getProductName(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"productId\": getProductID(),\r\n\t\t\t\t\"interactionType\": \"View Full Product Ingredients\"\r\n\t\t\t})\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".cart-promo-approaching\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"eePromoClick\",\r\n\t\t\t\t\"pageSubCategory\": \"Internal marketing\",\r\n\t\t\t\t\"pageCategory\": \"Cart Page\",\r\n\t\t\t\t'promotions': [{\r\n\t\t\t\t\t\"position\": \"Cart\",\r\n\t\t\t\t\t\"id\": $(\".cart-promo-approaching\").data(\"promoid\"),\r\n\t\t\t\t\t\"creative\": \"Cart-Banner\",\r\n\t\t\t\t\t\"name\": $(\".cart-promo-approaching\").data(\"promoname\")\r\n\t\t\t\t}]\r\n\t\t\t})\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".cart-coupon-code #add-coupon\", function () {\r\n\t\t\tlocalStorage.removeItem('couponvalidation');\r\n\t\t})\r\n\r\n\t\t// track share button on PDP\r\n\t\t.on(\"click\", \".socialsharing .share-icon\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"socialAction\": \"Share\",\r\n\t\t\t\t\"event\": \"socialShare\",\r\n\t\t\t\t\"siteLocation\": \"product page\",\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"socialNetwork\": $(this).data(\"share\")\r\n\t\t\t})\r\n\t\t})\r\n\r\n\t\t// Track Follow button on Footer\r\n\t\t.on(\"click\", \".social-links a\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"socialAction\": \"Follow\",\r\n\t\t\t\t\"event\": \"socialFollow\",\r\n\t\t\t\t\"siteLocation\": \"footer\",\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"socialNetwork\": $(this).data(\"follow\")\r\n\t\t\t})\r\n\t\t})\r\n\r\n\t\t// Add to all to Cart\r\n\t\t.on(\"click\", \"#add-all-to-cart\", function () {\r\n\t\t\tvar $regimenbg = $(this).parents(\".search-result-items\");\r\n\t\t\tvar products = [];\r\n\t\t\t$regimenbg.find('.gtm-product-tile').each(function () {\r\n\t\t\t\tvar product = {};\r\n\t\t\t\tvar tileVariantData = $(this).data('value');\r\n\t\t\t\tproduct.ID = tileVariantData.masterID || tileVariantData.ID;\r\n\t\t\t\tproduct.productVariantID = tileVariantData.ID;\r\n\t\t\t\tproduct.category = tileVariantData.catid;\r\n\t\t\t\tproduct.price = tileVariantData.pricing.sale ? tileVariantData.pricing.sale : tileVariantData.pricing.minprice;\r\n\t\t\t\tproduct.name = tileVariantData.name;\r\n\t\t\t\tproduct.brand = tileVariantData.brand;\r\n\t\t\t\tproduct.quantity = tileVariantData.quantity;\r\n\t\t\t\tproduct.size = tileVariantData.size;\r\n\t\t\t\tproduct.subCategory = tileVariantData.subcategory;\r\n\t\t\t\tproduct.subSubCategory = tileVariantData.subsubcategory;\r\n\t\t\t\tproduct.productAutoReplen = tileVariantData.productautoreplenish;\r\n\t\t\t\tproduct.productOutOfStock = tileVariantData.productOutOfStock;\r\n\t\t\t\tproduct.productColor = tileVariantData.productColor;\r\n\t\t\t\tproduct.productType = \"Product\";\r\n\t\t\t\tproduct.collectionName = tileVariantData.customBrand;\r\n\t\t\t\tproduct.productNumReviews = tileVariantData.productNumReviews;\r\n\t\t\t\tproduct.productStarRating = tileVariantData.productStarRating;\r\n\t\t\t\tproducts.push(product);\r\n\t\t\t});\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"currencyCode\": window.Resources.CURRENCY,\r\n\t\t\t\t\"event\": \"addToCart\",\r\n\t\t\t\t\"productOrderType\": getProductOrederType(),\r\n\t\t\t\t\"addToCartType\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getProductsubCategory(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t'products': products\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// click email hyper link in navigation\r\n\t\t.on('click', '.emailcsr-nav', function () {\r\n\t\t\tif (window.Resources.PAGE_CATEGORY == \"page-show\") {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\t\t\"contactType\": \"Email\",\r\n\t\t\t\t\t\"siteLocation\": \"Header\",\r\n\t\t\t\t\t//\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\t\"pageCategory\": getProductCategory()\r\n\t\t\t\t});\r\n\r\n\t\t\t} else {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\t\t\"contactType\": \"Email\",\r\n\t\t\t\t\t\"siteLocation\": \"Header\",\r\n\t\t\t\t\t\"pageSubCategory\": window.Resources.PAGE_CATEGORY == \"cart-show\" ? \"\" : couponsubcategory(),\r\n\t\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t\t});\r\n\t\t\t}\r\n\r\n\t\t})\r\n\t\t// Click email link in the customer care\r\n\t\t.on(\"click\", \".content-asset a:contains('customerservice@shiseidousa.com')\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\t\"contactType\": \"Email\",\r\n\t\t\t\t\"siteLocation\": window.Resources.PAGE_CATEGORY == \"cart-show\" ? \"Right Nav\" : \"Body\",\r\n\t\t\t\t//\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\"pageCategory\": window.Resources.PAGE_CATEGORY == \"cart-show\" ? getPageCategory() : getProductCategory()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t.on(\"gtmcontactus\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\t\"contactType\": \"Contact Customer Care Submission\",\r\n\t\t\t\t\"siteLocation\": \"Body\",\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t});\r\n\t\t})\r\n\t\t.on(\"askanexpert\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\t\"contactType\": \"Ask An Expert Submission\",\r\n\t\t\t\t\"siteLocation\": \"Body\",\r\n\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\"pageCategory\": \"Ask An Expert\"\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".LPMcontainer\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\t\"contactType\": \"Live Chat\",\r\n\t\t\t\t\"siteLocation\": getPageCategory() == \"Checkout\" ? \"Header\" : \"Body\",\r\n\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".LPMimage\", function () {\r\n\t\t\tvar id = $(this).attr(\"id\");\r\n\t\t\tvar chk = id.charAt(id.length - 1)\r\n\t\t\tif (chk == 1) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\t\t\"contactType\": \"Live Chat\",\r\n\t\t\t\t\t\"siteLocation\": \"Pop-up\",\r\n\t\t\t\t\t\"pageSubCategory\": couponsubcategory(),\r\n\t\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".footer-container .products ul li:nth-child(4)\", function () {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\t\"contactType\": \"Phone\",\r\n\t\t\t\t\"siteLocation\": \"Footer\",\r\n\t\t\t\t\"pageSubCategory\": window.Resources.PAGE_CATEGORY == \"cart-show\" ? \"\" : couponsubcategory(),\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// click on recommendation\r\n\t\t.on(\"click\", \".recommendation-item\", function () {\r\n\t\t\tif (getPageCategory() == \"Product Page\") {\r\n\t\t\t\tsessionStorage.setItem('listType', \"Recommended Product List\");\r\n\t\t\t\tsessionStorage.setItem('listName', \"Product Page\");\r\n\t\t\t} else if (getPageCategory() == \"Home Page\") {\r\n\t\t\t\tsessionStorage.setItem('listType', \"Recently Viewed List\");\r\n\t\t\t\tsessionStorage.setItem('listName', \"Home Page\");\r\n\t\t\t}\r\n\r\n\t\t})\r\n\r\n\r\n\t\t.on(\"click\", \".catalog-link\", function (e) {\r\n\t\t\tif (navctr == true) {\r\n\t\t\t\tgtmNavData = $(this).text().trim();\r\n\t\t\t\tsessionStorage.setItem(\"navlink\", gtmNavData);\r\n\t\t\t\tsessionStorage.setItem(\"menuloc\", \"topmenu\");\r\n\t\t\t\tutil.setCookie('navdata', encodeURIComponent(gtmNavData), .20, 'none');\r\n\t\t\t\tnavctr = false;\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".main-nav .has-sub-menu a\", function (e) {\r\n\t\t\tif (navctr == true) {\r\n\t\t\t\tgtmNavData = $(this).text().trim();\r\n\t\t\t\tsessionStorage.setItem(\"navlink\", gtmNavData);\r\n\t\t\t\tsessionStorage.setItem(\"menuloc\", \"topmenu\");\r\n\t\t\t\tutil.setCookie('navdata', encodeURIComponent(gtmNavData), .20, 'none');\r\n\t\t\t\tnavctr = false;\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".refinement-header\", function (e) {\r\n\t\t\tgtmNavData = $(this).text().trim();\r\n\t\t\tsessionStorage.setItem(\"navlink\", gtmNavData);\r\n\t\t\tsessionStorage.setItem(\"menuloc\", \"leftmenu\");\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".refinement-link\", function (e) {\r\n\t\t\tgtmNavData = $(this).text().trim();\r\n\t\t\tsessionStorage.setItem(\"navlink\", gtmNavData);\r\n\t\t\tsessionStorage.setItem(\"menuloc\", \"leftmenu\");\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".breadcrumb-element\", function (e) {\r\n\t\t\tgtmNavData = $(this).text().trim();\r\n\t\t\tsessionStorage.setItem(\"breadcrumbs\", gtmNavData);\r\n\t\t\tsessionStorage.setItem(\"menuloc\", \"leftmenu\");\r\n\t\t})\r\n\r\n\t\t.on(\"change\", \".cart-qty-select\", function (e) {\r\n\t\t\tif (getPageCategory() == \"Cart Page\") {\r\n\t\t\t\tif ($(\".edit-modal\").length > 0) {\r\n\t\t\t\t\tsessionStorage.setItem(\"cartupdate\", \"1\");\r\n\t\t\t\t} else {\r\n\t\t\t\t\tsessionStorage.setItem(\"productUpdate\", \"1\");\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\r\n\t\t})\r\n\r\n\t\t.on(\"change\", \".quantity-select\", function (e) {\r\n\t\t\tif (window.Resources.PAGE_CATEGORY == \"wishlist-show\") {\r\n\t\t\t\tsessionStorage.setItem(\"productUpdate\", \"1\");\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".account-left-nav li\", function (e) {\r\n\t\t\tgtmNavData = $(this).text().trim();\r\n\t\t\tsessionStorage.setItem(\"navlink\", gtmNavData);\r\n\t\t\tsessionStorage.setItem(\"menuloc\", \"leftmenu\");\r\n\t\t})\r\n\r\n\t\t// Remove uservalidation attribute for userlogin validation\r\n\t\t.on('click', \".user-links .log-out-link\", function (e) {\r\n\t\t\tlocalStorage.removeItem('uservalidation');\r\n\t\t})\r\n\r\n\t\t.on(\"change\", \"#va-color\", function () {\r\n\t\t\tif (getPageCategory() == \"Cart Page\") {\r\n\t\t\t\tsessionStorage.setItem(\"cartupdate\", \"1\");\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".close-button\", function () {\r\n\t\t\tif (getPageCategory() == \"Cart Page\") {\r\n\t\t\t\tsessionStorage.setItem(\"cartupdate\", \"\");\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \"#save-for-later\", function () {\r\n\t\t\tif (getPageCategory() == \"Cart Page\") {\r\n\t\t\t\tsessionStorage.setItem(\"cartupdate\", \"\");\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \"#pdp-swatches .selectable\", function () {\r\n\t\t\tif (getPageCategory() == \"Cart Page\") {\r\n\t\t\t\tif (!$(this).hasClass(\"selected\")) {\r\n\t\t\t\t\tsessionStorage.setItem(\"cartupdate\", \"1\");\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".search-suggestion-wrapper .hit\", function () {\r\n\t\t\tgtmNavData = $(this).text().trim();\r\n\t\t\tsessionStorage.setItem(\"navlink\", gtmNavData.replace(/\\s\\s+/g, ' '));\r\n\t\t\tsessionStorage.setItem(\"menuloc\", \"site search pop-in\");\r\n\t\t})\r\n\r\n\t\t.on(\"click\", \".search-suggestion-wrapper .product-suggestion\", function () {\r\n\t\t\tgtmNavData = $(this).text().trim();\r\n\t\t\tvar rep = gtmNavData.replace(/\\n/g, \" \");\r\n\t\t\tsessionStorage.setItem(\"navlink\", rep.replace(/ +/g, \" \"));\r\n\t\t\tsessionStorage.setItem(\"menuloc\", \"site search pop-in\");\r\n\t\t})\r\n\r\n\t\t// PLP click in list image\r\n\t\t.on(\"click\", \"#search-result-items .gtmindex .thumb-link\", function () {\r\n\t\t\tvar index = $(this).parents(\".gtmindex\").index(\".gtmindex\");\r\n\t\t\tif (index >= 0) {\r\n\t\t\t\tif (productData.page >= 1) {\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\t\"pageSubCategory\": \"\",\r\n\t\t\t\t\t\t\"pageCategory\": searchItems.search ? \"Site Search\" : \"Product List Page\",\r\n\t\t\t\t\t\t\"filterChoice\": getActiveSortingRule(),\r\n\t\t\t\t\t\t\"dropDown\": getRefinementsFromURL(),\r\n\t\t\t\t\t\t'products': [prodholder[index]]\r\n\t\t\t\t\t})\r\n\t\t\t\t\tsessionStorage.setItem('listType', prodholder[index].listType);\r\n\t\t\t\t\tsessionStorage.setItem('listName', prodholder[index].listName);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\t\"pageSubCategory\": \"\",\r\n\t\t\t\t\t\t\"pageCategory\": searchItems.search ? \"Site Search\" : \"Product List Page\",\r\n\t\t\t\t\t\t\"filterChoice\": getActiveSortingRule(),\r\n\t\t\t\t\t\t\"dropDown\": getRefinementsFromURL(),\r\n\t\t\t\t\t\t'products': [prodholder[0][index]]\r\n\t\t\t\t\t})\r\n\t\t\t\t\tsessionStorage.setItem('listType', prodholder[0][index].listType);\r\n\t\t\t\t\tsessionStorage.setItem('listName', prodholder[0][index].listName);\r\n\t\t\t\t}\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// PLP click in list name\r\n\t\t.on(\"click\", \"#search-result-items .gtmindex .name-link\", function () {\r\n\t\t\tvar index = $(this).parents(\".gtmindex\").index(\".gtmindex\");\r\n\t\t\tif (index >= 0) {\r\n\r\n\t\t\t\tif (productData.page > 0) {\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\t\"pageSubCategory\": \"\",\r\n\t\t\t\t\t\t\"pageCategory\": searchItems.search ? \"Site Search\" : \"Product List Page\",\r\n\t\t\t\t\t\t\"filterChoice\": getActiveSortingRule(),\r\n\t\t\t\t\t\t\"dropDown\": getRefinementsFromURL(),\r\n\t\t\t\t\t\t'products': [prodholder[index]]\r\n\t\t\t\t\t})\r\n\t\t\t\t\tsessionStorage.setItem('listType', prodholder[index].listType);\r\n\t\t\t\t\tsessionStorage.setItem('listName', prodholder[index].listName);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\t\"pageSubCategory\": \"\",\r\n\t\t\t\t\t\t\"pageCategory\": searchItems.search ? \"Site Search\" : \"Product List Page\",\r\n\t\t\t\t\t\t\"filterChoice\": getActiveSortingRule(),\r\n\t\t\t\t\t\t\"dropDown\": getRefinementsFromURL(),\r\n\t\t\t\t\t\t'products': [prodholder[0][index]]\r\n\t\t\t\t\t})\r\n\t\t\t\t\tsessionStorage.setItem('listType', prodholder[0][index].listType);\r\n\t\t\t\t\tsessionStorage.setItem('listName', prodholder[0][index].listName);\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// PLP click in list view details\r\n\t\t.on(\"click\", \"#search-result-items .gtmindex .buy-button\", function () {\r\n\t\t\tvar index = $(this).parents(\".gtmindex\").index(\".gtmindex\");\r\n\t\t\tif (index >= 0) {\r\n\r\n\t\t\t\tif (productData.page > 0) {\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\t\"pageSubCategory\": \"\",\r\n\t\t\t\t\t\t\"pageCategory\": searchItems.search ? \"Site Search\" : \"Product List Page\",\r\n\t\t\t\t\t\t\"filterChoice\": getActiveSortingRule(),\r\n\t\t\t\t\t\t\"dropDown\": getRefinementsFromURL(),\r\n\t\t\t\t\t\t'products': [prodholder[index]]\r\n\t\t\t\t\t})\r\n\t\t\t\t\tsessionStorage.setItem('listType', prodholder[index].listType);\r\n\t\t\t\t\tsessionStorage.setItem('listName', prodholder[index].listName);\r\n\t\t\t\t} else {\r\n\t\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\t\"pageSubCategory\": \"\",\r\n\t\t\t\t\t\t\"pageCategory\": searchItems.search ? \"Site Search\" : \"Product List Page\",\r\n\t\t\t\t\t\t\"filterChoice\": getActiveSortingRule(),\r\n\t\t\t\t\t\t\"dropDown\": getRefinementsFromURL(),\r\n\t\t\t\t\t\t'products': [prodholder[0][index]]\r\n\t\t\t\t\t})\r\n\t\t\t\t\tsessionStorage.setItem('listType', prodholder[0][index].listType);\r\n\t\t\t\t\tsessionStorage.setItem('listName', prodholder[0][index].listName);\r\n\t\t\t\t}\r\n\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// Recommendation, bestseller eelistclick in homepage,pdp,cart\r\n\t\t.on(\"click\", \".cross-sell .carousel-recommendations .product-tile-inner\", function (e) {\r\n\t\t\tvar index = $(this).parents(\"[class^='item-']\").index();\r\n\t\t\tif (window.forpageload != undefined && typeof forpageload.product[index] != undefined && forpageload.product[index] != null) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\"pageSubCategory\": \"\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"filterChoice\": \"\",\r\n\t\t\t\t\t\"dropDown\": \"\",\r\n\t\t\t\t\t'products': [{\r\n\t\t\t\t\t\t\"listType\": forpageload.product[index].listType,\r\n\t\t\t\t\t\t\"listName\": forpageload.product[index].listName,\r\n\t\t\t\t\t\t\"position\": forpageload.product[index].position,\r\n\t\t\t\t\t\t\"id\": forpageload.product[index].id,\r\n\t\t\t\t\t\t\"category\": getProductCategory(),\r\n\t\t\t\t\t\t\"price\": forpageload.product[index].price,\r\n\t\t\t\t\t\t\"name\": forpageload.product[index].name,\r\n\t\t\t\t\t\t\"brand\": getProductBrand(),\r\n\t\t\t\t\t\t\"quantity\": forpageload.product[index].quantity,\r\n\t\t\t\t\t\t\"size\": forpageload.product[index].size,\r\n\t\t\t\t\t\t\"subCategory\": forpageload.product[index].subCategory,\r\n\t\t\t\t\t\t\"subSubCategory\": forpageload.product[index].subSubCategory,\r\n\t\t\t\t\t\t\"productAutoReplen\": forpageload.product[index].productAutoReplen,\r\n\t\t\t\t\t\t\"productOutOfStock\": forpageload.product[index].productOutOfStock,\r\n\t\t\t\t\t\t\"productColor\": forpageload.product[index].productColor,\r\n\t\t\t\t\t\t\"productType\": forpageload.product[index].productType,\r\n\t\t\t\t\t\t\"productNumReviews\": \"\",\r\n\t\t\t\t\t\t\"productStarRating\": \"\"\r\n\t\t\t\t\t}]\r\n\t\t\t\t})\r\n\t\t\t\tsessionStorage.setItem('listType', forpageload.product[index].listType);\r\n\t\t\t\tsessionStorage.setItem('listName', forpageload.product[index].listName);\r\n\t\t\t}\r\n\r\n\t\t})\r\n\r\n\t\t// Recently viewed eelistclick in homepage\r\n\t\t.on(\"click\", \".cross-sell .carousel-recommendations .recommendation-item\", function (e) {\r\n\t\t\tvar productID = $(this).parents(\".pdp-main\").data('pid');\r\n\t\t\tvar index = $(this).index();\r\n\t\t\tif (window.recentforpageload != undefined && typeof recentforpageload.product[index] != undefined && recentforpageload.product[index] != null) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\t\"pageSubCategory\": \"\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"filterChoice\": \"\",\r\n\t\t\t\t\t\"dropDown\": \"\",\r\n\t\t\t\t\t'products': [{\r\n\t\t\t\t\t\t\"listType\": recentforpageload.product[index].listType,\r\n\t\t\t\t\t\t\"listName\": recentforpageload.product[index].listName,\r\n\t\t\t\t\t\t\"position\": recentforpageload.product[index].position,\r\n\t\t\t\t\t\t\"id\": productID ? productID : recentforpageload.product[index].id,\r\n\t\t\t\t\t\t\"category\": getProductCategory(),\r\n\t\t\t\t\t\t\"price\": recentforpageload.product[index].price,\r\n\t\t\t\t\t\t\"name\": recentforpageload.product[index].name,\r\n\t\t\t\t\t\t\"brand\": getProductBrand(),\r\n\t\t\t\t\t\t\"quantity\": recentforpageload.product[index].quantity,\r\n\t\t\t\t\t\t\"size\": recentforpageload.product[index].size,\r\n\t\t\t\t\t\t\"subCategory\": recentforpageload.product[index].subCategory,\r\n\t\t\t\t\t\t\"subSubCategory\": recentforpageload.product[index].subSubCategory,\r\n\t\t\t\t\t\t\"productAutoReplen\": recentforpageload.product[index].productAutoReplen,\r\n\t\t\t\t\t\t\"productOutOfStock\": recentforpageload.product[index].productOutOfStock,\r\n\t\t\t\t\t\t\"productColor\": recentforpageload.product[index].productColor,\r\n\t\t\t\t\t\t\"productType\": recentforpageload.product[index].productType,\r\n\t\t\t\t\t\t\"productNumReviews\": \"\",\r\n\t\t\t\t\t\t\"productStarRating\": \"\"\r\n\t\t\t\t\t}]\r\n\t\t\t\t})\r\n\t\t\t\tsessionStorage.setItem('listType', recentforpageload.product[index].listType);\r\n\t\t\t\tsessionStorage.setItem('listName', recentforpageload.product[index].listName);\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// click on viewmore button\r\n\t\t.on(\"plpviewmore\", function (e) {\r\n\t\t\tif (getPageCategory() == \"Category Page\") {\r\n\t\t\t\tif (prodholder && typeof productData.product != undefined) {\r\n\t\t\t\t\tif (productData.page > 1) {\r\n\t\t\t\t\t\tprodholder = prodholder.concat(productData.product);\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tprodholder = prodholder[0].concat(productData.product);\r\n\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\tfor (var i = 0; i < prodholder.length; i++) {\r\n\t\t\t\t\t\tprodholder[i].position = i + 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tfor (var a = 0; a < productData.product.length; a++) {\r\n\t\t\t\t\t\tvar diff = productData.product.length - a;\r\n\t\t\t\t\t\tproductData.product[a].position = (prodholder.length - diff) + 1;\r\n\t\t\t\t\t}\r\n\t\t\t\t\tpushDtLayer({\r\n\t\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\t\"eeAction\": \"eeListView\",\r\n\t\t\t\t\t\t\"pageCategory\": searchItems.search ? \"Site Search\" : \"Product List Page\",\r\n\t\t\t\t\t\t\"dropDown\": \"\",\r\n\t\t\t\t\t\t\"filterChoice\": \"\",\r\n\t\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\t\"products\": productData.product || new Array()\r\n\t\t\t\t\t});\r\n\t\t\t\t}\r\n\t\t\t}\r\n\r\n\t\t})\r\n\t\t\r\n\t\t// tracking change on image in \r\n\t\t.on(\"afterChange\", \".product-thumbnails .slick-dotted\", function (e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"productInteraction\",\r\n\t\t\t\t\"productCategory\": getProductCategory(),\r\n\t\t\t\t\"productSubCategory\": getProductsubCategory(),\r\n\t\t\t\t\"productName\": getProductName(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"productId\": getProductID(),\r\n\t\t\t\t\"interactionType\": \"Image Change\"\r\n\r\n\t\t\t})\r\n\t\t})\r\n\t\t//tracking tab change event\r\n\t\t.on(\"click\", \".pdp-jump-links-wrapper .link-wrapper a\", function (e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"productInteraction\",\r\n\t\t\t\t\"productCategory\": getProductCategory(),\r\n\t\t\t\t\"productSubCategory\": getProductsubCategory(),\r\n\t\t\t\t\"productName\": getProductName(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"productId\": getProductID(),\r\n\t\t\t\t\"interactionType\": \"Change Tab\"\r\n\r\n\t\t\t})\r\n\t\t})\r\n\t\t\r\n\t\t//tracking 360 view click\r\n\t\t.on(\"click\", \".product-detail .360-img\", function (e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"productInteraction\",\r\n\t\t\t\t\"productCategory\": getProductCategory(),\r\n\t\t\t\t\"productSubCategory\": getProductsubCategory(),\r\n\t\t\t\t\"productName\": getProductName(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"productId\": getProductID(),\r\n\t\t\t\t\"interactionType\": \"360 view\"\r\n\r\n\t\t\t})\r\n\t\t})\r\n\t\t\r\n\t\t// click on next arrow recommendation carousel and best seller\r\n\t\t.on(\"click\", \".pi .carousel-recommendations .slick-next\", function (e) {\r\n\t\t\tif (typeof prodData != undefined && prodData != null) {\r\n\t\t\t\tvar array = new Array();\r\n\t\t\t\tvar listholder = new Array();\r\n\t\t\t\tvar listchecker = false;\r\n\t\t\t\tvar listctr = 0;\r\n\t\t\t\t$(\".recommendation-item\").each(function (index) {\r\n\t\t\t\t\tif ($(\".recommendation-item\").filter(\".slick-active\").length == 3) {\r\n\t\t\t\t\t\tif (index > 2 && $(this).hasClass(\"slick-active\")) {\r\n\t\t\t\t\t\t\tarray.push(index - 3);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (index > 2 && ($(this).hasClass(\"slick-active\") || $(this).hasClass(\"slick-current\"))) {\r\n\t\t\t\t\t\t\tlistctr = 2;\r\n\t\t\t\t\t\t\tif (prodData.product.length > 3) {\r\n\t\t\t\t\t\t\t\tlistchecker = true;\r\n\t\t\t\t\t\t\t\tlistctr = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tarray.push(index - 3);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (listchecker && listctr < 2 && index > 2 && array.length <= 3) {\r\n\t\t\t\t\t\t\t\tif (array[array.length] != index - 3) {\r\n\t\t\t\t\t\t\t\t\tlistctr += 1;\r\n\t\t\t\t\t\t\t\t\tarray.push(index - 3);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tlistchecker = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t\tfor (var i = 0; i < prodData.product.length; i++) {\r\n\t\t\t\t\tfor (var a = 0; a < array.length; a++) {\r\n\t\t\t\t\t\tif (i == array[a]) {\r\n\t\t\t\t\t\t\tlistholder.push(prodData.product[i]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\"eeAction\": \"eeListView\",\r\n\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"products\": listholder\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// click on prev arrow recommendation carousel and best seller\r\n\t\t.on(\"click\", \".pi .carousel-recommendations .slick-prev\", function (e) {\r\n\r\n\t\t\tif (typeof prodData != undefined && prodData != null) {\r\n\t\t\t\tvar array = new Array();\r\n\t\t\t\tvar listholder = new Array();\r\n\t\t\t\tvar listchecker = false;\r\n\t\t\t\tvar listctr = 0;\r\n\t\t\t\t$(\".recommendation-item\").each(function (index) {\r\n\t\t\t\t\tif ($(\".recommendation-item\").filter(\".slick-active\").length == 3) {\r\n\t\t\t\t\t\tif (index > 2 && $(this).hasClass(\"slick-active\")) {\r\n\t\t\t\t\t\t\tarray.push(index - 3);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t} else {\r\n\t\t\t\t\t\tif (index > 2 && ($(this).hasClass(\"slick-active\") || $(this).hasClass(\"slick-current\"))) {\r\n\t\t\t\t\t\t\tlistctr = 2;\r\n\t\t\t\t\t\t\tif (prodData.product.length > 3) {\r\n\t\t\t\t\t\t\t\tlistchecker = true;\r\n\t\t\t\t\t\t\t\tlistctr = 0;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\tarray.push(index - 3);\r\n\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\tif (listchecker && listctr < 2 && index > 2 && array.length <= 3) {\r\n\t\t\t\t\t\t\t\tif (array[array.length] != index - 3) {\r\n\t\t\t\t\t\t\t\t\tlistctr += 1;\r\n\t\t\t\t\t\t\t\t\tarray.push(index - 3);\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t} else {\r\n\t\t\t\t\t\t\t\tlistchecker = false;\r\n\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t}\r\n\r\n\r\n\t\t\t\t\t}\r\n\r\n\t\t\t\t});\r\n\t\t\t\tfor (var i = 0; i < prodData.product.length; i++) {\r\n\t\t\t\t\tfor (var a = 0; a < array.length; a++) {\r\n\t\t\t\t\t\tif (i == array[a]) {\r\n\t\t\t\t\t\t\tlistholder.push(prodData.product[i]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\"eeAction\": \"eeListView\",\r\n\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"products\": listholder\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// click on next arrow recently viewed\r\n\t\t.on(\"click\", \".cross-sell .carousel-recommendations .slick-next\", function (e) {\r\n\r\n\t\t\tif (typeof prodData != undefined && prodData != null) {\r\n\t\t\t\tvar array = new Array();\r\n\t\t\t\tvar listholder = new Array();\r\n\t\t\t\t$(\".recommendation-item\").each(function (index) {\r\n\t\t\t\t\tif (index > 2 && $(this).hasClass(\"slick-active\")) {\r\n\t\t\t\t\t\tarray.push(index - 3);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tfor (var i = 0; i < prodData.product.length; i++) {\r\n\t\t\t\t\tfor (var a = 0; a < array.length; a++) {\r\n\t\t\t\t\t\tif (i == array[a]) {\r\n\t\t\t\t\t\t\tlistholder.push(prodData.product[i]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\"eeAction\": \"eeListView\",\r\n\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"products\": listholder\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// click on next arrow recently viewed\r\n\t\t.on(\"click\", \".cross-sell .carousel-recommendations .slick-prev\", function (e) {\r\n\r\n\t\t\tif (typeof prodData != undefined && prodData != null) {\r\n\t\t\t\tvar array = new Array();\r\n\t\t\t\tvar listholder = new Array();\r\n\t\t\t\t$(\".recommendation-item\").each(function (index) {\r\n\t\t\t\t\tif (index > 2 && $(this).hasClass(\"slick-active\")) {\r\n\t\t\t\t\t\tarray.push(index - 3);\r\n\t\t\t\t\t}\r\n\t\t\t\t});\r\n\t\t\t\tfor (var i = 0; i < prodData.product.length; i++) {\r\n\t\t\t\t\tfor (var a = 0; a < array.length; a++) {\r\n\t\t\t\t\t\tif (i == array[a]) {\r\n\t\t\t\t\t\t\tlistholder.push(prodData.product[i]);\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t}\r\n\t\t\t\t}\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\"eeAction\": \"eeListView\",\r\n\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"products\": listholder\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t// pdp fire when variation was change\r\n\t\t.on(\"gtvariationchange\", function (e) {\r\n\t\t\tif (getPageCategory() == \"Product Page\") {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"eeAction\": \"eeProductDetail\",\r\n\t\t\t\t\t\"event\": \"eeProductDetail\",\r\n\t\t\t\t\t\"pageCategory\": \"Product Page\",\r\n\t\t\t\t\t'products': [{\r\n\t\t\t\t\t\t\"listType\": sessionStorage.getItem('listType'),\r\n\t\t\t\t\t\t\"listName\": sessionStorage.getItem('listName'),\r\n\t\t\t\t\t\t\"id\": pdpdata.ID,\r\n\t\t\t\t\t\t\"productVariantID\": pdpdata.master ? pdpdata.defalutvariant : pdpdata.ID,\r\n\t\t\t\t\t\t\"category\": pdpdata.catid,\r\n\t\t\t\t\t\t\"price\": pdpdata.pricing.sale ? pdpdata.pricing.sale : pdpdata.pricing.minprice,\r\n\t\t\t\t\t\t\"name\": pdpdata.name,\r\n\t\t\t\t\t\t\"brand\": pdpdata.brand,\r\n\t\t\t\t\t\t\"quantity\": pdpdata.quantity,\r\n\t\t\t\t\t\t\"size\": pdpdata.size,\r\n\t\t\t\t\t\t\"subCategory\": pdpdata.subcategory,\r\n\t\t\t\t\t\t\"subSubCategory\": pdpdata.subsubcategory,\r\n\t\t\t\t\t\t\"productAutoReplen\": pdpdata.productautoreplenish,\r\n\t\t\t\t\t\t\"productOutOfStock\": pdpdata.productOutOfStock,\r\n\t\t\t\t\t\t\"productColor\": pdpdata.productColor,\r\n\t\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\t\"collectionName\": pdpdata.customBrand,\r\n\t\t\t\t\t\t\"productNumReviews\": pdpdata.productNumReviews,\r\n\t\t\t\t\t\t\"productStarRating\": pdpdata.productStarRating\r\n\t\t\t\t\t}]\r\n\t\t\t\t})\r\n\t\t\t}\r\n\r\n\t\t})\r\n\r\n\t\t// Variation change on product tile\r\n\t\t.on(\"gttilevariationchange\", function (e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t'products': [{\r\n\t\t\t\t\t\"listType\": sessionStorage.getItem('listType'),\r\n\t\t\t\t\t\"listName\": sessionStorage.getItem('listName'),\r\n\t\t\t\t\t\"id\": tileVariantData.ID,\r\n\t\t\t\t\t\"productVariantID\": tileVariantData.master ? tileVariantData.defalutvariant : tileVariantData.ID,\r\n\t\t\t\t\t\"category\": tileVariantData.catid,\r\n\t\t\t\t\t\"price\": tileVariantData.pricing.sale ? tileVariantData.pricing.sale : tileVariantData.pricing.minprice,\r\n\t\t\t\t\t\"name\": tileVariantData.name,\r\n\t\t\t\t\t\"brand\": tileVariantData.brand,\r\n\t\t\t\t\t\"quantity\": tileVariantData.quantity,\r\n\t\t\t\t\t\"size\": tileVariantData.size,\r\n\t\t\t\t\t\"subCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\t\"subSubCategory\": tileVariantData.subsubcategory,\r\n\t\t\t\t\t\"productAutoReplen\": tileVariantData.productautoreplenish,\r\n\t\t\t\t\t\"productOutOfStock\": tileVariantData.productOutOfStock,\r\n\t\t\t\t\t\"productColor\": tileVariantData.productColor,\r\n\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\"collectionName\": tileVariantData.customBrand,\r\n\t\t\t\t\t\"productNumReviews\": tileVariantData.productNumReviews,\r\n\t\t\t\t\t\"productStarRating\": tileVariantData.productStarRating\r\n\t\t\t\t}]\r\n\t\t\t})\r\n\r\n\t\t})\r\n\r\n\t\t//PLP filter change\r\n\t\t.on(\"selectmenuchange\", \".top-filter select\", function (event, ui) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"dropDownChoice\",\r\n\t\t\t\t\"dropDownType\": event.target[0].label.trim(),\r\n\t\t\t\t\"filterChoice\": ui.item.label.trim(),\r\n\t\t\t\t\"listType\": \"Product Category List\",\r\n\t\t\t\t\"listName\": $(\".breadcrumb\").find(\".breadcrumb-element:last\").text().trim() + \">\" + ui.item.label.trim()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// \tSort By in Makeup in PLP \t\t\r\n\t\t.on(\"selectmenuchange\", \".sort-by select\", function (event, ui) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"dropDownChoice\",\r\n\t\t\t\t\"dropDownType\": \"Sort By\",\r\n\t\t\t\t\"filterChoice\": ui.item.label.trim(),\r\n\t\t\t\t\"listType\": \"Product Category List\",\r\n\t\t\t\t\"listName\": $(\".breadcrumb\").find(\".breadcrumb-element:last\").text().trim() + \">\" + ui.item.label.trim()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// \trelated articles\t\r\n\t\t.on('click', '.related-article-sec .related-article-content', function (e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"relatedArticle\",\r\n\t\t\t\t\"page\": $(this).children('a').text().trim(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"pageCategory\": $('.container .article-full-col h1').text().trim()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// \tArticle details product image click\r\n\t\t.on('click', '.article-content-section .product-tile .thumb-link', function (e) {\r\n\t\t\tvar $productTile = $(this).parents(\".product-tile\");\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"shopTheArticle\",\r\n\t\t\t\t\"productName\": $productTile.find('.product-name').text().trim(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"pageCategory\": $('.container .article-full-col h1').text().trim()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// \tArticle details product name click\r\n\t\t.on('click', '.article-content-section .product-tile .name-link', function (e) {\r\n\t\t\tvar $productTile = $(this).parents(\".product-tile\");\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"shopTheArticle\",\r\n\t\t\t\t\"productName\": $productTile.find('.product-name').text().trim(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"pageCategory\": $('.container .article-full-col h1').text().trim()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t// \tArticle details product view details click\t\r\n\t\t.on('click', '.article-content-section .product-tile .buy-button', function (e) {\r\n\t\t\tvar $productTile = $(this).parents(\".product-tile\");\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"shopTheArticle\",\r\n\t\t\t\t\"productName\": $productTile.find('.product-name').text().trim(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"pageCategory\": $('.container .article-full-col h1').text().trim()\r\n\t\t\t});\r\n\t\t})\r\n\r\n\t\t.on('click', '.search-result-content .product-tile-wrapper.product-grid', function (e) {\r\n\t\t\tif ($('.container .article-full-col h1').length < 1) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"shopTheArticle\",\r\n\t\t\t\t\t\"productName\": $(this).find('.product-name').text().trim(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t})\r\n\r\n\t\t//Add to cart from various pages\r\n\t\t.on('click', \".product-tile-inner .add-to-cart\", function (e) {\r\n\t\t\tvar $gtmProductTile = $(this).parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"currencyCode\": window.Resources.CURRENCY,\r\n\t\t\t\t\t\"event\": \"addToCart\",\r\n\t\t\t\t\t\"productOrderType\": getProductOrederType(),\r\n\t\t\t\t\t\"addToCartType\": getPageCategory(),\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\t'products': [{\r\n\t\t\t\t\t\t\"id\": tileVariantData.master ? tileVariantData.masterID : tileVariantData.ID,\r\n\t\t\t\t\t\t\"productVariantID\": tileVariantData.ID,\r\n\t\t\t\t\t\t\"category\": tileVariantData.catid,\r\n\t\t\t\t\t\t\"price\": tileVariantData.pricing.sale ? tileVariantData.pricing.sale : tileVariantData.pricing.minprice,\r\n\t\t\t\t\t\t\"name\": tileVariantData.name,\r\n\t\t\t\t\t\t\"brand\": tileVariantData.brand,\r\n\t\t\t\t\t\t\"quantity\": $(this).parents(\".product-tile\").find('.quantity select').val(),\r\n\t\t\t\t\t\t\"size\": tileVariantData.size,\r\n\t\t\t\t\t\t\"subCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\t\t\"subSubCategory\": tileVariantData.subsubcategory,\r\n\t\t\t\t\t\t\"productAutoReplen\": tileVariantData.productautoreplenish,\r\n\t\t\t\t\t\t\"productOutOfStock\": tileVariantData.productOutOfStock,\r\n\t\t\t\t\t\t\"productColor\": tileVariantData.productColor,\r\n\t\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\t\"collectionName\": tileVariantData.customBrand,\r\n\t\t\t\t\t\t\"productNumReviews\": tileVariantData.productNumReviews,\r\n\t\t\t\t\t\t\"productStarRating\": tileVariantData.productStarRating\r\n\t\t\t\t\t}]\r\n\t\t\t\t});\r\n\t\t})\r\n\t\t//Foundation Finder Page Interaction\r\n\t\t.on('click', '.foundation-finder-buttons button',function(e) {\r\n\t\t\tvar selectedValue = $('input[name=\"selectedanswer\"]').val();\r\n\t\t\t\r\n\t\t\tif ($('#question-0').length) {\r\n\t\t\t\tvar $skinTone = $('input.title').val();\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"foundationFinderStep1\",\r\n\t\t\t\t\t\"skinTone\": $skinTone,\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t});\r\n\t\t\t} else if ($('#question-1').length) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"foundationFinderStep2\",\r\n\t\t\t\t\t\"skinUnderTone\": selectedValue,\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t});\r\n\t\t\t} else if ($('#question-2').length) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"foundationFinderStep3\",\r\n\t\t\t\t\t\"preferredCoverage\": selectedValue,\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t});\r\n\t\t\t} else if ($('#question-3').length) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"foundationFinderStep4\",\r\n\t\t\t\t\t\"preferredFinish\": selectedValue,\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t});\r\n\t\t\t} else if ($('#question-4').length) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"foundationFinderStep5\",\r\n\t\t\t\t\t\"foundationBenefit\": selectedValue,\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t\r\n\t\t})\r\n\t\t.on('click','.try-it-on', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\"event\": \"arTryOnNow\",\r\n\t\t\t\"productCategory\": pdpdata.catid,\r\n\t\t\t\"productSubCategory\": pdpdata.subcategory,\r\n\t\t\t\"productName\": pdpdata.name,\r\n\t\t\t\"productId\": pdpdata.ID,\r\n\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click','.choose-a-shade', function(event) {\r\n\t\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\"event\": \"arTryOnNowContinue\",\r\n\t\t\t\"productCategory\": pdpdata.catid,\r\n\t\t\t\"productSubCategory\": pdpdata.subcategory,\r\n\t\t\t\"productName\": pdpdata.name,\r\n\t\t\t\"productId\": pdpdata.ID,\r\n\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click', '.upload-image-link', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"arTryOnNowUploadPhoto\",\r\n\t\t\t\t\"productCategory\": pdpdata.catid,\r\n\t\t\t\t\"productSubCategory\": pdpdata.subcategory,\r\n\t\t\t\t\"productName\": pdpdata.name,\r\n\t\t\t\t\"productId\": pdpdata.ID,\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click', '#cropImageBtn, .choose-a-shade', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"virtualPageView\",\r\n\t\t\t\t\"page\": getpage(),\r\n\t\t\t\t\"pageError\": getPageError(),\r\n\t\t\t\t\"userId\": userid,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click', '.arTryOnBtnWrapper #triggerBtn', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"arTryOnMenu\",\r\n\t\t\t\t\"productCategory\": pdpdata.catid,\r\n\t\t\t\t\"productSubCategory\": pdpdata.subcategory,\r\n\t\t\t\t\"productName\": pdpdata.name,\r\n\t\t\t\t\"productId\": $('#multiSplit').hasClass('active') ? getGiaranQuadViewValues()['productIdArr'] : pdpdata.ID,\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click', '#canvasDownload, #uploadPhoto, #normalView, #beforeAfter, #multiSplit, #liveCamera, #uploadNewPhoto', function(e) {\r\n\t\t\tvar clickEvent = $(e.target).closest('button');\r\n\t\t\tvar $arInteraction=\"\";\r\n\t\t\tvar productID;\r\n\t\t\tswitch(clickEvent.attr('id')){\r\n\t\t\tcase 'canvasDownload' :\r\n\t\t\t\t$arInteraction = 'Download Image';\r\n\t\t\t\tproductID = $('#multiSplit').hasClass('active') ? getGiaranQuadViewValues()['productIdArr'] : pdpdata.ID\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'uploadPhoto' :\r\n\t\t\tcase 'uploadNewPhoto' :\r\n\t\t\tcase 'liveCamera' :\r\n\t\t\t\t$arInteraction = clickEvent.html();\r\n\t\t\t\tproductID = $('#multiSplit').hasClass('active') ? getGiaranQuadViewValues()['productIdArr'] : pdpdata.ID\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'normalView' :\r\n\t\t\t\t$arInteraction = 'Single Mode';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'beforeAfter' :\r\n\t\t\t\t$arInteraction = 'Dual Mode';\r\n\t\t\t\tbreak;\r\n\t\t\tcase 'multiSplit' :\r\n\t\t\t\t$arInteraction = 'Quad Mode';\r\n\t\t\t\tbreak;\r\n\t\t\tdefault :\r\n\t\t\t\tbreak;\r\n\t\t\t}\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"arTryOnInteraction\",\r\n\t\t\t\t\"interactionType\" : $arInteraction,\r\n\t\t\t\t\"productCategory\": pdpdata.catid,\r\n\t\t\t\t\"productSubCategory\": pdpdata.subcategory,\r\n\t\t\t\t\"productName\": pdpdata.name,\r\n\t\t\t\t\"productId\": productID ? productID : pdpdata.ID,\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click', '#liveCamera', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"virtualPageView\",\r\n\t\t\t\t\"page\": getpage(),\r\n\t\t\t\t\"pageError\": getPageError(),\r\n\t\t\t\t\"userId\": userid,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click', '.product-detail .swatchanchor', function(e) {\r\n\t\t\tif ($('button#multiSplit').hasClass('active')) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"arTryOnQuadViewAddColor\",\r\n\t\t\t\t\t\"productColor\" : $(this).data('color').toString(),\r\n\t\t\t\t\t\"productCategory\": pdpdata.catid,\r\n\t\t\t\t\t\"productSubCategory\": pdpdata.subcategory,\r\n\t\t\t\t\t\"productName\": pdpdata.name,\r\n\t\t\t\t\t\"productId\": $(this).data('pid').toString(),\r\n\t\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t})\r\n\t\t.on('click', '.addToBag-wrapper .addToBag', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\"event\": \"addToCart\",\r\n\t\t\t\t\"addToCartType\": \"AR Try On\",\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t'products': $('#multiSplit').hasClass('active') ? getGiaranQuadViewValues()['products'] : [{\r\n\t\t\t\t\t\"id\": pdpdata.masterID,\r\n\t\t\t\t\t\"category\": pdpdata.catid,\r\n\t\t\t\t\t\"price\": pdpdata.pricing.sale ? pdpdata.pricing.sale : pdpdata.pricing.minprice, \r\n\t\t\t\t\t\"name\": pdpdata.name,\r\n\t\t\t\t\t\"brand\": pdpdata.brand,\r\n\t\t\t\t\t\"quantity\": pdpdata.quantity,\r\n\t\t\t\t\t\"size\": pdpdata.size,\r\n\t\t\t\t\t\"subCategory\" : pdpdata.subcategory,\r\n\t\t\t\t\t\"subSubCategory\" : pdpdata.subsubcategory,\r\n\t\t\t\t\t\"productAutoReplen\": pdpdata.productautoreplenish,\r\n\t\t\t\t\t\"productOutOfStock\": pdpdata.productOutOfStock,\r\n\t\t\t\t\t\"productColor\": pdpdata.productColor,\r\n\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\"productVariantID\": pdpdata.ID, \r\n\t\t\t\t\t\"collectionName\": pdpdata.customBrand,\r\n\t\t\t\t\t\"productNumReviews\": pdpdata.productNumReviews,\r\n\t\t\t\t\t\"productStarRating\": pdpdata.productStarRating,\r\n\t\t\t\t\t\"productOrderType\": getProductOrederType()\r\n\t\t\t\t}]\r\n\t\t\t\t\r\n\t\t\t})\r\n\r\n\t\t})\r\n\t\t.on('click', '.addall-fav, .add-fav', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"clickSaveForLaterArTryOn\",\r\n\t\t\t\t\"productCategory\": pdpdata.catid,\r\n\t\t\t\t\"productSubCategory\": pdpdata.subcategory,\r\n\t\t\t\t\"productName\": pdpdata.name,\r\n\t\t\t\t\"productId\": $('#multiSplit').hasClass('active') ? getGiaranQuadViewValues()['productIdArr'] : pdpdata.ID,\r\n\t\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click', '.try-it-on.exitEnabled, .close-try-it-on', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"exitArTryOn\",\r\n\t\t\t\t\"productCategory\": pdpdata.catid,\r\n\t\t\t\t\"productSubCategory\": pdpdata.subcategory,\r\n\t\t\t\t\"productName\": pdpdata.name,\r\n\t\t\t\t\"productId\": $('#multiSplit').hasClass('active') ? getGiaranQuadViewValues()['productIdArr'] : pdpdata.ID,\r\n\t\t\t\t\"pageCategory\": getPageCategory() \r\n\t\t\t})\r\n\t\t})\t\r\n\t\t//Navigation Interaction\r\n\t\t.on('click','.nav-container a', function(e) {\r\n\t\t\tvar navArr = [];\r\n\t\t\tvar navLocation = $(this).closest('nav ul');\r\n\t\t\tvar $navigationLocationClicked = getNavLocation(navLocation);\r\n\t\t\tif ($navigationLocationClicked === 'Top Menu') {\r\n\t\t\t\tvar catName = $(this).attr('name')\r\n\t\t\t\tnavArr.push(catName);\r\n\t\t\t\tvar parentCat = $(this).closest('ul.sub-menu');\r\n\t\t\t\tif (parentCat.length) {\r\n\t\t\t\t\tvar parentCatName = parentCat.attr('data-parentCat');\r\n\t\t\t\t\tif (catName != parentCatName)\r\n\t\t\t\t\t\tnavArr.push(parentCatName);\r\n\t\t\t\t\tvar grandParent = parentCat.parent();\r\n\t\t\t\t\tvar grandParentCat = grandParent.closest('ul.sub-menu');\r\n\t\t\t\t\tif (grandParentCat.length) {\r\n\t\t\t\t\t\tvar grandParentCatName = grandParentCat.attr('data-parentCat');\r\n\t\t\t\t\t\tif (grandParentCatName != parentCatName) {\r\n\t\t\t\t\t\t\tnavArr.push(grandParentCatName);\r\n\t\t\t\t\t\t} \r\n\t\t\t\t\t}\r\n\t\t\t\t\t\r\n\t\t\t\t}\r\n\t\t\t\tnavArr.reverse();\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif(!($(this).closest('.mini-cart-content').length > 0 || $(this).closest('.signin-overlay').length > 0)) {\r\n\t\t\t\t//the push must be placed after the gtm.js container call\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"navigationMenuClick\",\r\n\t\t\t\t\t\"navigationLocationClicked\": $navigationLocationClicked,\r\n\t\t\t\t\t\"navigationLinkNameClicked\": navArr.length > 0 ? navArr.join(',') : $(this).attr('name'),\r\n\t\t\t\t\t\"userId\": userid,\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t})\r\n\t\t\r\n\t\t//carousel Interaction\r\n\t\t.on('click', '#homepage-hero a', function(e) {\r\n\t\t\tvar navigationLink = $(this).closest('.slide-wrapper');\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"carouselClick\",\r\n\t\t\t\t\"navigationLinkNameClicked\": navigationLink ? navigationLink.attr('data-name') : '',\r\n\t\t\t\t\"userId\": userid,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t})\r\n\t\t})\r\n\t\t\r\n\t\t//Home Page Hero Carousel\r\n\t\t.on('click', '#homepage-hero button,.slick-dots li', function(e) {\r\n\t\t\tvar $carouselTitle = $('#homepage-hero .slick-slide.slick-active img').attr('alt');\r\n\t\t\t//the push must be placed after the gtm.js container call\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"carouselChangeImage\",\r\n\t\t\t\t\"carouselTitle\": $carouselTitle,\r\n\t\t\t\t\"userId\": userid,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t})\r\n\t\t})\r\n\r\n\t\t//Home Page Hero Carousel Click\r\n\t\t.on('click', '#homepage-hero a', function(e) {\r\n\t\t\te.preventDefault();\r\n\t\t\tvar $promoPosition = $('#homepage-hero').slick('slickCurrentSlide') + 1;\r\n\t\t\tvar $promoId = $('#homepage-hero .slick-slide.slick-active .hero-slide').attr('data-promotion_id');\r\n\t\t\tvar $promoName = $('#homepage-hero .slick-slide.slick-active .hero-slide').attr('data-promotion_name');\r\n\t\t\tvar $nextPage = $('#homepage-hero .slick-slide.slick-active .hero-slide a').attr('href');\r\n\t\t\tif($promoId && $promoName) {\r\n\t\t\t\twindow.dataLayer.push({\r\n\t\t\t\t\t\"event\": \"eePromoClick\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\t'promotions': [{\r\n\t\t\t\t\t\t\"id\": $promoId,\r\n\t\t\t\t\t\t\"name\": $promoName,\r\n\t\t\t\t\t\t\"creative\": \"summer_banner2\",\r\n\t\t\t\t\t\t\"position\": $promoPosition\r\n\t\t\t\t\t}]\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t\tsetTimeout(function() {\r\n\t\t\t\tdocument.location = $nextPage;\r\n\t\t\t}, 5000);\r\n\t\t})\r\n\r\n\t\t//Home Page Skin Care Best Sellers Product Click\r\n\t\t.on(\"click\", \".homepage-container .gaClickEvent .thumb-link, .homepage-container .gaClickEvent .name-link\", function (e) {\r\n\t\t\te.preventDefault();\r\n\t\t\tvar $gtmProductTile = $(this).parents(\".product-tile\").find('.gtm-product-tile');\r\n\t\t\tvar tileVariantData = $gtmProductTile.data('value');\r\n\t\t\tvar index = $(this).parents(\".recommendation-item\").index()+1;\r\n\t\t\twindow.dataLayer.push({\r\n\t\t\t\"event\": \"eeListClick\",\r\n\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t'products': [{\r\n\t\t\t\t\"listType\": 'product category list',\r\n\t\t\t\t\"listName\": 'Best Sellers',\r\n\t\t\t\t\"position\": index,\r\n\t\t\t\t\"id\": tileVariantData.ID,\r\n\t\t\t\t\"category\": tileVariantData.catid,\r\n\t\t\t\t\"price\": tileVariantData.pricing.sale ? tileVariantData.pricing.sale : tileVariantData.pricing.minprice,\r\n\t\t\t\t\"name\": tileVariantData.name,\r\n\t\t\t\t\"brand\": tileVariantData.brand,\r\n\t\t\t\t\"quantity\": tileVariantData.quantity,\r\n\t\t\t\t\"size\": tileVariantData.size,\r\n\t\t\t\t\"subCategory\": tileVariantData.subcategory,\r\n\t\t\t\t\"subSubCategory\": tileVariantData.subsubcategory,\r\n\t\t\t\t\"productAutoReplen\": tileVariantData.productautoreplenish,\r\n\t\t\t\t\"productOutOfStock\": tileVariantData.productOutOfStock,\r\n\t\t\t\t\"productColor\": tileVariantData.productColor,\r\n\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\"productVariantID\": tileVariantData.master ? tileVariantData.defalutvariant : tileVariantData.ID,\r\n\t\t\t\t\"collectionName\": tileVariantData.customBrand\r\n\t\t\t\t}]\r\n\t\t\t})\r\n\t\t\tvar $nextPage = $(this).attr('href');\r\n\t\t\tsetTimeout(function() {\r\n\t\t\t\tdocument.location = $nextPage;\r\n\t\t\t}, 1000);\r\n\t\t})\r\n\r\n\t\t// Search Clear Text and Cancel\r\n\t\t.on('click', '.header-search .search-inner .cancel-btn', function(e) {\r\n\t\t\tvar event = $('.header-search .close-wrapper').hasClass('clicked') ? \"siteSearchCancel\" : \"siteSearchClear\"\r\n\t\t\t\r\n\t\t\t//the push must be placed after the gtm.js container call\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": event,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t})\r\n\t\t})\r\n\t\t.on('click', '.header-search .close-wrapper', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"siteSearchCancel\",\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"language\": getLanguage(),\r\n\t\t\t\t\"websiteCountry\": getCountry()\r\n\t\t\t})\r\n\t\t})\r\n\r\n\t\t//promotional banner message- top & bottom\r\n\t\t.on('click', '.top-notification .top-banner-message a, .bottom-notification-message .custom-message a', function(e) {\r\n\t\t\t//the push must be placed before the gtm.js container call\r\n\t\t\tpushToDataLayer({\t\t\t\t\t\r\n\t\t\t\t\"event\": \"eePromoClick\",\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t'promotions': [{\r\n\t\t\t\t\"position\": $(this).closest('.custom-message').attr('data-position') || '',\r\n\t\t\t\t\"id\": $(this).closest('.custom-message').attr('data-id') || '',\r\n\t\t\t\t\"creative\": $(this).closest('.custom-message').attr('data-creative') || '',\r\n\t\t\t\t\"name\": $(this).closest('.custom-message').attr('data-name') || ''\r\n\t\t\t\t}]\r\n\t\t\t})\r\n\t\t\tsetTimeout(function(){\r\n\t\t\t\tdocument.location = $(this).href;\r\n\t\t\t\t}, 1000);\r\n\t\t})\r\n\t\t.on('scroll', function() {\r\n\t\t\tpromotionView();\r\n\t\t})\r\n\t\t\r\n\t\t//add to Cart for sample\r\n\t\t.on('click', '.sample-bonus-add-to-cart', function(e) {\r\n\t\t\tvar $this = $(this);\r\n\t\t\tvar sampleBonusIds = $('input[data-button=sample-bonus-add-to-cart]').val();\r\n\t\t\tvar sampleBonusIdsArr = sampleBonusIds.split(',');\r\n\t\t\tvar products=[];\r\n\t\t\t$.each(sampleBonusIdsArr,function(index,value){\r\n\t\t\t\tvar product= {};\r\n\t\t\t\tvar productJsonEle = $('.sample-bonus-contents .product-tile[data-itemid='+value+']');\r\n\t\t\t\tvar productJson = productJsonEle.find('input').data('value');\r\n\t\t\t\tproduct = getProdListData(productJson)\r\n\t\t\t\tif ($this[0].id === 'samples-add-to-cart')\r\n\t\t\t\t\tproduct.productType = 'Sample';\r\n\t\t\t\telse\r\n\t\t\t\t\tproduct.productType = 'Bonus Product';\r\n\t\t\t\tproducts.push(product);\r\n\t\t\t\t\r\n\t\t\t});\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"currencyCode\": window.Resources.CURRENCY,\r\n\t\t\t\t\"event\": \"addToCart\",\r\n\t\t\t\t\"addToCartType\": \"Sample Bonus Modal\",\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t'products': products\r\n\t\t\t});\r\n\t\t})\r\n\t\t\r\n\t\t//cart page Contact us link\r\n\t\t.on('click', '.contact-us-link', function(e) {\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\"event\": \"contactRequest\",\r\n\t\t\t\"contactType\": \"Customer Care\",\r\n\t\t\t\"siteLocation\": getPageSubcategory(),\r\n\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\"pageCategory\": getPageCategory()\r\n\t\t\t})\r\n\t\t})\r\n\t\t\r\n\t\t.on('click', '.spcBillingContinueBtn', function(e) {\r\n\t\t\t//the pageview push must be placed after the gtm.js container call\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\" : \"virtualPageview\",\r\n\t\t\t\t\"eeAction\": \"eeCheckout\",\r\n\t\t\t\t\"checkoutStep\": \"5\",\r\n\t\t\t\t\"funnelType\": basketConfirmation.funnelType,\r\n\t\t\t\t\"giftWrapping\": basketConfirmation.giftWrapping,\r\n\t\t\t\t\"checkoutErrorMessage\": basketConfirmation.checkoutErrorMessage,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"products\": basketConfirmation.productLineItems\r\n\t\t\t})\r\n\t\t\t//the event push must be placed after the gtm.js container call\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\"event\": \"eeCheckoutOption\",\r\n\t\t\t\"checkoutStep\": \"4\",\r\n\t\t\t\"checkoutOption\": \"CREDIT_CARD\"\r\n\t\t\t})\r\n\r\n\t\t})\r\n\t\t\r\n\t\t.on('click', '.spcReviewSummaryContinueBtn', function(e) {\r\n\t\t\t//the pageview push must be placed before the gtm.js container call\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\" : \"virtualPageview\",\r\n\t\t\t\t\"eeAction\": \"eeCheckout\",\r\n\t\t\t\t\"checkoutStep\": \"6\",\r\n\t\t\t\t\"funnelType\": basketConfirmation.funnelType,\r\n\t\t\t\t\"giftWrapping\": basketConfirmation.giftWrapping,\r\n\t\t\t\t\"checkoutErrorMessage\": basketConfirmation.checkoutErrorMessage,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t\t\"products\": basketConfirmation.productLineItems\r\n\t\t\t})\r\n\t\t})\r\n\t\t\r\n\t\t.on('click','.minicart-close, .remove-link-wrapper, .minicart-sample-action, .mini-cart-totals, .mini-cart-name, mini-cart-image', function(e) {\r\n\t\t\tvar interactionType;\r\n\t\t\tif ($(this).hasClass('minicart-close')){\r\n\t\t\t\tinteractionType = 'Close';\r\n\t\t\t} else if ($(this).hasClass('remove-link-wrapper')) {\r\n\t\t\t\tinteractionType = 'Remove';\r\n\t\t\t} else if ($(this).hasClass('minicart-sample-action')) {\r\n\t\t\t\tinteractionType = 'Choose Samples';\r\n\t\t\t} else if ($(this).hasClass('mini-cart-totals')) {\r\n\t\t\t\tinteractionType = 'View Shopping Bag';\r\n\t\t\t} else if ($(this).hasClass('mini-cart-name') || eventClass.contains('mini-cart-name')) {\r\n\t\t\t\tinteractionType = 'View Product';\r\n\t\t\t}\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"cartHoverInteraction\",\r\n\t\t\t\t\"interactionType\" : interactionType, // View Shopping Cart, Choose Samples, Close\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t})\r\n\r\n\t\t})\r\n\t\t\r\n\t\t.on('click', 'button.cart-checkout-button', function (e) {\r\n\t\t\tif($('a#selectsample').attr('data-id')=='link-cart-sampleSelect') {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"noSampleNoticeImpression\",\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t})\r\n\t\t\r\n\t\t.on('click', ' #missed-samples-modal .modal-close', function(e) {\r\n\t\t\tvar interactionType;\r\n\t\t\tif ($(this).hasClass('modal-btn-select-sample')){\r\n\t\t\t\tinteractionType = 'Choose Samples';\r\n\t\t\t} else if ($(this).hasClass('modal-btn-proceed-checkout')){\r\n\t\t\t\tinteractionType = 'Continue to Checkout';\r\n\t\t\t} else if ($(this).hasClass('icon-close')){\r\n\t\t\t\tinteractionType = 'Close';\r\n\t\t\t}\r\n\t\t\tpushToDataLayer({\r\n\t\t\t\t\"event\": \"noSampleNoticeClick\",\r\n\t\t\t\t\"interactionType\": interactionType,\r\n\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t})\t\r\n\t\t})\r\n\t\t\r\n\t\t.on('click', '.icon-more-info, .icon-sample-close', function(e) {\r\n\t\t\tvar interactionType;\r\n\t\t\tif ($(this).hasClass('icon-more-info')){\r\n\t\t\t\tinteractionType = 'More info';\r\n\t\t\t} else if ($(this).hasClass('icon-sample-close')){\r\n\t\t\t\tinteractionType = 'Close more info';\r\n\t\t\t}\r\n\t\t\tif ($(this).parents().hasClass('sample-body')) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"samplePopupInteraction\",\r\n\t\t\t\t\t\"interactionType\" : interactionType, // More Info, Select sample, Unselect sample\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t})\r\n\t\t\t} else if ($(this).parents().hasClass('bonus-body')) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"bonusPopupInteraction\",\r\n\t\t\t\t\t\"interactionType\" : interactionType, // More Info, Select sample, Unselect sample\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t})\r\n\t\t\t\t\r\n\t\t.on('click', '.sample-bonus-contents .product-tile-wrapper', function(e) {\r\n\t\t\tvar interactionType;\r\n\t\t\tif ($(this).find('button.remove').length > 0) {\r\n\t\t\t\tinteractionType = \"Select sample\"\r\n\t\t\t} else {\r\n\t\t\t\tinteractionType = \"Unselect sample\"\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif ($(this).parents().hasClass('sample-body')) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"samplePopupInteraction\",\r\n\t\t\t\t\t\"interactionType\" : interactionType, // More Info, Select sample, Unselect sample\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t})\r\n\t\t\t} else if ($(this).parents().hasClass('bonus-body')) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"bonusPopupInteraction\",\r\n\t\t\t\t\t\"interactionType\" : interactionType, // More Info, Select sample, Unselect sample\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t})\r\n\t\t\t}\r\n\r\n\t\t})\r\n\t\t\r\n\t\t.on('click', '.payment-method-header', function(e) {\r\n\t\t\tvar paymentGateway;\r\n\t\t\tif ($(this).hasClass('paypal')){\r\n\t\t\t\tpaymentGateway = \"PayPal\";\r\n\t\t\t} else if ($(this).hasClass('afterpay')){\r\n\t\t\t\tpaymentGateway = \"Afterpay\";\r\n\t\t\t} else if ($(this).hasClass('applepay')){\r\n\t\t\t\tpaymentGateway = \"ApplePay\";\r\n\t\t\t} else if ($(this).hasClass('gift-card-title')) {\r\n\t\t\t\tpaymentGateway = \"GiftCard\";\r\n\t\t\t}\r\n\t\t\t\r\n\t\t\tif (paymentGateway) {\r\n\t\t\t\tpushToDataLayer({\r\n\t\t\t\t\t\"event\": \"thirdPartyCheckout\",\r\n\t\t\t\t\t\"paymentGateway\" : paymentGateway, // PayPal, Afterpay\r\n\t\t\t\t\t\"pageCategory\": getPageCategory(),\r\n\t\t\t\t\t\"pageSubCategory\": getPageSubcategory()\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t})\t\t\r\n\t}\r\n\r\n\twindow.addEventListener('load', function () {\r\n\t\tif(gtCurPage == 'visualizer-getanalysisresult'){\r\n\t\t\tvar resultDate = $('.visualizerResultDateslider .slide.active a').data('resultdate'); \r\n\t\t\tvar nowDate = new Date(resultDate);\r\n\t\t\tvar date = nowDate.getFullYear()+'.'+(nowDate.getMonth()+1)+'.'+nowDate.getDate(); \r\n\t\t\tvar overallResult = $('.visualizerResultDateslider .slide.active a').data('overallscore');\r\n\t\t\tpushDtLayer({\r\n\t\t\t\t\"event\": \"consultationResult\", \r\n\t\t\t\t\"consultationToolType\": \"Skin Visualizer\", \r\n\t\t\t\t\"overallResult\": overallResult, \r\n\t\t\t\t\"resultDate\": date \r\n\t\t\t})\r\n\t\t}\r\n\t})\r\n\r\n\twindow.addEventListener('load', function () {\r\n\t\tif (gtCurPage == 'default-start' || gtCurPage == 'home-show') {\r\n\t\t\tvar $activeSlide = $('#homepage-hero .slick-slide.slick-active');\r\n\t\t\tvar $promoId = $activeSlide.find('.hero-slide').attr('data-promotion_id');\r\n\t\t\tvar $promoName = $activeSlide.find('.hero-slide').attr('data-promotion_name');\r\n\t\t\tif($promoId && $promoName) {\r\n\t\t\t\twindow.dataLayer.push({\r\n\t\t\t\t\t\"event\": \"eePromoView\",\r\n\t\t\t\t\t\"pageCategory\": \"Home Page\",\r\n\t\t\t\t\t\"pageSubCategory\": \"Storefront\",\r\n\t\t\t\t\t'promotions': [{\r\n\t\t\t\t\t\t\"id\": $promoId,\r\n\t\t\t\t\t\t\"name\": $promoName,\r\n\t\t\t\t\t\t\"creative\": \"summer_banner2\",\r\n\t\t\t\t\t\t\"position\": \"1\"\r\n\t\t\t\t\t}]\r\n\t\t\t\t})\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\twindow.addEventListener('load', function () {\r\n\t\tif (gtCurPage == 'search-show') {\r\n\t\t\tconst inputElements = document.querySelectorAll('.product-tiles-holder input.gtm-product-tile');\r\n\t\t\tconst pId = [];\r\n\t\t \r\n\t\t\tinputElements.forEach((element, index) => {\r\n\t\t\t\tconst dataValue = element.getAttribute('data-value');\r\n\t\t\t\tconst dataObject = JSON.parse(dataValue);\r\n\t\t\t\tconst productData = {\r\n\t\t\t\t\t\"listType\": 'product category list',\r\n\t\t\t\t\t\"listName\": dataObject.catid,\r\n\t\t\t\t\t\"position\": index + 1,\r\n\t\t\t\t\t\"id\": dataObject.ID,\r\n\t\t\t\t\t\"category\": dataObject.catid,\r\n\t\t\t\t\t\"price\": dataObject.pricing.sale,\r\n\t\t\t\t\t\"name\": dataObject.name,\r\n\t\t\t\t\t\"brand\": dataObject.brand,\r\n\t\t\t\t\t\"size\": dataObject.size,\r\n\t\t\t\t\t\"subCategory\": dataObject.subcategory,\r\n\t\t\t\t\t\"subSubCategory\": dataObject.subSubCategory,\r\n\t\t\t\t\t\"productautoreplenish\": dataObject.productautoreplenish,\r\n\t\t\t\t\t\"productOutOfStock\": dataObject.productOutOfStock,\r\n\t\t\t\t\t\"productColor\": dataObject.productColor,\r\n\t\t\t\t\t\"productType\": \"Product\",\r\n\t\t\t\t\t\"productVariantID\": dataObject.master ? dataObject.defalutvariant : dataObject.ID,\r\n\t\t\t\t\t\"collectionName\": dataObject.customBrand,\r\n\t\t\t\t\t\"productNumReviews\": dataObject.productNumReviews,\r\n\t\t\t\t\t\"productStarRating\": dataObject.productStarRating\t\t\t\t\r\n\t\t\t\t};\r\n\t\t\t\tpId.push(productData);\r\n\t\t\t});\r\n\t\t \r\n\t\t\twindow.dataLayer.push({\r\n\t\t\t \"currencyCode\": window.User.currencyCode,\r\n\t\t\t \"eeAction\": \"eeListView\",\r\n\t\t\t \"event\": \"eeListView\",\r\n\t\t\t \"pageSubCategory\": getPageSubcategory(),\r\n\t\t\t \"pageCategory\": getPageCategory(),\r\n\t\t\t \"products\": JSON.stringify(pId)\r\n\t\t\t});\r\n\t\t }\r\n\t});\r\n\t\r\n\twindow.addEventListener('load', function () {\r\n\t\tif(gtCurPage == 'visualizer-getanalysisresult'){\r\n\t\t\tvar beautyModule = $('.skin-condition-tabs .skin-condition-btn.active').text();\r\n\t\t\tvar radioData = $('.skin-condition-tabs .skin-condition-btn.active').attr('data-tab');\r\n\t\t\tvar beautyfilter = $(\".\"+radioData+\" input.skin-condition-radio:checked\").attr('value');\r\n\t\t\tpushDtLayer({\r\n\t\t\t\t\"event\": \"beautyCirculationInteraction\", \r\n\t\t\t\t\"consultationToolType\": \"Skin Visualizer\", \r\n\t\t\t\t\"beautyModule\": beautyModule, \r\n\t\t\t\t\"beautyfilter\": beautyfilter ? beautyfilter: \"\"\r\n\t\t\t})\t\r\n\t\t}\r\n\t})\r\n\r\n\twindow.addEventListener('load', function () {\r\n\t\tif (gtCurPage == 'visualizer-getanalysisresult') {\r\n\t\t\tvar recommendedProduct = $('.targetSolutions').attr('data-targetedsolutions');\r\n\t\t\tvar premiumSolutions = $('.premiumSolutions').attr('data-premiumsolutions');\r\n\t\t\tvar mensCare = $('.mensCare').attr('data-menscare');\r\n\t\t\tif(recommendedProduct){\r\n\t\t\t\tpushDtLayer({\r\n\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\"pageCategory\": \"Consultation Tool\", \r\n\t\t\t\t\t\"pageSubCategory\": \"Skin Visualizer\", \r\n\t\t\t\t\t\"siteLocation\": \"footer, product page\",\r\n\t\t\t\t\t\"products\": JSON.parse(recommendedProduct)\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif(premiumSolutions){\r\n\t\t\t\tpushDtLayer({\r\n\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\"pageCategory\": \"Consultation Tool\", \r\n\t\t\t\t\t\"pageSubCategory\": \"Skin Visualizer\", \r\n\t\t\t\t\t\"siteLocation\": \"footer, product page\",\r\n\t\t\t\t\t\"products\": JSON.parse(premiumSolutions)\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\tif(mensCare){\r\n\t\t\t\tpushDtLayer({\r\n\t\t\t\t\t\"currencyCode\": window.User.currencyCode,\r\n\t\t\t\t\t\"event\": \"eeListView\",\r\n\t\t\t\t\t\"pageCategory\": \"Consultation Tool\", \r\n\t\t\t\t\t\"pageSubCategory\": \"Skin Visualizer\", \r\n\t\t\t\t\t\"siteLocation\": \"footer, product page\",\r\n\t\t\t\t\t\"products\": JSON.parse(mensCare)\r\n\t\t\t\t});\r\n\t\t\t}\r\n\t\t\t\t\r\n\t\t}\r\n\r\n\t})\r\nmodule.exports = {\r\n\tinit: function () {\r\n\t\tif (SitePreferences.GTM_ENABLED)\r\n\t\t\tinitializeGlobalEvents();\r\n\t},\r\n\ttagmanager: {\r\n\t\tclick: function (data) {\r\n\t\t\treturn trackConsultationEvent(data);\r\n\t\t},\r\n\r\n\t\tpageview: function (data) {\r\n\t\t\treturn trackConsultationPageview(data);\r\n\t\t}\r\n\t},\r\n\tonlinequiz: {\r\n\t\tclick: function (data) {\r\n\t\t\treturn trackOnlineQuizEvent(data);\r\n\t\t},\r\n\r\n\t\tpageview: function (onlineQuizPage) {\r\n\t\t\tif(onlineQuizPage == 'result') {\r\n\t\t\t\treturn trackOnlineQuizResultPageview();\r\n\t\t\t} else {\r\n\t\t\t\treturn trackOnlineQuizPageview();\r\n\t\t\t}\t\t\t\r\n\t\t}\r\n\t},\r\n\tgtmInternalPromotion: {\r\n\t\tclick: function (data) {\r\n\t\t\treturn trackInternalPromotionEvent(data);\r\n\t\t},\r\n\r\n\t\tpageview: function (data) {\r\n\t\t\treturn trackInternalPromotionPageView(data);\r\n\t\t}\r\n\t},\r\n\tgtmCouponApplied: gtmCouponApplied,\r\n\tinitSPCBillingEvent: function() {\r\n\t\tspcBillingEvent();\r\n\t},\r\n\tsampleNoticeEvent: function(data) {\r\n\t\tsampleNoticeEvent(data)\r\n\t},\r\n\tcouponAppliedEvent: function() {\r\n\t\tcouponAppliedEvent()\r\n\t}\r\n}\n},{\"./util\":93}],3:[function(require,module,exports){\n!function(e,t){\"object\"==typeof exports&&\"object\"==typeof module?module.exports=t():\"function\"==typeof define&&define.amd?define([],t):\"object\"==typeof exports?exports.AOS=t():e.AOS=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var i=o[n]={exports:{},id:n,loaded:!1};return e[n].call(i.exports,i,i.exports,t),i.loaded=!0,i.exports}var o={};return t.m=e,t.c=o,t.p=\"dist/\",t(0)}([function(e,t,o){\"use strict\";function n(e){return e&&e.__esModule?e:{\"default\":e}}var i=Object.assign||function(e){for(var t=1;t-1?O(!0):document.addEventListener(j.startEvent,function(){O(!0)}),window.addEventListener(\"resize\",(0,s[\"default\"])(O,50,!0)),window.addEventListener(\"orientationchange\",(0,s[\"default\"])(O,50,!0)),window.addEventListener(\"scroll\",(0,c[\"default\"])(function(){(0,b[\"default\"])(h,j.once)},99)),document.addEventListener(\"DOMNodeRemoved\",function(e){var t=e.target;t&&1===t.nodeType&&t.hasAttribute&&t.hasAttribute(\"data-aos\")&&(0,s[\"default\"])(_,50,!0)}),(0,f[\"default\"])(\"[data-aos]\",_),h)};e.exports={init:S,refresh:O,refreshHard:_}},function(e,t){},,,,function(e,t,o){\"use strict\";function n(e,t,o){var n=!0,a=!0;if(\"function\"!=typeof e)throw new TypeError(c);return i(o)&&(n=\"leading\"in o?!!o.leading:n,a=\"trailing\"in o?!!o.trailing:a),r(e,t,{leading:n,maxWait:t,trailing:a})}function i(e){var t=\"undefined\"==typeof e?\"undefined\":a(e);return!!e&&(\"object\"==t||\"function\"==t)}var a=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol?\"symbol\":typeof e},r=o(6),c=\"Expected a function\";e.exports=n},function(e,t){\"use strict\";function o(e,t,o){function n(t){var o=b,n=v;return b=v=void 0,O=t,y=e.apply(n,o)}function a(e){return O=e,w=setTimeout(d,t),_?n(e):y}function r(e){var o=e-h,n=e-O,i=t-o;return z?x(i,g-n):i}function u(e){var o=e-h,n=e-O;return!h||o>=t||0>o||z&&n>=g}function d(){var e=j();return u(e)?f(e):void(w=setTimeout(d,r(e)))}function f(e){return clearTimeout(w),w=void 0,A&&b?n(e):(b=v=void 0,y)}function l(){void 0!==w&&clearTimeout(w),h=O=0,b=v=w=void 0}function m(){return void 0===w?y:f(j())}function p(){var e=j(),o=u(e);if(b=arguments,v=this,h=e,o){if(void 0===w)return a(h);if(z)return clearTimeout(w),w=setTimeout(d,t),n(h)}return void 0===w&&(w=setTimeout(d,t)),y}var b,v,g,y,w,h=0,O=0,_=!1,z=!1,A=!0;if(\"function\"!=typeof e)throw new TypeError(s);return t=c(t)||0,i(o)&&(_=!!o.leading,z=\"maxWait\"in o,g=z?k(c(o.maxWait)||0,t):g,A=\"trailing\"in o?!!o.trailing:A),p.cancel=l,p.flush=m,p}function n(e){var t=i(e)?h.call(e):\"\";return t==f||t==l}function i(e){var t=\"undefined\"==typeof e?\"undefined\":u(e);return!!e&&(\"object\"==t||\"function\"==t)}function a(e){return!!e&&\"object\"==(\"undefined\"==typeof e?\"undefined\":u(e))}function r(e){return\"symbol\"==(\"undefined\"==typeof e?\"undefined\":u(e))||a(e)&&h.call(e)==m}function c(e){if(\"number\"==typeof e)return e;if(r(e))return d;if(i(e)){var t=n(e.valueOf)?e.valueOf():e;e=i(t)?t+\"\":t}if(\"string\"!=typeof e)return 0===e?e:+e;e=e.replace(p,\"\");var o=v.test(e);return o||g.test(e)?y(e.slice(2),o?2:8):b.test(e)?d:+e}var u=\"function\"==typeof Symbol&&\"symbol\"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&\"function\"==typeof Symbol&&e.constructor===Symbol?\"symbol\":typeof e},s=\"Expected a function\",d=NaN,f=\"[object Function]\",l=\"[object GeneratorFunction]\",m=\"[object Symbol]\",p=/^\\s+|\\s+$/g,b=/^[-+]0x[0-9a-f]+$/i,v=/^0b[01]+$/i,g=/^0o[0-7]+$/i,y=parseInt,w=Object.prototype,h=w.toString,k=Math.max,x=Math.min,j=Date.now;e.exports=o},function(e,t){\"use strict\";function o(e,t){r.push({selector:e,fn:t}),!c&&a&&(c=new a(n),c.observe(i.documentElement,{childList:!0,subtree:!0,removedNodes:!0})),n()}function n(){for(var e,t,o=0,n=r.length;n>o;o++){e=r[o],t=i.querySelectorAll(e.selector);for(var a,c=0,u=t.length;u>c;c++)a=t[c],a.ready||(a.ready=!0,e.fn.call(a,a))}}Object.defineProperty(t,\"__esModule\",{value:!0});var i=window.document,a=window.MutationObserver||window.WebKitMutationObserver,r=[],c=void 0;t[\"default\"]=o},function(e,t){\"use strict\";function o(e,t){if(!(e instanceof t))throw new TypeError(\"Cannot call a class as a function\")}Object.defineProperty(t,\"__esModule\",{value:!0});var n=function(){function e(e,t){for(var o=0;oe.position?e.node.classList.add(\"aos-animate\"):\"undefined\"!=typeof n&&(\"false\"===n||!o&&\"true\"!==n)&&e.node.classList.remove(\"aos-animate\")},n=function(e,t){var n=window.pageYOffset,i=window.innerHeight;e.forEach(function(e,a){o(e,i+n,t)})};t[\"default\"]=n},function(e,t,o){\"use strict\";function n(e){return e&&e.__esModule?e:{\"default\":e}}Object.defineProperty(t,\"__esModule\",{value:!0});var i=o(11),a=n(i),r=function(e,t){return e.forEach(function(e,o){e.node.classList.add(\"aos-init\"),e.position=(0,a[\"default\"])(e.node,t.offset)}),e};t[\"default\"]=r},function(e,t,o){\"use strict\";function n(e){return e&&e.__esModule?e:{\"default\":e}}Object.defineProperty(t,\"__esModule\",{value:!0});var i=o(12),a=n(i),r=function(e,t){var o=0,n=0,i=window.innerHeight,r={offset:e.getAttribute(\"data-aos-offset\"),anchor:e.getAttribute(\"data-aos-anchor\"),anchorPlacement:e.getAttribute(\"data-aos-anchor-placement\")};switch(r.offset&&!isNaN(r.offset)&&(n=parseInt(r.offset)),r.anchor&&document.querySelectorAll(r.anchor)&&(e=document.querySelectorAll(r.anchor)[0]),o=(0,a[\"default\"])(e).top,r.anchorPlacement){case\"top-bottom\":break;case\"center-bottom\":o+=e.offsetHeight/2;break;case\"bottom-bottom\":o+=e.offsetHeight;break;case\"top-center\":o+=i/2;break;case\"bottom-center\":o+=i/2+e.offsetHeight;break;case\"center-center\":o+=i/2+e.offsetHeight/2;break;case\"top-top\":o+=i;break;case\"bottom-top\":o+=e.offsetHeight+i;break;case\"center-top\":o+=e.offsetHeight/2+i}return r.anchorPlacement||r.offset||isNaN(t)||(n=t),o+n};t[\"default\"]=r},function(e,t){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0});var o=function(e){for(var t=0,o=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-(\"BODY\"!=e.tagName?e.scrollLeft:0),o+=e.offsetTop-(\"BODY\"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:o,left:t}};t[\"default\"]=o},function(e,t){\"use strict\";Object.defineProperty(t,\"__esModule\",{value:!0});var o=function(e){e=e||document.querySelectorAll(\"[data-aos]\");var t=[];return[].forEach.call(e,function(e,o){t.push({node:e})}),t};t[\"default\"]=o}])});\n},{}],4:[function(require,module,exports){\n'use strict';\r\n\r\nwindow.Dragdealer = require('dragdealer').Dragdealer;\r\nwindow.$ = window.jQuery = require('jquery');\r\n\r\nrequire('jquery-validation');\r\nrequire('./jquery-ui')();\r\nrequire('slick-carousel');\r\nrequire(\"resize-sensor\");\r\nrequire(\"lazysizes\");\r\nrequire(\"spritespin\");\r\nrequire(\"./scrollbar\")();\r\nrequire(\"owl.carousel\");\r\nvar html2canvas = require(\"html2canvas\");\r\nwindow.html2canvas = html2canvas;\r\nvar croppie = require(\"croppie\");\r\nwindow.croppie = croppie;\r\nrequire('./jquery-ui-slider');\r\n\r\n// Using Exif-js to read the image rotation.\r\nvar EXIF = require(\"exif-js\");\r\nwindow.EXIF = EXIF;\r\n\r\nvar analytics = require('./analytics'),\r\ncountries = require('./countries'),\r\nquickview = require(\"./quickview\"),\r\nminicart = require('./minicart'),\r\npage = require('./page'),\r\nrating = require('./rating'),\r\nsearchplaceholder = require('./searchplaceholder'),\r\nsearchsuggest = require('./searchsuggest'),\r\ntooltip = require('./tooltip'),\r\nutil = require('./util'),\r\nvalidator = require('./validator'),\r\nslick = require('./slick'),\r\ntls = require('./tls'),\r\nvideo = require(\"./video\"),\r\nheader = require('./header'),\r\nfooterSelector = require('./footer-selector'),\r\nnewsletter = require('./newsletter'),\r\norderreplenishment = require('./order-replenishment'),\r\ninputEntry = require('./input-entry'),\r\npressrelease = require('./pressrelease'),\r\nshadedtool = require('./shaded-tool'),\r\nanimation = require('./aos'),\r\ncurrentLayout = require('./detect-layout'),\r\ncustomModal = require('./modal'),\r\nsearch = require('./pages/search'),\r\nproductTile = require('./product-tile'),\r\nquiz = require('./quiz'),\r\nconsentTracking = require('./consentTracking'),\r\ndelayImage = require('./delay-image');\r\n\r\n//Initilize detect layout\r\nvar checkLayout = currentLayout.init();\r\n\r\n//if jQuery has not been loaded, load from google cdn\r\nif (!window.jQuery) {\r\nvar s = document.createElement('script');\r\n\r\ns.setAttribute('src', 'https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js');\r\ns.setAttribute('type', 'text/javascript');\r\n\r\ndocument.getElementsByTagName('head')[0].appendChild(s);\r\n}\r\n\r\nrequire('./jquery-ext')();\r\nrequire('./cookieprivacy')();\r\nconsentTracking.init();\r\nrequire('./captcha')();\r\n\r\nfunction initializeEvents() {\r\nvar controlKeys = ['8', '13', '46', '45', '36', '35', '38', '37', '40', '39'];\r\n\r\n$('body')\r\n\t.on('keydown', 'textarea[data-character-limit]', function (e) {\r\n\t\tvar text = $(this).val(),\r\n\t\t\tcharsLimit = $(this).data('character-limit'),\r\n\t\t\tcharsUsed = text.length;\r\n\r\n\t\tif ((charsUsed >= charsLimit) && (controlKeys.indexOf(e.which.toString()) < 0)) {\r\n\t\t\te.preventDefault();\r\n\t\t}\r\n\t})\r\n\t.on('change keyup mouseup', 'textarea[data-character-limit]', function () {\r\n\t\tvar text = $(this).val(),\r\n\r\n\t\t\tcharsLimit = $(this).data('character-limit'),\r\n\t\t\tcharsUsed = text.length,\r\n\t\t\tcharsRemain = charsLimit - charsUsed;\r\n\r\n\t\tif (charsRemain < 0) {\r\n\t\t\t$(this).val(text.slice(0, charsRemain));\r\n\t\t\tcharsRemain = 0;\r\n\t\t}\r\n\t\tif (charsUsed <= charsLimit) {\r\n\t\t\t$(this).closest('.field-wrapper').find('.char-remain-count').html(charsRemain);\r\n\t\t\t$(this).closest('.field-wrapper').find('.char-used-count').html(charsUsed);\r\n\t\t}\r\n\t});\r\n\r\n/**\r\n * initialize search suggestions, pending the value of the site preference(enhancedSearchSuggestions)\r\n * this will either init the legacy(false) or the beta versions(true) of the the search suggest feature.\r\n * */\r\nvar $searchContainer = $('.header-search-wrapper .search-inner');\r\n\r\nsearchsuggest.init($searchContainer, Resources.SIMPLE_SEARCH);\r\n\r\n// add show/hide navigation elements\r\n$('.secondary-navigation .toggle').on('click', function () {\r\n\t$(this).toggleClass('expanded').next('ul').toggle();\r\n});\r\n\r\n// add generic toggle functionality\r\n$('.toggle').next('.toggle-content').hide();\r\n$('.toggle').on('click', function () {\r\n\t$(this).toggleClass('expanded').next('.toggle-content').toggle();\r\n});\r\n\r\n// subscribe email box\r\nvar $subscribeEmail = $('.subscribe-email');\r\n\r\nif ($subscribeEmail.length > 0) {\r\n\t$subscribeEmail.on('focus', function () {\r\n\t\tvar val = $(this.val());\r\n\r\n\t\tif (val.length > 0 && val !== Resources.SUBSCRIBE_EMAIL_DEFAULT) {\r\n\t\t\treturn; // do not animate when contains non-default value\r\n\t\t}\r\n\r\n\t\t$(this).animate({\r\n\t\t\tcolor: '#999999'\r\n\t\t}, 500, 'linear', function () {\r\n\t\t\t$(this).val('').css('color', '#333333');\r\n\t\t});\r\n\t}).on('blur', function () {\r\n\t\tvar val = $.trim($(this.val()));\r\n\r\n\t\tif (val.length > 0) {\r\n\t\t\treturn; // do not animate when contains value\r\n\t\t}\r\n\r\n\t\t$(this).val(Resources.SUBSCRIBE_EMAIL_DEFAULT)\r\n\t\t\t.css('color', '#999999')\r\n\t\t\t.animate({\r\n\t\t\t\tcolor: '#333333'\r\n\t\t\t}, 500, 'linear');\r\n\t});\r\n}\r\n\r\nif (SitePreferences.MOTIONPOINT_ENABLED) {\r\n\r\n\t$('#chooseLanguage').on('click', function (e) {\r\n\t\te.preventDefault();\r\n\r\n\t\tvar script = document.createElement('script');\r\n\r\n\t\t//MP.SrcUrl = unescape('mp_js_orgin_url'); - commented out per MotionPoint\r\n\t\tMP.UrlLang = 'mp_js_current_lang';\r\n\t\tMP.oSite = decodeURIComponent('mp_js_origin_baseUrl');\r\n\t\tMP.tSite = decodeURIComponent('mp_js_translated_baseUrl');\r\n\r\n\t\tMP.init();\r\n\r\n\t\tscript.src = 'https://shiseidoamericas.mpeasylink.com/mpel/mpel_chooser.js';\r\n\r\n\t\tdocument.body.appendChild(script);\r\n\r\n\t\treturn false;\r\n\t});\r\n\r\n}\r\n\r\n$('.js-quiz-modal, .js-quiz-modal + .tapable-on-mobile').on('click', function () {\r\n\tvar quizModal = $('#quiz-modal'),\r\n\t\tquizLoader = quizModal.find('.ajax-loader'),\r\n\t\tquizContent = quizModal.find('.questions-content');\r\n\r\n\tquizLoader.show();\r\n\tquizContent.empty();\r\n\r\n\t$.ajax({\r\n\t\turl: Urls.quizModalUrl,\r\n\t\tsuccess: function (response) {\r\n\t\t\tquizLoader.hide();\r\n\t\t\tquizContent.empty().html(response);\r\n\t\t\tquiz.bindQuizEvents();\r\n\t\t\tquiz.createStepsIndicators();\r\n\t\t\tquiz.registerPageView(quizContent);\r\n\t\t}\r\n\t});\r\n});\r\n\r\n$('.js-foundation-finder-start').on('click', function(e) {\r\n\te.preventDefault();\r\n\tfor(var i = 1; i <= 5; i++) {\r\n\t\tif (localStorage.getItem('question' + i) !== null) {\r\n\t\t\tlocalStorage.removeItem('question' + i);\r\n\t\t}\r\n\t}\r\n\twindow.location.href = $(this).attr('href');\r\n});\r\n\r\nif ($('.order-confirmation-details').length) {\r\n\tsessionStorage.removeItem('isGift');\r\n\tsessionStorage.removeItem('giftMessage');\r\n}\r\n\r\nvar url = Urls.passwordReset;\r\n\r\nif ($('.reset-password-link').length) {\r\n\tif (location.protocol === 'https:') {\r\n\t\turl = Urls.securePasswordReset;\r\n\t}\r\n\r\n\t$('.reset-password-link').each(function () {\r\n\t\t$(this).find('a').attr('href', url);\r\n\t});\r\n}\r\n\r\nif ($('.user-recognized').length) {\r\n\tif (location.protocol === 'https:') {\r\n\t\turl = Urls.securePasswordReset;\r\n\t}\r\n\r\n\t$('.user-recognized').find('a').attr('href', url);\r\n}\r\n\r\n// checkout checkout minicart on right side event handling\r\naddSummaryScrollbar();\r\n\r\n//Accordion\r\n$(document).on('click', '.accordion .accordion_title', function () {\r\n\tif (false === $(this).next().is(':visible')) {\r\n\t\t$('.accordion_description').slideUp(300);\r\n\t\t$('.open').removeClass('open');\r\n\t}\r\n\t$(this).next().slideToggle(300);\r\n\r\n\t$(this).toggleClass('open');\r\n\tif ($(this).hasClass('open')) {\r\n\t\tif ($(\".sb-checkout\").length) {\r\n\t\t\t$(\".sb-checkout .sb-container\").scrollBox();\r\n\t\t}\r\n\t}\r\n});\r\n$(document).ready(function () {\r\n\tif ($('.accordion .accordion_title').hasClass('open')) {\r\n\t\tif ($(\".sb-checkout\").length) {\r\n\t\t\t$(\".sb-checkout .sb-container\").scrollBox();\r\n\t\t}\r\n\t}\r\n\t\r\n\t//To set header search icon alignment when Marketing site enabled\r\n\tif (!$('.minicart-link').length) {\r\n\t\t$('.courtesy-nav').css('margin-right', '0');\r\n\t}\r\n\t\r\n\treadMore();\r\n});\r\n\r\n//Hero Carousel Chevron animation\r\n$('.hero-chevron .chevron-icon').click(function(e){\r\n\tvar targetHeight= $('.top-hero-section').height();\r\n\t\tif (checkLayout == 'desktop') {\r\n\t\t\t$('html, body, .content').animate({scrollTop: targetHeight}, 1500);\r\n\t\t} else {\r\n\t\t\t$('html, body, .content').animate({scrollTop: targetHeight - 25}, 1500);\r\n\t\t}\r\n\t\t\r\n\te.preventDefault();\r\n});\r\n\r\n$(window).on('orientationchange', function() {\r\n\tif(navigator.userAgent.match(/iPad/i) !== null && $('html').hasClass('sticky-header-search')) {\r\n\t\t$('.js-search-link').trigger('click');\r\n\t}\r\n\t\r\n\tif(navigator.userAgent.match(/iPad/i) !== null && !$('.morelink ').hasClass('less')) {\r\n\t\t$('.cat-slot-banner-plp .content .morecontent span').toggle();\r\n\t\t$('.morelink').toggle();\r\n\t}\r\n});\r\n\r\n//Tips and Tutorial slider\r\nif ($('.tips-and-tutorials.variation-2').length) {\r\n\tvar tutorialVariation2 = $('.tips-and-tutorials.variation-2 .slides');\r\n\ttutorialVariation2.slick({\r\n\t\tdots: true,\r\n\t\tinfinite: false,\r\n\t\tarrows: true,\r\n\t\tslidesToShow: 1,\r\n\t\tslidesToScroll: 1,\r\n\t\tfocusOnSelect: true,\r\n\t\tresponsive: [{\r\n\t\t\tbreakpoint: 769,\r\n\t\t\tsettings: {\r\n\t\t\t\tslidesToShow: 1,\r\n\t\t\t\tslidesToScroll: 1\r\n\t\t\t}\r\n\t\t}]\r\n\t});\r\n}\r\n\r\nif ($('.tips-and-tutorials.variation-3').length) {\r\n\tvar tutorialVariation3 = $('.tips-and-tutorials.variation-3 .videos');\r\n\ttutorialVariation3.slick({\r\n\t\tdots: true,\r\n\t\tarrows: true,\r\n\t\tinfinite: false,\r\n\t\tslidesToShow: 3,\r\n\t\tslidesToScroll: 1,\r\n\t\tfocusOnSelect: true,\r\n\t\tresponsive: [{\r\n\t\t\tbreakpoint: 769,\r\n\t\t\tsettings: {\r\n\t\t\t\tslidesToShow: 2,\r\n\t\t\t\tslidesToScroll: 1\r\n\t\t\t}\r\n\t\t}]\r\n\t});\r\n}\r\nif ($('.tips-and-tutorials.variation-4').length) {\r\n\t$('.tips-and-tutorials.variation-4 .slider-for').slick({\r\n\t\tdots: false,\r\n\t\tarrows: false,\r\n\t\tinfinite: false,\r\n\t\tslidesToShow: 2,\r\n\t\tslidesToScroll: 1,\r\n\t\tfocusOnSelect: true,\r\n\t\tadaptiveHeight: true,\r\n\t\tresponsive: [{\r\n\t\t\tbreakpoint: 769,\r\n\t\t\tsettings: {\r\n\t\t\t\tslidesToShow: 2,\r\n\t\t\t\tslidesToScroll: 1\r\n\t\t\t}\r\n\t\t}]\r\n\t});\r\n\t$('.tips-and-tutorials.variation-4 .slider-nav').slick({\r\n\t\tdots: false,\r\n\t\tarrows: true,\r\n\t\tinfinite: false,\r\n\t\tslidesToShow: 2,\r\n\t\tslidesToScroll: 1,\r\n\t\tfocusOnSelect: true,\r\n\t\tadaptiveHeight: true,\r\n\t\tasNavFor: '.slider-for',\r\n\t\tresponsive: [{\r\n\t\t\tbreakpoint: 769,\r\n\t\t\tsettings: {\r\n\t\t\t\tslidesToShow: 2,\r\n\t\t\t\tslidesToScroll: 1,\r\n\t\t\t\tadaptiveHeight: false\r\n\t\t\t}\r\n\t\t}]\r\n\t});\r\n}\r\n}\r\n\r\n/**\r\n* @global\r\n* @function\r\n* @description Read More Ability\r\n*/\r\nfunction readMore() {\r\n\tvar showChar = 80;\r\n\tvar ellipsestext = \"...\";\r\n\tvar moretext = $('.cat-slot-banner-plp .read-more').text();\r\n\tvar lesstext = \"less\";\r\n\t\r\n\tif (window.innerWidth >= 768) {\r\n\t\tshowChar = 200;\r\n\t} else if (window.innerWidth >= 375) {\r\n\t\tshowChar = 90;\r\n\t}\r\n\t$('.more').each(function() {\r\n\t\tvar content = $(this).html();\r\n\t\tif (window.innerWidth < 769) {\r\n\t\t\tif(content.length > showChar) {\r\n\t\r\n\t\t\t\tvar c = content.substr(0, showChar);\r\n\t\t\t\tvar h = content.substr(showChar, content.length - showChar);\r\n\t\t\t\t\r\n\t\t\t\tvar html = c + ' '+ellipsestext+' ' + h + ''+moretext+'';\r\n\t\r\n\t\t\t\t$(this).html(html);\r\n\t\t\t}\r\n\t\t}\r\n\t});\r\n\r\n\t$(\".morelink\").click(function(){\r\n\t\tif($(this).hasClass(\"less\")) {\r\n\t\t\t$(this).removeClass(\"less\");\r\n\t\t\t$(this).html(moretext);\r\n\t\t} else {\r\n\t\t\t$(this).addClass(\"less\");\r\n\t\t\t$(this).html(lesstext);\r\n\t\t}\r\n\t\t$(this).parent().prev().toggle();\r\n\t\t$(this).prev().toggle();\r\n\t\treturn false;\r\n\t});\r\n}\r\n\r\n/**\r\n* @private\r\n* @function\r\n* @description jquery UI Select Menu.\r\n*/\r\nfunction selectMenu() {\r\n$('select').selectmenu({\r\n\t//Add class to Dropdown Set for css targeting\r\n\twidth: false,\r\n\tposition: {\r\n\t\tmy: \"left top\",\r\n\t\tat: \"left bottom\",\r\n\t\tcollision: \"flip flip\"\r\n\t}\r\n});\r\n}\r\n\r\nfunction refreshSelectMenu() {\r\nif ($('[role=\"combobox\"][aria-expanded=\"true\"]').length > 0) {\r\n\t$('[role=\"combobox\"][aria-expanded=\"true\"]').each(function () { // anyone that is open\r\n\t\t$(this).prev().selectmenu(\"close\");\r\n\t});\r\n}\r\n}\r\n\r\n/**\r\n* @private\r\n* @function\r\n* @description Screen Resize Handler.\r\n*/\r\nfunction screenResizeHandler() {\r\n$(window).on('resize orientationchange', function () {\r\n\trefreshSelectMenu();\r\n\tupdateSigleTileContentHeight();\r\n\taosInitialize();\r\n\r\n\t// Initilize detect layout on Resize\r\n\tcheckLayout = currentLayout.init();\r\n\tif (checkLayout == 'desktop') {\r\n\t\t$('.main-nav').removeAttr('style');\r\n\t}\r\n\r\n\tif ($('#social-media-post-detail-modal').length) {\r\n\t\t$('#social-media-post-detail-modal').find('.modal-close').trigger('click');\r\n\t}\r\n});\r\n}\r\n\r\n/**\r\n* @private\r\n* @function\r\n* @description Adds class ('js') to html for css targeting and loads js specific styles.\r\n*/\r\nfunction initializeDom() {\r\n// add class to html for css targeting\r\n$('html').addClass('js');\r\n\r\n// Touch screen detection\r\nif ('ontouchstart' in window || 'ontouch' in window) {\r\n\t$('body').addClass('touch');\r\n}\r\n\r\nif (SitePreferences.LISTING_INFINITE_SCROLL) {\r\n\t$('html').addClass('infinite-scroll');\r\n}\r\n\r\n// load js specific styles\r\nutil.limitCharacters();\r\n\r\n//Initialize custom select \r\nselectMenu();\r\n\r\nscreenResizeHandler();\r\n\r\n}\r\n\r\n//Back to top function\r\nfunction backToTopHandler() {\r\nvar scrollToTopEle = $('.scroll-top-wrapper');\r\n$.fn.scrollEnd = function (callback, timeout) {\r\n\tvar scrollVal = 100;\r\n\t$(this).on('scroll', function () {\r\n\t\tvar $this = $(this);\r\n\t\tif (($('.pt_storefront').length || $('.pt_articles_listing').length) && $('.top-hero-section').length) {\r\n\t\t\tscrollVal = $('.top-hero-section').height() + 100;\r\n\t\t}\r\n\t\tbackToTopShowHide(scrollVal, callback, timeout, scrollToTopEle);\r\n\t});\r\n\t\r\n\tscrollToTopEle.on('mouseover touchstart', function(){\r\n\t\t$(this).addClass('js-backToTopOver');\r\n\t}).on('mouseout touchend', function(){\r\n\t\t$(this).removeClass('js-backToTopOver');\r\n\t\tbackToTopShowHide(scrollVal, callback, timeout, $(this));\r\n\t});\r\n};\r\n$('.scroll-top-wrapper').on('click', scrollToTop); \r\nfunction scrollToTopDesktop() {\r\n\t$('html, body').animate({\r\n\t\tscrollTop: $('.breadcrumbs-wrap').offset().top\r\n\t},800); \r\n} \r\n$('.buy-back-to-top-nav-link').on('click', scrollToTopDesktop); \r\n\r\n$(window).scrollEnd(function () {\r\n\tscrollToTopEle.not('.js-backToTopOver').removeClass('show');\r\n}, 3000);\r\n}\r\n\r\nfunction backToTopShowHide(scrollVal, callback, timeout, scrollToTopEle) {\r\nvar windowObj = $(window);\r\nif (windowObj.scrollTop() > scrollVal) {\r\n\tscrollToTopEle.addClass('show');\r\n} else {\r\n\tscrollToTopEle.not('.js-backToTopOver').removeClass('show');\r\n}\r\n\r\nif (windowObj.data('scrollTimeout')) {\r\n\tclearTimeout(windowObj.data('scrollTimeout'));\r\n}\r\nwindowObj.data('scrollTimeout', setTimeout(callback, timeout));\r\n}\r\n\r\nfunction scrollToTop(e) {\r\n e.preventDefault();\r\n\r\n \r\n var headerHeight = $('.header-wrapper').height();\r\n var verticalOffset = typeof (verticalOffset) != 'undefined' ? verticalOffset : 0;\r\n var element = $('#main');\r\n var offset = element.offset();\r\n var offsetTop;\r\n\r\n if (!$('body').hasClass('pdp-page')) {\r\n if (($('.pt_storefront').length || $('.pt_articles_listing').length)) {\r\n if ($('.header-wrapper').css('position') === \"fixed\") {\r\n offsetTop = offset.top; \r\n } else {\r\n offsetTop = offset.top - headerHeight;\r\n }\r\n } else {\r\n if (($('.pt_product-details').length)) {\r\n offsetTop = 0;\r\n } else {\r\n offsetTop = offset.top - headerHeight;\r\n }\r\n }\r\n\r\n $('html, body').animate({\r\n scrollTop: offsetTop\r\n }, 500, 'linear', function () {\r\n if ($('body').hasClass('touch')) {\r\n $('.scroll-top-wrapper').removeClass('js-backToTopOver');\r\n }\r\n });\r\n }\r\n else { \r\n if (currentLayout.init() === 'mobile') {\r\n offsetTop = $(\".product-details-wrapper\").offset().top\r\n } else {\r\n offsetTop = $('.breadcrumbs-wrap').offset().top\r\n }\r\n\r\n $('html, body').animate({\r\n scrollTop: offsetTop\r\n }, 800)\r\n }\r\n \r\n}\r\n\r\n//Minimize header and make it stick to the top\r\nfunction minimizedHeaderHandler() {\r\ncheckScrolledDown();\r\n\r\n$(window).on('scroll', function () {\r\n\tcheckScrolledDown();\r\n});\r\n}\r\n\r\nfunction checkScrolledDown() {\r\n\r\nvar $stickyHeader = $('#minimized-header-container');\r\nvar $headerScrollOffset = $('.header-banner').outerHeight();\r\nvar $wrapper = $('#wrapper');\r\n\r\nif ($('body').hasClass('is-reveal-open')) {\r\n\treturn false;\r\n}\r\n\r\n}\r\n\r\nfunction searchMenuEvent() {\r\n// Search for mobile view\r\n$('.quick-access-menu [title=\"Search\"]').on('click', function (e) {\r\n\te.preventDefault();\r\n\r\n\t$('.header-search').slideToggle(200);\r\n});\r\n}\r\n\r\n//add class for scrollbar on miniline summary\r\nfunction addSummaryScrollbar() {\r\nvar itemCount = $('.pt_checkout .checkout-mini-cart .accordion-content .mini-cart-product').length;\r\n\r\nif (itemCount > 4) {\r\n\t$('.checkout-mini-cart .accordion-content').addClass('scroll-items');\r\n}\r\n}\r\n\r\nfunction playVideoHandler() {\r\nvar MAIN_VIDEO_SELECTOR = \".main-video\";\r\nvar CAROUSEL_VIDEO_SELECTOR = \".modal-video\";\r\n$(document)\r\n\t// main video (inline)\r\n\t.on(\"click\", MAIN_VIDEO_SELECTOR, function () {\r\n\t\tvar $this = $(this);\r\n\r\n\t\tvar $inlineEle = $this.parent(\"div\"),\r\n\t\t\tvideoId = $this.data(\"video-id\");\r\n\r\n\t\tvideo.playInline($inlineEle, videoId);\r\n\t})\r\n\r\n\t// carousel videos (launched in modal)\r\n\t.on(\"click\", CAROUSEL_VIDEO_SELECTOR, function () {\r\n\t\tvar videoId = $(this).data(\"video-id\");\r\n\r\n\t\tvideo.playInModal(videoId);\r\n\t});\r\n}\r\n\r\n\r\nfunction resetFooterError() {\r\n$('.store-locator-form input[type=\"text\"]').val('');\r\n\r\nif ($('.store-locator-form .field-button-container div').hasClass('error')) {\r\n\t$('.store-locator-form .field-button-container div').removeClass('error');\r\n\t$('.store-locator-form .field-button-container .error-message').remove();\r\n}\r\n}\r\n\r\nfunction aosInitialize() {\r\nif ($('.pt_storefront').length || $('.pt_product-search-result.category').length && checkLayout !== 'mobile') {\r\n\tanimation.init({\r\n\t\toffset: 200,\r\n\t\tduration: 600,\r\n\t\teasing: 'ease-in-sine',\r\n\t\tdelay: 100,\r\n\t\tonce: true\r\n\t});\r\n}\r\n\r\nif (checkLayout == 'mobile') {\r\n\tif ($('.pt_storefront').length) {\r\n\t\tanimation.init({\r\n\t\t\toffset: 200,\r\n\t\t\tdisable: 'mobile',\r\n\t\t\tduration: 600,\r\n\t\t\teasing: 'ease-in-sine',\r\n\t\t\tdelay: 100,\r\n\t\t\tonce: true\r\n\t\t});\r\n\t}\r\n\tif ($('.pt_product-search-result.category').length) {\r\n\t\tanimation.init({\r\n\t\t\tdisable: 'mobile'\r\n\t\t});\r\n\t}\r\n} else {\r\n\tif ($('.pt_storefront').length) {\r\n\t\tanimation.init({\r\n\t\t\toffset: 200,\r\n\t\t\tduration: 600,\r\n\t\t\teasing: 'ease-in-sine',\r\n\t\t\tdelay: 100,\r\n\t\t\tonce: true\r\n\t\t});\r\n\t}\r\n}\r\n}\r\nvar pages = {\r\naccount: require('./pages/account'),\r\ncart: require('./pages/cart'),\r\ncheckout: require('./pages/checkout'),\r\nsinglepagecheckout: require('./pages/singlepagecheckout'),\r\ncompare: require('./pages/compare'),\r\nproduct: require('./pages/product'),\r\nregistry: require('./pages/registry'),\r\norderconfirmation: require('./pages/order-confirm'),\r\nsearch: require('./pages/search'),\r\ntutorial: require('./pages/tutorial'),\r\nstorefront: require('./pages/storefront'),\r\nwishlist: require('./pages/wishlist'),\r\nstorelocator: require('./pages/storelocator'),\r\ncheckorder: require('./pages/checkorder'),\r\ncontent: require('./pages/content'),\r\npromotionlanding: require('./pages/promotionlanding'),\r\nconsultation: require('./quiz'),\r\nfoundationfinder: require('./pages/foundationfinder'),\r\nonlinequiz: require('./pages/onlinequiz')\r\n};\r\n\r\nvar app = {\r\ninit: function () {\r\n\r\n\tif (document.cookie.length === 0) {\r\n\t\t$('
').addClass('browser-compatibility-alert').append($('

').addClass('browser-error').html(Resources.COOKIES_DISABLED)).appendTo('#browser-check');\r\n\t}\r\n\r\n\tinitializeDom();\r\n\tinitializeEvents();\r\n\tbackToTopHandler();\r\n\tminimizedHeaderHandler();\r\n\tresetFooterError();\r\n\tsearchMenuEvent();\r\n\t// init specific global components\r\n\tanalytics.init();\r\n\tcountries.init();\r\n\ttooltip.init();\r\n\tminicart.init();\r\n\tvalidator.init();\r\n\torderreplenishment.init();\r\n\trating.init();\r\n\tslick.init();\r\n\tsearchplaceholder.init();\r\n\theader.init();\r\n\tvideo.init();\r\n\t//checkoutLogin.init();\r\n\tfooterSelector.countrySelector();\r\n\tnewsletter.newsletterHeader();\r\n\tnewsletter.isNewsletterEnabled();\r\n\tinputEntry.entry();\r\n\tplayVideoHandler();\r\n\tpressrelease.init();\r\n\tshadedtool.init();\r\n\tupdateSigleTileContentHeight();\r\n\tcustomModal.modal();\r\n\tsearch.viewMore();\r\n\tvideo.initialize();\r\n\tdelayImage.showDelayedImages();\r\n\r\n\tif ($(\"#selectcountry\").length > 0) {\r\n\t\tcountrySelectDropdown();\r\n\t}\r\n\r\n\t// execute page specific initializations\r\n\t$.extend(page, window.pageContext);\r\n\r\n\tvar ns = page.ns;\r\n\r\n\tif (ns && pages[ns] && pages[ns].init) {\r\n\t\tpages[ns].init();\r\n\t}\r\n\r\n\t// Check TLS status if indicated by site preference\r\n\tif (SitePreferences.CHECK_TLS === true) {\r\n\t\ttls.getUserAgent();\r\n\t}\r\n\r\n\tdefendAndRegenerate();\r\n\t$(document).on('change', 'select', function(){\r\n\t\tif($(this).selectmenu('instance') !== undefined){\r\n\t\t\t$(this).selectmenu('refresh');\r\n\t\t}\r\n\t});\r\n\t\r\n\taosInitialize();\r\n}\r\n};\r\n\r\n//Select menu widget to prepend span tag for the country flag on selected dropdown and options.\r\n$.widget(\"ui.selectmenu\", $.ui.selectmenu, {\r\n_renderItem: function (ul, item) {\r\n\tvar _div = $('

');\r\n\tvar li = $(\"
  • \");\r\n\r\n\tif (item.disabled) {\r\n\t\tli.addClass(\"ui-state-disabled\");\r\n\t}\r\n\r\n\tthis._setText(_div, item.label);\r\n\t_div.appendTo(li);\r\n\r\n\tvar setClass = item.element.attr('class');\r\n\tif (typeof setClass != 'undefined' && setClass !== '') {\r\n\t\t_div.prepend(\"\");\r\n\t}\r\n\r\n\treturn li.appendTo(ul);\r\n},\r\n_renderButtonItem: function (item) {\r\n\tvar buttonItem = $(\"\", {\r\n\t\t\"class\": \"ui-selectmenu-text\"\r\n\t})\r\n\tthis._setText(buttonItem, item.label);\r\n\r\n\tvar setClass = item.element.attr('class');\r\n\tif (typeof setClass != 'undefined' && setClass !== '') {\r\n\t\tbuttonItem.prepend(\"\");\r\n\t}\r\n\r\n\treturn buttonItem;\r\n}\r\n});\r\n\r\nfunction defendAndRegenerate() {\r\nif ($('.defend-regenerate-section').length > 0) {\r\n\tvar offset = $('.defend-regenerate-section').offset().top,\r\n\t\twindowScroll = $(window).scrollTop();\r\n\tif (offset <= windowScroll) {\r\n\t\t$('.defend-regenerate-module').addClass('animate-step2');\r\n\t}\r\n\tvar offset2 = $('.defend-regenerate-section .regenerate').offset().top;\r\n\toffset2 = offset2 - 800;\r\n\tif (offset2 <= windowScroll) {\r\n\t\t$('.defend-regenerate-module').addClass('animate-step3');\r\n\t}\r\n\tvar offset3 = $('.defend-regenerate-section .regenerate').offset().top;\r\n\tif (offset3 <= windowScroll) {\r\n\t\t$('.defend-regenerate-module').addClass('animate-step4');\r\n\t}\r\n}\r\n}\r\n\r\n$(window).on('scroll', function () {\r\ndefendAndRegenerate();\r\n});\r\n\r\n//general extension functions\r\n(function () {\r\nString.format = function () {\r\n\tvar s = arguments[0];\r\n\tvar i, len = arguments.length - 1;\r\n\r\n\tfor (i = 0; i < len; i++) {\r\n\t\tvar reg = new RegExp('\\\\{' + i + '\\\\}', 'gm');\r\n\r\n\t\ts = s.replace(reg, arguments[i + 1]);\r\n\t}\r\n\r\n\treturn s;\r\n};\r\n})();\r\n\r\n//initialize app\r\n$(document).ready(function () {\r\napp.init();\r\n});\r\n\r\n$(window).on('load', function () {\r\n//Some of the product tiles have issues with Color and Size carousel\r\n//hence the initialization is called upon window on load.\r\nproductTile.initCarouselSwatches();\r\nvar heroVideo = document.getElementById(\"hero-video\");\r\nif (heroVideo !== undefined && heroVideo !== null) {\r\n\tvar playPromise = document.getElementById(\"hero-video\").play();\r\n\tif (playPromise !== undefined) {\r\n\t\tplayPromise.then(function () {}).catch(function (error) {\r\n\t\t\t// Auto-play was prevented\r\n\t\t\t// Show paused UI.\r\n\t\t\t$('.video-control').addClass('paused');\r\n\t\t});\r\n\t}\r\n\t$('.video-control').on('click', function (event) {\r\n\t\tif (!heroVideo.paused) {\r\n\t\t\theroVideo.pause();\r\n\t\t\t$(this).addClass('paused');\r\n\t\t} else {\r\n\t\t\theroVideo.play();\r\n\t\t\t$(this).removeClass('paused');\r\n\t\t}\r\n\t});\r\n}\r\n});\r\n\r\n//Country selector menu init \r\nfunction countrySelectDropdown() {\r\n$(\"#selectcountry\").selectmenu();\r\n$(\"#header-selectcountry\").selectmenu({\r\n\tposition: {\r\n\t\tmy: \"left+10 top+15\",\r\n\t\tat: \"left bottom\",\r\n\t\tof: \"#country-selector\"\r\n\t}\r\n});\r\n}\r\n\r\n//make single tile content height same with product-tile\r\nfunction updateSigleTileContentHeight() {\r\nvar tileContentSiblingHeight = $('.product-tile:eq(0)').innerHeight();\r\n$('.single-tile-promo, .double-tile-content').removeAttr('style').css('height', tileContentSiblingHeight);\r\n}\r\n//expose global app obj for 3rd party integrations\r\nwindow.app = {\r\nquickView: quickview,\r\nminicart: minicart,\r\nuser: window.User,\r\nSCemailUrl: window.Urls.SCemailUrl,\r\nProduct: {},\r\ntagmanager: analytics.tagmanager,\r\ngtmInternalPromotion: analytics.gtmInternalPromotion\r\n};\r\n\r\n//expose global saveURL to support legacy Composed integration\r\nwindow.saveURL = window.Urls.saveConsultationURL;\r\n//summary scroll bar global scope\r\nwindow.addSummaryScrollbar = addSummaryScrollbar;\r\nwindow.scrollToTop = scrollToTop;\r\n\n},{\"./analytics\":2,\"./aos\":3,\"./captcha\":7,\"./consentTracking\":9,\"./cookieprivacy\":10,\"./countries\":11,\"./delay-image\":12,\"./detect-layout\":13,\"./footer-selector\":16,\"./header\":20,\"./input-entry\":21,\"./jquery-ext\":22,\"./jquery-ui\":24,\"./jquery-ui-slider\":23,\"./minicart\":26,\"./modal\":27,\"./newsletter\":28,\"./order-replenishment\":29,\"./page\":30,\"./pages/account\":31,\"./pages/cart\":33,\"./pages/checkorder\":34,\"./pages/checkout\":39,\"./pages/compare\":43,\"./pages/content\":44,\"./pages/foundationfinder\":45,\"./pages/onlinequiz\":46,\"./pages/order-confirm\":47,\"./pages/product\":52,\"./pages/promotionlanding\":57,\"./pages/registry\":58,\"./pages/search\":59,\"./pages/singlepagecheckout\":64,\"./pages/storefront\":69,\"./pages/storelocator\":70,\"./pages/tutorial\":72,\"./pages/wishlist\":74,\"./pressrelease\":76,\"./product-tile\":77,\"./quickview\":79,\"./quiz\":80,\"./rating\":81,\"./scrollbar\":83,\"./searchplaceholder\":84,\"./searchsuggest\":85,\"./shaded-tool\":86,\"./slick\":87,\"./tls\":91,\"./tooltip\":92,\"./util\":93,\"./validator\":95,\"./video\":96,\"croppie\":109,\"dragdealer\":111,\"exif-js\":122,\"html2canvas\":132,\"jquery\":135,\"jquery-validation\":134,\"lazysizes\":136,\"owl.carousel\":139,\"resize-sensor\":154,\"slick-carousel\":157,\"spritespin\":158}],5:[function(require,module,exports){\n'use strict';\r\n\r\nvar page = require('./page'),\r\n\tutil = require('./util'),\r\n\tsamples = require('./samples'),\r\n\tcurrentLayout = require('./detect-layout'),\r\n\tcustomModal = require('./modal');\r\n\r\nvar selectedList = [];\r\nvar maxItems = 1;\r\nvar bliUUID = '';\r\n\r\n//Initilize detect layout\r\nvar checkLayout = currentLayout.init();\r\n\r\n/**\r\n * @private\r\n * @function\r\n * description Gets a list of bonus products related to a promoted product\r\n */\r\nfunction getBonusProducts() {\r\n\tvar bonusproducts = [];\r\n\r\n\tvar i, len;\r\n\tfor (i = 0, len = selectedList.length; i < len; i++) {\r\n\t\tvar p = {\r\n\t\t\tpid: selectedList[i].pid,\r\n\t\t\tqty: selectedList[i].qty,\r\n\t\t\toptions: {}\r\n\t\t};\r\n\t\tvar a, alen, bp = selectedList[i];\r\n\t\tif (bp.options) {\r\n\t\t\tfor (a = 0, alen = bp.options.length; a < alen; a++) {\r\n\t\t\t\tvar opt = bp.options[a];\r\n\t\t\t\tp.options = {\r\n\t\t\t\t\toptionName: opt.name,\r\n\t\t\t\t\toptionValue: opt.value\r\n\t\t\t\t};\r\n\t\t\t}\r\n\t\t}\r\n\t\tbonusproducts.push({\r\n\t\t\tproduct: p\r\n\t\t});\r\n\t}\r\n\treturn {\r\n\t\tbonusproducts: bonusproducts\r\n\t};\r\n}\r\n\r\nvar selectedItemTemplate = function (data) {\r\n\tvar attributes = '';\r\n\tfor (var attrID in data.attributes) {\r\n\t\tvar attr = data.attributes[attrID];\r\n\t\tattributes += '
  • \\n';\r\n\t\tattributes += '' + attr.displayName + ': ';\r\n\t\tattributes += '' + attr.displayValue + '\\n';\r\n\t\tattributes += '
  • ';\r\n\t}\r\n\tattributes += '
  • \\n';\r\n\tattributes += 'Qty: ';\r\n\tattributes += '' + data.qty + '';\r\n\treturn [\r\n\t\t'
  • ',\r\n\t\t'',\r\n\t\t'
    ' + data.name + '
    ',\r\n\t\t'