Livraison gratuite au Québec à partir de 85$ avant taxes!
" + (jq("#ProductPriceApi").attr("data-currency") ? jq("#ProductPriceApi").attr("data-currency") : "$") + " " + data.price + "
" }); } if (counter < jq("#product-list .list-items button").length) { counter++; getProductListData(); } }, error: function (data) { console.log("getProductListData Error" + data); if (counter < jq("#product-list .list-items button").length) { counter++; getProductListData(); } } }) } } function getProductDetailData() { if (jq("#productDetailBuyNowBtn").length) { var dataUpc = jq("#productDetailBuyNowBtn").attr("data-upc"); var priceApi = jq("#ProductPriceApi").val(); var apiURL = priceApi.replace('{UPC}', '' + dataUpc + ''); jq.ajax({ url: apiURL, dataType: "jsonp", async: true, success: function (data) { jq("#productDetailBuyNowBtn").after(function () { return "" + (jq("#ProductPriceApi").attr("data-currency") ? jq("#ProductPriceApi").attr("data-currency") : "$") + " " + data.price + "
" }) }, error: function (data) { console.log("getProductDetailData Error" + data) } }) } } if (jq("#ProductPriceApi").length) { if (jq("#ProductPriceApi").val().search('{UPC}') !== -1) { counter = 0; getProductListData(); getProductDetailData() } } /* HomePage - Product Imprression*/ if (jq('body .aside-content').length>0) { product_Impression() // Product Impression for Home page }; if (jq('#product-list').length>0) { product_Impression(undefined,'PLP') // Product Impression for PSP Page }; if (jq('body.productpage').length>0) { product_Impression(jq('body.productpage')) // Product Impression for PSP Page }; //ProductImpression function product_Impression(products,source) { var productArray = []; var currencyCode = ""; if (products != undefined) { for (var i = 0; i < products.length; i++) { if (isInViewport(products[i]) == true) { var impression = getProductInfo(products[i]); if (!isSameProduct(productsOnPage, impression)) { productArray.push(impression); productsOnPage.push(impression); } } } currencyCode = jq('#productCurrencyCode', products[0]).text(); } if ($country == 'it' || $country == 'IT') { if (productArray.length > 0) { dataLayer.push({ "event": "nievent", "eventAction": "Product Impressions", "eventLabel": "Product Impressions", "eventCategory": "Ecommerce", "ecommerce": { "currencyCode": "EUR", "impressions": productArray } }); } else { dataLayer.push({ "event": "nievent", "eventAction": "Product Impressions", "eventLabel": "Product Impressions", "eventCategory": "Ecommerce", "ecommerce": { "currencyCode": "EUR", "impressions": [{ "name": "", "id": "", "price": "", "brand": "LP", "category": source =='PLP' && jq('#product-list #productCategory').length>0 ? jq('#product-list #productCategory')[0].innerText: "", "variant": "", "list": "", "position": "", "dimension35": "", "dimension36": "" }] } }); } } if (typeof (LOCA) !== 'undefined') LOCA.Dialog.refreshEvents(); } // Promotion click // jq("#slider .slider-item .content .button").bind('click', function () { product_click(jq(this).parents(".slider-item")); // Home Page }); function product_click(item) { var name = jq('#sliderproductanalytics #sliderproductName', item).text(); var position = jq('#sliderproductanalytics #sliderproducteposition', item).text(); var id = jq('#sliderproductanalytics #sliderproducteid', item).text(); if ($country == 'it' || $country == 'IT') { dataLayer.push({ "event": "promotionClick", "eventAction": "Promotion Click", "eventLabel": "Promotion Click", "eventCategory": "Ecommerce", "ecommerce": { "promoClick": { "promotions": [{ "id": id, "name": name, "creative": "Slider", "position": position }] } } }); } } /* Promotion Impression*/ if (jq("body.homepage #slider").length > 0) { var tag = jq("#slider .slider-item").length > 0 ? jq("#slider .slider-item")[0] : ""; promotion_impression(tag); // Home Page } function promotion_impression(item) { var name = jq('#sliderproductanalytics #sliderproductName', item).text(); var position = jq('#sliderproductanalytics #sliderproducteposition', item).text(); var id = jq('#sliderproductanalytics #sliderproducteid', item).text(); if ($country == 'it' || $country == 'IT') { dataLayer.push({ "event": "nievent", "eventAction": "Promotion Impressions", "eventLabel": "Promotion Impressions", "eventCategory": "Ecommerce", "ecommerce": { "promoView": { "promotions": [{ "id": id, "name": name, "creative": "slider", "position":position}]} } }); } } if (jq('.aside-content')) { //productImpression productImpressionOnPage(); //product detail if (jq('.product-content').length > 0) { productDetail(jq('.product-content')); } } jq(window).scroll(function () { productImpressionOnPage(); }); function productImpressionOnPage() { //productImpression if (jq('.inner.outline li.column.s-cols-6.cols-4').length > 0) { productImpression(jq('.inner.outline li.column.s-cols-6.cols-4')); } else { //productImpression if (jq('#product-list .list-items li.item').length > 0) { productImpression(jq('#product-list .list-items li.item')); } } } jq('.trigger-list.std-link').bind('click', function () { productImpression(jq('#product-list .list-items li.item')); }); jq('.nav-main>ul>li').mouseover(function () { promotionImpressions(this); }); jq('.inner.outline li.column.s-cols-6.cols-4').bind('click', function () { productClick(this); }); jq('#product-list .list-items li.item').bind('click', function () { productClick(this); }); function isSameProduct(dlElement, product) { for (var j = 0; j < dlElement.length; j++) { if (dlElement[j].id == product.id && dlElement[j].name == product.name) { return true; } } return false; } function isSamePromotion(dlElement, promotion) { for (var i = 0; i < dlElement.length; i++) { if (dlElement[i].name == promotion.name) { return true; } } return false; } //ProductImpression function productImpression(products) { var productArray = []; var currencyCode = ""; if (products != undefined) { for (var i = 0; i < products.length; i++) { if (isInViewport(products[i]) == true) { var impression = getProductInfo(products[i]); if (!isSameProduct(productsOnPage, impression)) { productArray.push(impression); productsOnPage.push(impression); } } } currencyCode = jq('#productCurrencyCode', products[0]).text(); } if (productArray.length > 0) { if ($country != 'it' && $country != 'IT') { dataLayer.push({ "event": "uaevent", "eventAction": "Product Impressions", "eventCategory": "Ecommerce", "ecommerce": { "currencyCode": currencyCode, "impressions": productArray } }); } } if (typeof (LOCA) !== 'undefined') LOCA.Dialog.refreshEvents(); } //ProductClick function productClick(product) { var productInfo = []; if ($country == 'it' || $country == 'IT') { productInfo.push(getproductclickinfo(product)); dataLayer.push({ "event": "productClick", "eventAction": "Product Click", "eventLabel": "Product Click", "eventCategory": "Product Impressions", "ecommerce": { "click": { "actionField": { "list": "product detail page" }, "products": productInfo } } }); } else { productInfo.push(getProductInfo(product)); dataLayer.push({ "event": "productClick", "eventAction": "Product Click", "eventCategory": br_plp_lower, "ecommerce": { "click": { "actionField": { "action": "click" }, "products": productInfo } } }); } } /* Get Product Click Info*/ function getproductclickinfo(item) { var name = jq('#productAnalytics #productName', item).text(); var price = jq('#productAnalytics #productPrice', item).text(); var category = jq('#productAnalytics #productCategory', item).text(); var productSize = jq('#productAnalytics #productSize', item).text(); var productShade = jq('#productAnalytics #productShade', item).text(); var id = jq('#productAnalytics #productEAN', item).text(); var position = jq('#productAnalytics #productposition', item).text(); var product = { "name": name, "id": id, "price": price, "brand": "LP", "category": category, "variant": "", "position": position, "dimension35": productSize, "dimension36": productShade }; return product; } //ProductDetail function productDetail(product) { var productInfo = []; productInfo.push(getProductInfo(product)); if ($country == 'it' || $country == 'IT') { dataLayer.push({ "event": "nievent", "eventAction": "Product Detail", "eventLabel": "Product Detail", "eventCategory": "Ecommerce", "ecommerce": { "detail": { "actionField": { "action": "detail" }, "products": productInfo } } }); } else { dataLayer.push({ "event": "uaevent", "eventAction": "Product Detail", "eventCategory": "Ecommerce", "ecommerce": { "detail": { "actionField": { "action": "detail", "list": "product detail page" }, "products": productInfo } } }); } } //promotionClick jq('.nav-main>ul>li>.dropdown a').bind('click', function () { if (jq('img', this).length > 0) { var alt = jq("img", this).attr('alt'); var promotions = jq('.nav-main>ul>li'); var i = 0; var found = false; while (promotions[i].className.indexOf('separator') < 0 && !found) { var j = 0; var promoImg = jq("img", promotions[i]); while (j < promoImg.length && jq(promoImg[j]).attr('alt') != alt) { j++; } if (j < promoImg.length) { promotionClick(promoImg[j]); found = true; } i++; } } }); //PromotionClick function promotionClick(promotion) { var promotionInfo = []; promotionInfo.push(getPromotionInfo(promotion)); dataLayer.push({ "event": "promotionClick", "eventAction": "Promotion Click", "eventCategory": "Ecommerce", "ecommerce": { "promoClick": { "promotions": promotionInfo } } }); } //PromotionImpressions function promotionImpressions(promotions) { var promotionArray = []; if (promotions.className.indexOf('separator') < 0) { var promotionsInLi = jq('img', promotions); for (var j = 0; j < promotionsInLi.length; j++) { if (isInViewport(promotionsInLi[j])) { var impression = getPromotionInfo(promotionsInLi[j]); if (!isSamePromotion(promotionsOnPage, impression)) { promotionArray.push(impression); promotionsOnPage.push(impression); } } } } if (promotionArray.length > 0) { dataLayer.push({ "event": "uaevent", "eventAction": "Promotion Impressions", "eventCategory": "Ecommerce", "ecommerce": { "promoView": { "promotions": promotionArray } } }); } } function getPromotionInfo(item) { var name = jq(item).attr('alt'); var promotion = { "name": name } return promotion; } function getProductInfo(item) { var name = jq('#productAnalytics #productName', item).text(); var price = jq('#productAnalytics #productPrice', item).text(); var category = jq('#productAnalytics #productCategory', item).text(); var productSize = jq('#productAnalytics #productSize', item).text(); var productShade = jq('#productAnalytics #productShade', item).text(); var id = jq('#productAnalytics #productEAN', item).text(); if ($country == 'it' || $country == 'IT') { var product = { "name": name, "id": id, "price": price, "brand": "LP", "category": category, "variant": "", "dimension35": productSize, "dimension36": productShade }; } else { var product = { "name": name, "id": id, "price": price, "brand": "LP", "category": category, "dimension35": productSize, "dimension36": productShade }; } return product; } function isInViewport(element) { var rect = element.getBoundingClientRect(); var html = document.documentElement; return ( rect.top >= 0 && rect.left >= 0 && rect.bottom <= (window.innerHeight || html.clientHeight) && rect.right <= (window.innerWidth || html.clientWidth) ); } /* Forms */ /* in footer, call to action, quote, product header and product summary */ jq('#page form[data-cta-type=salonLocator]').each(function () { var pageLocElt = jq(this).closest('[data-page-section]'); // find the nearest parent with a page section attribute var pageLocVal = pageLocElt.attr('data-page-section'); // store the value of the page section attribute //jq(this).append(''); //jq(this).append(''); }); /* Style my hair */ // var styleString = '55event=StyleMyHair&55locationInPage='; jq('#page a[data-cta-type=styleMyHair]').each(function () { var currentHref = jq(this).attr('href');// current link href var pageLocElt = jq(this).closest('[data-page-section]');// find the nearest parent with a page section attribute var pageLocVal = pageLocElt.attr('data-page-section');// store the value of the page section attribute //jq(this).attr('href', currentHref + '?' + styleString + pageLocVal);// change the link href with the new value jq(this).attr('href', currentHref); }); /* Magazine */ //var magString = '55event=ReadMagazine&55locationInPage='; jq('#page a[data-cta-type=magazine], .nav-main [data-cta-type=magazine] a').each(function () { var currentHref = jq(this).attr('href');// current link href if (currentHref != '#' && currentHref != '') { var pageLocElt = jq(this).closest('[data-page-section]');// find the nearest parent with a page section attribute var pageLocVal = pageLocElt.attr('data-page-section');// store the value of the page section attribute //jq(this).attr('href', currentHref + '?' + magString + pageLocVal);// change the link href with the new value jq(this).attr('href', currentHref); } }); //general jq('[data-cta] a').each(function () { var locationParam = 'locationInPage=' + jq(this).closest('[data-page-section]').data('page-section'); var href = jq(this).attr('href'); if (href.indexOf('?') == -1) { locationParam = '?' + locationParam; } else { locationParam = '&' + locationParam; } jq(this).attr('href', href + locationParam); }); });