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 = {"3793-0":{"id":"3793","id_product":"3793","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN CASTA\u00d1O BARBA Y BIGOTE","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111431","supplier_reference":"","ean13":"7501080111431","price_amount":170.020000000000010231815394945442676544189453125},"3794-0":{"id":"3794","id_product":"3794","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN CASTA\u00d1O CLARO BARBA Y BIGOTE","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111462","supplier_reference":"","ean13":"7501080111462","price_amount":189.909999999999996589394868351519107818603515625},"3795-0":{"id":"3795","id_product":"3795","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN CASTA\u00d1O MEDIO CABELLO","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111134","supplier_reference":"","ean13":"7501080111134","price_amount":189.909999999999996589394868351519107818603515625},"3796-0":{"id":"3796","id_product":"3796","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN CASTA\u00d1O NEGRO CABELLO","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111141","supplier_reference":"","ean13":"7501080111141","price_amount":189.909999999999996589394868351519107818603515625},"3797-0":{"id":"3797","id_product":"3797","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN CASTA\u00d1O OSCURO BARBA Y BIGOTE","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111448","supplier_reference":"","ean13":"7501080111448","price_amount":180.8700000000000045474735088646411895751953125},"3799-0":{"id":"3799","id_product":"3799","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN CASTA\u00d1O\/OSCURO BARBA","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111400","supplier_reference":"","ean13":"7501080111400","price_amount":172.259999999999990905052982270717620849609375},"3800-0":{"id":"3800","id_product":"3800","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN CONTROL GRAD CABELLO","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080120020","supplier_reference":"","ean13":"7501080120020","price_amount":139.169999999999987494447850622236728668212890625},"3801-0":{"id":"3801","id_product":"3801","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN NEGRO BARBA Y BIGOTE","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111455","supplier_reference":"","ean13":"7501080111455","price_amount":180.8700000000000045474735088646411895751953125},"3802-0":{"id":"3802","id_product":"3802","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN NEGRO CABELLO 60 ML","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111325","supplier_reference":"","ean13":"7501080111325","price_amount":189.909999999999996589394868351519107818603515625},"3798-0":{"id":"3798","id_product":"3798","id_category_default":"159","id_manufacturer":"0","id_product_attribute":"0","cache_default_attribute":"0","name":"TINTE JUST FOR MEN CASTA\u00d1O OSCURO CABELLO","category":"Tinte_masculino","category_name":"Tinte masculino","reference":"7501080111226","supplier_reference":"","ean13":"7501080111226","price_amount":189.909999999999996589394868351519107818603515625}};
// 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);
}
}