Utilizamos cookies para mejorar su experiencia de compra. Usted podrá seleccionar las cookies nuestra y de terceros que desea utilizar en cualquier momento.
// Instantiate the tracking class
var rcAnalyticsEvents = new RcAnalyticsEvents();
// page controller
var controllerName = 'category';
var compliantModules = {"default":"order","supercheckout":"supercheckout","onepagecheckoutps":"order","sveacheckout":"sveapaypage","thecheckout":"order","steasycheckout":"default"};
var compliantModuleName = 'default';
var skipCartStep = '';
var isOrder = '';
var isCheckout = '';
var isClientId = 0;
var gaOrder;
var gaProducts;
////////////////////////////
// set tracking features
rcAnalyticsEvents.trackingFeatures = {"analyticsId":"UA-206850117-1","adwordsId":"AW-304797200","adwordsCl":"e5L_CMKU0_YCEJCsq5EB","productSendRate":10,"merchantPrefix":"","merchantSuffix":"","merchantVariant":"","businessDataPrefix":"","businessDataVariant":"","currency":"MXN","idShop":1,"productsPerPage":24,"cartAjax":1,"token":"a9b86829a7a41e60e7b65f79b9b5e76d","disableInternalTracking":false,"signUpTypes":["new customer","guest customer"],"isNewSignUp":false,"isGuest":0,"checkDoNotTrack":1,"config":{"optimizeId":"","simpleSpeedSampleRate":1,"anonymizeIp":1,"linkAttribution":1,"userIdFeature":1,"userIdValue":null,"remarketing":1,"crossDomainList":"","clientId":0,"businessData":0,"customDimensions":{"ecommProdId":3,"ecommPageType":4,"ecommTotalValue":5,"ecommCategory":6,"dynxItemId":5,"dynxItemId2":6,"dynxPageType":7,"dynxTotalValue":8}},"goals":{"signUp":1,"socialAction":1},"eventValues":{"signUp":0,"socialAction":0}};
// set checkout values
rcAnalyticsEvents.controllerName = controllerName;
rcAnalyticsEvents.isCheckout = isCheckout;
rcAnalyticsEvents.compliantModuleName = compliantModuleName;
rcAnalyticsEvents.skipCartStep = skipCartStep;
// list names
rcAnalyticsEvents.lists = {"default":"category","filter":"filtered_results"};
// Google remarketing - page type
rcAnalyticsEvents.ecommPageType = 'category';
// get products list to cache
rcAnalyticsEvents.productsListCache = {"1503-0":{"id":"1503","id_product":"1503","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"ESTUCHE ADIDAS WOMEN FRUITY RHYTHM CON AGUA DE TOCADOR + GEL DE DUCHA","category":"Productos_destacados","category_name":"Productos destacados","reference":"3617224882976","supplier_reference":"","ean13":"3617224882976","price_amount":165.770000000000010231815394945442676544189453125},"2070-0":{"id":"2070","id_product":"2070","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"JAB\u00d3N MAJA CL\u00c1SICO RECTANGULAR DE 90 G","category":"Productos_destacados","category_name":"Productos destacados","reference":"7501046110003","supplier_reference":"","ean13":"7501046110003","price_amount":30.489999999999998436805981327779591083526611328125},"2071-0":{"id":"2071","id_product":"2071","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"JAB\u00d3N MAJA CL\u00c1SICO REDONDO DE 110 G CON JABONERA","category":"Productos_destacados","category_name":"Productos destacados","reference":"7501046111093","supplier_reference":"","ean13":"7501046111093","price_amount":49.07000000000000028421709430404007434844970703125},"2072-0":{"id":"2072","id_product":"2072","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"JAB\u00d3N MAJA CL\u00c1SICO REDONDO DE 140 G","category":"Productos_destacados","category_name":"Productos destacados","reference":"7501046110287","supplier_reference":"","ean13":"7501046110287","price_amount":44.28999999999999914734871708787977695465087890625},"2073-0":{"id":"2073","id_product":"2073","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"JAB\u00d3N MAJA FLOR CIRUELO MORADO DE 100 G","category":"Productos_destacados","category_name":"Productos destacados","reference":"0037836092824","supplier_reference":"","ean13":"0037836092824","price_amount":34.8599999999999994315658113919198513031005859375},"2074-0":{"id":"2074","id_product":"2074","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"JAB\u00d3N MAJA OVALADO CON 3 PIEZAS DE 50 G","category":"Productos_destacados","category_name":"Productos destacados","reference":"7501046110300","supplier_reference":"","ean13":"7501046110300","price_amount":71.969999999999998863131622783839702606201171875},"2076-0":{"id":"2076","id_product":"2076","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"JAB\u00d3N MAJA RECTANGULAR DE 90 G CON ESTUCHE","category":"Productos_destacados","category_name":"Productos destacados","reference":"7501046111086","supplier_reference":"","ean13":"7501046111086","price_amount":34.14999999999999857891452847979962825775146484375},"3695-0":{"id":"3695","id_product":"3695","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TALQUERA MAJA CON BORLA CON 150 G","category":"Productos_destacados","category_name":"Productos destacados","reference":"7501046102299","supplier_reference":"","ean13":"7501046102299","price_amount":144.94999999999998863131622783839702606201171875},"1504-0":{"id":"1504","id_product":"1504","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"ESTUCHE BRUT CLASSIC PACK COLONIA DE 100 ML + LOCI\u00d3N DESPU\u00c9S DEL AFEITADO","category":"Productos_destacados","category_name":"Productos destacados","reference":"7502221187124","supplier_reference":"","ean13":"7502221187124","price_amount":185.94999999999998863131622783839702606201171875},"1505-0":{"id":"1505","id_product":"1505","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"ESTUCHE BRUT DEEP BLUE PACK COLONIA DE 100 ML + DESODORANTE EN AEROSOL","category":"Productos_destacados","category_name":"Productos destacados","reference":"7502221187452","supplier_reference":"","ean13":"7502221187452","price_amount":131.340000000000003410605131648480892181396484375},"1506-0":{"id":"1506","id_product":"1506","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"ESTUCHE BRUT GOLD LEGACY PACK COLONIA DE 100 ML + DESODORANTE EN AEROSOL","category":"Productos_destacados","category_name":"Productos destacados","reference":"7502221187469","supplier_reference":"","ean13":"7502221187469","price_amount":131.340000000000003410605131648480892181396484375},"1507-0":{"id":"1507","id_product":"1507","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"ESTUCHE GILLETTE MACH 3 TURBO CON 1 MAQUINA + 3 CARTUCHOS + 1 BOLSA PARA ZAPATOS","category":"Productos_destacados","category_name":"Productos destacados","reference":"7500435122665","supplier_reference":"","ean13":"7500435122665","price_amount":155.169999999999987494447850622236728668212890625},"1508-0":{"id":"1508","id_product":"1508","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"ESTUCHE PARA BA\u00d1O HUGGIES RELAJANTE CON 4 PIEZAS","category":"Productos_destacados","category_name":"Productos destacados","reference":"7501943449701","supplier_reference":"","ean13":"7501943449701","price_amount":55.340000000000003410605131648480892181396484375},"2075-0":{"id":"2075","id_product":"2075","id_category_default":"199","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"JAB\u00d3N MAJA RECTANGULAR CON 3 PIEZAS DE 90 G","category":"Productos_destacados","category_name":"Productos destacados","reference":"8410190298477","supplier_reference":"","ean13":"8410190298477","price_amount":106.6099999999999994315658113919198513031005859375}};
// Listing products
/////////////////////////////////
// init gtag
rcAnalyticsEvents.sendGtagConfig('analyticsId');
rcAnalyticsEvents.sendGtagConfig('adwordsId');
///////////////////////////////////////////////
// Initialize all user events when DOM ready
document.addEventListener('DOMContentLoaded', initTrackingEvents, false);
window.addEventListener('pageshow', fireEventsOnPageShow, false);
///////////////////////////////////////////////
function initTrackingEvents() {
// Events binded on all pages
// Events binded to document.body to avoid firefox fire events on right/central click
document.body.addEventListener('click', rcAnalyticsEvents.eventClickPromotionItem, false);
// bind prestashop events with tracking events
prestashop.on(
'updateCart',
function (event) {
rcAnalyticsEvents.eventAddCartProduct(event);
}
);
prestashop.on(
'clickQuickView',
function (event) {
rcAnalyticsEvents.eventProductView(event)
}
);
prestashop.on(
'updatedProduct',
function (event) {
rcAnalyticsEvents.eventProductView(event)
}
);
if (!isCheckout && !isOrder) {
// init first scroll action for those products all ready visible on screen
rcAnalyticsEvents.eventScrollList();
// bind event to scroll
window.addEventListener('scroll', rcAnalyticsEvents.eventScrollList, false);
// init Event Listeners
document.body.addEventListener('click', rcAnalyticsEvents.eventClickProductList, false);
document.body.addEventListener('click', rcAnalyticsEvents.eventGetAddCartQuantity, false);
if (rcAnalyticsEvents.trackingFeatures.goals.socialAction) {
document.body.addEventListener('click', rcAnalyticsEvents.eventSocialShareProductView, false);
}
////////////////////////
// SEARCH PAGE
if (controllerName === 'search') {
rcAnalyticsEvents.onSearchResults();
}
////////////////////////
// PRODUCT PAGE
if (controllerName === 'product') {
// send product detail view
rcAnalyticsEvents.eventProductView();
}
}
////////////////////////
// CHECKOUT PROCESS
if (isCheckout) {
// SUMMARY CART
if (controllerName === 'cart') {
// events on summary Cart
document.body.addEventListener('click', rcAnalyticsEvents.eventCartQuantityDelete, false);
document.body.addEventListener('click', rcAnalyticsEvents.eventCartQuantityUp, false);
document.body.addEventListener('click', rcAnalyticsEvents.eventCartQuantityDown, false);
}
////////////////////////
// CHECKOUT
if (compliantModuleName === 'default' && controllerName === 'order') {
// Events on Checkout Process
document.body.addEventListener('click', rcAnalyticsEvents.eventPrestashopCheckout, false);
} else if (
compliantModuleName === 'supercheckout'
&& controllerName === compliantModules[compliantModuleName]
) {
// Compatible with super-checkout by Knowband
document.body.addEventListener('click', rcAnalyticsEvents.eventOpcSuperCheckout, false);
document.body.addEventListener('click', rcAnalyticsEvents.eventCartOpcSuperCheckout, false);
} else if (
compliantModuleName === 'onepagecheckoutps'
&& controllerName === compliantModules[compliantModuleName]
) {
// compatible with OPC by PrestaTeamShop
document.body.addEventListener('click', rcAnalyticsEvents.eventOpcPrestaTeam, false);
document.body.addEventListener('click', rcAnalyticsEvents.eventCartOpcPrestaTeam, false);
} else if (
compliantModuleName === 'thecheckout'
&& controllerName === compliantModules[compliantModuleName]
) {
// Compatible with thecheckout by Zelarg
document.body.addEventListener('click', rcAnalyticsEvents.eventOpcTheCheckout, false);
document.body.addEventListener('click', rcAnalyticsEvents.eventCartOpcTheCheckout, false);
} else if (
compliantModuleName === 'steasycheckout'
&& controllerName === compliantModules[compliantModuleName]
) {
// Events for steasycheckout
document.body.addEventListener('click', rcAnalyticsEvents.eventOpcStEasyCheckout, false);
document.body.addEventListener('click', rcAnalyticsEvents.eventCartOpcStEasyCheckout, false);
}
}
}
function fireEventsOnPageShow(event){
// fixes safari back cache button
if (event.persisted) {
window.location.reload()
}
// Sign up feature
if (rcAnalyticsEvents.trackingFeatures.goals.signUp && rcAnalyticsEvents.trackingFeatures.isNewSignUp) {
rcAnalyticsEvents.onSignUp();
}
if (isClientId) {
rcAnalyticsEvents.setClientId();
}
// Checkout and order complete
if (isCheckout && gaProducts) {
rcAnalyticsEvents.onCheckoutProducts(gaProducts);
} else if (isOrder && gaOrder && gaProducts) {
rcAnalyticsEvents.onAddOrder(gaOrder, gaProducts, rcAnalyticsEvents.trackingFeatures.idShop);
}
}