function GetFoundWords() { var t = "", e = /(<([^>]+)>)/gi, n = document.body.innerText; n = n.replace(e, " ").toLowerCase(); var r = "{wordstofind}".split(","); for (i = 0; i < r.length; i++) -1 != n.indexOf(r[i]) && (t += r[i] + ","); return t } function braindwLoadScript(t, e, n) { var r = $guadex = function (t) { r._.push(t) }, a = r.s = t.createElement(e), o = t.getElementsByTagName(e)[0]; r.set = function (t) { r.set._.push(t); }, r._ = [], r.set._ = [], a.async = !0, a.setAttribute("charset", "utf-8"), a.src = _URLBNDW + "/tracking/track?HASH=musitest09876&wordsfound=" + GetFoundWords() + "&buyer={CLIENT.BUYER}&name=&lastname=&gender=&country=&state=&city=&email=&u=" + escape(window.location) + "&hs=" + new Date, r.t = +new Date, a.type = "text/javascript", o.parentNode.insertBefore(a, o) } function braindNdwGetProperty(t) { if (t.toLowerCase() == 'og:price') { try { var sprice = $("div.prod-price-container span.price-e.conpromo:visible").first().text().trim(); if (sprice == '') { sprice = $("div.prod-price span.price-e:visible").first().text().trim(); } if (sprice == '') { if ($(".normal").find(".priceNumberAlignRightThree").first().text().trim() != '') return $(".normal").find(".priceNumberAlignRightThree").first().text().trim(); else return $(".internet").find(".priceNumberAlignRightTwo").first().text().trim(); } else { if (sprice.indexOf('$') == -1 && sprice.length > 0) sprice = '$' + sprice; } return sprice; } catch (err) { return ""; } } else if (t.toLowerCase() == 'og:pricesale') { try { var sprices = $("div.prod-price-container span.price-mas:visible").first().text().trim(); if (sprices === "") if ($(".normal").find(".priceNumberAlignRightThree").first().text().trim() != '') return $(".internet").find(".priceNumberAlignRightTwo").first().text().trim(); if (sprices.indexOf('$') == -1 && sprices.length > 0) sprices = '$' + sprices; return sprices; } catch (err) { return ""; } } else if (t.toLowerCase() == 'og:promotion') { try { var description = $(".prod-price-container a.product-promo-label-big-link:visible").first().text().trim(); if (description === '') return $('.exclusivo').first().text(); return description; } catch (err) { return ""; } } else if (t.toLowerCase() == 'og:brand') { try { $(".list_atributes li").each(function () { var a = $(this).find('span').text(); if (a.toLowerCase().indexOf('marca:') > -1) { return a.trim().split(':')[1].trim(); } }); return ""; } catch (err) { return ""; } } var e = document.getElementsByTagName("meta"); for (i = 0; i < e.length; i++) if (null != e[i].getAttribute("property") && e[i].getAttribute("property").toLowerCase() == t.toLowerCase()) { if (e[i].getAttribute("content") != '') return e[i].getAttribute("content"); else { try { if (t.toLowerCase() == 'og:title') { if (document.getElementById('GA_item_name').value != '') return document.getElementById('GA_item_name').value; else return skuJson_0.skus[0].skuname; } else if (t.toLowerCase() == 'og:image') { return skuJson_0.skus[0].image; } else if (t.toLowerCase() == 'og:url') { return $('link[rel=canonical]').attr('href'); } else if (t.toLowerCase() == 'og:category') { return ""; } else if (t.toLowerCase() == 'og:categorycode') { return ""; } else if (t.toLowerCase() == 'og:brand') { return ""; } } catch (ex) { } } } // VTEX try { if (typeof skuJson_0 != "undefined") { if (typeof skuJson_0.skus != "undefined") { if (skuJson_0.skus.length > 0) { var braindwVtx_script = $('script:contains("vtex.events.addData")').html(); var braindwVtx_json_ld = braindwVtx_script.substring(braindwVtx_script.indexOf('{'), braindwVtx_script.lastIndexOf('}') + 1); if (braindwVtx_json_ld.length) { var braindwVtx_json_pars = JSON.parse(braindwVtx_json_ld); if (typeof braindwVtx_json_pars.productBrandName != "undefined") { if (t.toLowerCase() == 'og:title') { return skuJson_0.skus[0].skuname; } else if (t.toLowerCase() == 'og:image') { return skuJson_0.skus[0].image; } else if (t.toLowerCase() == 'og:url') { return $('link[rel=canonical]').attr('href'); } else if (t.toLowerCase() == 'og:category') { return vtxctx.departmentName; } else if (t.toLowerCase() == 'og:categorycode') { return vtxctx.departmentyId; } else if (t.toLowerCase() == 'og:brand') { return braindwVtx_json_pars.productBrandName; } else if (t.toLowerCase() == 'og:codeproduct') { return braindwVtx_json_pars.productId; } } } } } } } catch (ex) { } return ""; } function BraindwDisableDay() { var t = _URLBNDW + "/tracking/", e = new XMLHttpRequest; e.open("GET", t, !0), e.onreadystatechange = function () { 4 == e.readyState && 200 == e.status && console.log(e.responseText) }, e.send("HASH=" + _HASHBNDW) } /*analytics braindw*/ (function (i, s, o, g, r, a, m) { i['GoogleAnalyticsObject'] = r; i[r] = i[r] || function () { (i[r].q = i[r].q || []).push(arguments) }, i[r].l = 1 * new Date(); a = s.createElement(o), m = s.getElementsByTagName(o)[0]; a.async = 1; a.src = g; m.parentNode.insertBefore(a, m) })(window, document, 'script', 'https://www.google-analytics.com/analytics.js', 'brainGa'); brainGa('create', 'UA-84821152-1', '.ndway.com'); brainGa('require', 'linkid', { 'cookieName': '.ndway.com', 'duration': 45, 'levels': 5 }); brainGa('set', 'userId', ''); //no borrar/modificar, replace brainGa('set', 'dimension1', ''); //no borrar/modificar, replace brainGa('set', 'dimension2', 'musitest09876'); //no borrar/modificar, replace brainGa('set', 'dimension3', ''); //no borrar/modificar, replace brainGa('set', 'dimension4', 'www.musimundo.com'); //no borrar/modificar, replace brainGa('set', 'dimension5', '/Busqueda'); //no borrar/modificar, replace if (typeof extArray !== 'undefined') { if (extArray['userid'] != null) { //alert(extArray['userid']); brainGa('set', 'dimension1', extArray['userid']); } } brainGa('send', 'pageview'); /*analytics braindw*/ var _HASHBNDW = "musitest09876", _PROTOCOLBNDW = "", _URLBNDW = ""; switch (window.location.protocol) { case "https:": _PROTOCOLBNDW = "https:"; break; case "http:": default: _PROTOCOLBNDW = "http:" } _URLBNDW = _PROTOCOLBNDW + "//sm.ndway.com", braindwLoadScript(document, "script", escape(window.location)), window.onpopstate = function (t) { braindwLoadScript(document, "script", escape(document.location)) }, function (t, e) { var n = $braindw = function (t) { n._.push(t); }, r = n.s = t.createElement(e), a = t.getElementsByTagName(e)[0]; n.set = function (t) { n.set._.push(t); }, n._ = [], n.set._ = [], r.async = !0, r.setAttribute("charset", "utf-8"); var o = encodeURIComponent(braindNdwGetProperty("og:title")), i = escape(braindNdwGetProperty("og:image")), s = escape(braindNdwGetProperty("og:url")), c = escape(braindNdwGetProperty("og:category")); var ogccodes = ''; cc = escape(braindNdwGetProperty("og:categorycode")); //bd = escape(braindNdwGetProperty("og:brand")); bd = escape(braindNdwGetProperty("product:brand")); if (bd == '') { try { $(".list_atributes li").each(function () { var a = $(this).find('span').text(); if (a.toLowerCase().indexOf('marca:') > -1) { bd = a.trim().split(':')[1].trim(); } }); } catch (err) { } } po = escape(braindNdwGetProperty("og:price")); ps = escape(braindNdwGetProperty("og:pricesale")); pm = escape(braindNdwGetProperty("og:promotion")); pol = ''; if (ps != '' && ps.length > 1 && po != '') { pol = po; po = ps; } else { pol = ''; ps = ''; } if (i.indexOf('/logo.png') > -1) { o = ''; i = ''; } codprod = escape(braindNdwGetProperty("og:codeproduct")); if (window.location.href.toLowerCase().indexOf('/producto~') != -1) { for (var ii = 0; ii < window.location.href.toLowerCase().split('/').length; ii++) { if (parseInt(window.location.href.toLowerCase().split('/')[ii].split('~')[0]) > 0) { if (ogccodes != '') ogccodes = ogccodes + ','; c = window.location.href.toLowerCase().split('/')[ii].split('~')[0]; ogccodes = ogccodes + c; } } } if (s != '') { if (s.toLowerCase().indexOf('home.aspx') == -1) { r.src = _URLBNDW + "/tracking/capture?HASH=" + _HASHBNDW + "&og:title=" + o + "&og:image=" + i + "&og:url=" + s + "&og:category=" + c + "&og:categorycode=" + cc + "&og:codeproduct=" + codprod + "&og:brand=" + bd + "&og:price=" + po + "&og:pricesale=" + ps + "&og:priceold=" + pol + "&og:promotion=" + pm + "&og:categoriescodes=" + ogccodes+"&hs=" + new Date, n.t = +new Date, r.type = "text/javascript", "" != o && "" != i && a.parentNode.insertBefore(r, a) } } }(document, "script"); $('.clickAddCart').click(function (e) { var producto = {}; var url = location.href; var productSelector = $(this).closest('.product'); var IsFicha = url.match(/.*?:\/\/(.*)musimundo.co(.*)producto~(.*)~(.*)$/g) !== null; if (IsFicha) { producto = buildProductFicha(productSelector); } else { producto = buildProductCatalogo(productSelector); } var _bndwOb = document.createElement('script'); _bndwOb.async = true; _bndwOb.src = "https://sm.ndway.com/tracking/capture?HASH=" + _HASHBNDW + "&iscart=1&og:title=" + producto.title + "&og:image=" + producto.image + "&og:url=" + url + "&og:category=" + producto.category + "&og:categorycode=" + producto.categoryCode + "&og:codeproduct=" + producto.codprod + "&og:brand=" + producto.brand + "&og:price=" + producto.price + "&og:pricesale=" + producto.priceSale + "&og:priceold=" + producto.priceold + "&og:promotion=" + producto.promotion + "&hs=" + new Date(); _bndwOb.charset = "UTF-8"; document.head.appendChild(_bndwOb); }); function bndwGetCategory(isFicha) { var BwnCatId = ''; var resta = isFicha ? 2 : 1; try { var catDirectItem = $('.breadcrumb').find('li')[$('.breadcrumb').find('li').length - resta]; var linkData = $(catDirectItem).find('a').attr('href'); BwnCatId = linkData.split('/')[linkData.split('/').length - 2].split('~')[0]; } catch (e) { } return BwnCatId; } function buildProductFicha(element) { return { title: $(element).find('.name').length > 0 ? $(element).find('.name').html() : '', image: $(element).find('#bigImage').length > 0 ? $(element).find('#bigImage').attr('src') : '', category: '', categoryCode: bndwGetCategory(true), codprod: $(element).find('.equicode').length > 0 ? $(element).find('.equicode').html() : '', brand: '', price: $(element).find('.prices.online').length > 0 ? $(element).find('.prices.online .value').html().trim() : '', priceSale: $(element).find('.prices.online').length > 0 ? $(element).find('.prices.online .value').html().trim() : '', priceold: $(element).find('.prices.cash').length > 0 ? $(element).find('.prices.cash .value').first().text().trim() : '', promotion: '' } } function buildProductCatalogo(element) { return { title: $(element).find('.name').length > 0 ? $(element).find('.name').html() : '', image: $(element).find('.img img').length > 0 ? $(element).find('.img img').attr('src') : '', category: '', categoryCode: bndwGetCategory(false), codprod: $(element).find('.equicode').length > 0 ? $(element).find('.equicode').html() : '', brand: '', price: $(element).find('.price.online').length > 0 ? $(element).find('.price.online').html().trim() : '', priceSale: $(element).find('.price.online').length > 0 ? $(element).find('.price.online').html().trim() : '', priceold: $(element).find('.price.cash').length > 0 ? $(element).find('.price.cash').html().trim() : '', promotion: '' } } try{ console.log('[abtest 0] [usertest ]'); } catch(e) {console.log('error load abtest log')}