( function( $ ) { console.log('GA4'); setTimeout(() => { $('#menu-item-4272').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event':'garantia_politicas_garantias', 'event_name':'garantia_politicas_garantias', 'event_action': 'click', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'mega_menu' }); console.log("window.dataLayer: ",window.dataLayer); }); $('#menu-item-4271').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'garantia_plan_mantenimiento', 'event_name':'garantia_plan_mantenimiento', 'event_action': 'click', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'mega_menu' }); console.log("window.dataLayer: ",window.dataLayer); }); $('#menu-item-109').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event':'mega_menu_agendar_test_ride', 'event_name':'mega_menu_agendar_test_ride', 'event_action': 'click', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'mega_menu' }); console.log("window.dataLayer: ",window.dataLayer); }); $('#menu-item-108').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'mega_menu_tienda_en_linea', 'event_name':'mega_menu_tienda_en_linea', 'event_action': 'click', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'mega_menu' }); console.log("window.dataLayer: ",window.dataLayer); }); // Modelos Trabajo $('#menu-item-6420, #menu-item-6436, #menu-item-6439, #menu-item-4300').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'mega_menu_modelos', 'event_name':'mega_menu_modelos', 'event_action': 'click', 'text_categoria': 'TRABAJO', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'mega_menu' }); console.log("window.dataLayer: ",window.dataLayer); }); // Modelos urbanas $('#menu-item-6830, #menu-item-6000, #menu-item-6831, #menu-item-4303, #menu-item-4304, #menu-item-4306').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'mega_menu_modelos', 'event_name':'mega_menu_modelos', 'event_action': 'click', 'text_categoria': 'URBANAS', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'mega_menu' }); console.log("window.dataLayer: ",window.dataLayer); }); // Modelos doble propósito $('#menu-item-96').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'mega_menu_modelos', 'event_name':'mega_menu_modelos', 'event_action': 'click', 'text_categoria': 'DOBLE PROPÓSITO', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'mega_menu' }); console.log("window.dataLayer: ",window.dataLayer); }); // Modelos scooter $('#menu-item-4307').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'mega_menu_modelos', 'event_name':'mega_menu_modelos', 'event_action': 'click', 'text_categoria': 'SCOOTER', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'mega_menu' }); console.log("window.dataLayer: ",window.dataLayer); }); // Carousel $('.swiper-slide a').click(function(e) { var textoEnlace = $(this).children(".swiper-slide-inner").children(".elementor-image-carousel-caption").text(); window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'home_modelo_de_moto', 'event_name':'home_modelo_de_moto', 'event_action': 'click', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'carousel' }); console.log("window.dataLayer: ",window.dataLayer); }); // distribuidores $('#encuentralo_aqui').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'home_distribuidores', 'event_name':'home_distribuidores', 'event_action': 'click', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'cart' }); console.log("window.dataLayer: ",window.dataLayer); }); // repuestos $('#compralos_aqui').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'home_repuestos', 'event_name':'home_repuestos', 'event_action': 'click', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'cart' }); console.log("window.dataLayer: ",window.dataLayer); }); // whatsapp $('.joinchat__button').click(function(e) { let urlText = window.location.href; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'cta_escribenos_wp', 'event_name':'cta_escribenos_wp', 'event_action': 'click', 'text_url': urlText, 'origin': 'web', 'type_element': 'button' }); console.log("window.dataLayer: ",window.dataLayer); }); //Separar $('#gtm_separar').click(function(e) { let textoEnlace = e.target.innerText; let urlText = window.location.href; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'detallemoto_cta_separar', 'event_name':'detallemoto_cta_separar', 'event_action': 'click', 'text_name': textoEnlace, 'text_url': urlText, 'origin': 'web', 'type_element': 'button' }); console.log("window.dataLayer: ",window.dataLayer); }); //cotizar $('#gtm_cotizar').click(function(e) { let textoEnlace = e.target.innerText; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'detallemoto_cotizar', 'event_name':'detallemoto_cotizar', 'event_action': 'click', 'text_name': textoEnlace, 'origin': 'web', 'type_element': 'banner' }); console.log("window.dataLayer: ",window.dataLayer); }); //agendar_test_drive $('#agendar_test_drive').click(function(e) { let textoEnlace = e.target.innerText; let urlText = window.location.href; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'detallemoto_cta_agendar_test_drive', 'event_name':'detallemoto_cta_agendar_test_drive', 'event_action': 'click', 'text_name': textoEnlace, 'text_url': urlText, 'origin': 'web', 'type_element': 'button' }); console.log("window.dataLayer: ",window.dataLayer); }); //cotizar-caracteristica-espe $('#tab-cotizar-caracteristica-espe').click(function(e) { let textoEnlace = e.target.innerText; let urlText = window.location.href; let event = ''; switch (textoEnlace) { case 'COTIZAR': event = 'detallemoto_cta_tab_cotizar'; break; case 'CARACTERÍSTICAS': event = 'detallemoto_cta_tab_caracteristicas'; break; case 'ESPECIFICACIONES Y DETALLES': event = 'detallemoto_cta_tab_especificaciones'; break; default: break; } window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': event, 'event_name':event, 'event_action': 'click', 'text_name': textoEnlace, 'text_url': urlText, 'origin': 'web', 'type_element': 'button' }); console.log("window.dataLayer: ",window.dataLayer); }); //tiendas talleres $('#agencias_talleres').click(function(e) { let textoEnlace = e.target.innerText; let urlText = window.location.href; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'detallemoto_cta_tiendas_y_talleres', 'event_name':'detallemoto_cta_tiendas_y_talleres', 'event_action': 'click', 'text_name': textoEnlace, 'text_url': urlText, 'origin': 'web', 'type_element': 'cart' }); console.log("window.dataLayer: ",window.dataLayer); }); //Repuestos $('#repuestos').click(function(e) { let textoEnlace = e.target.innerText; let urlText = window.location.href; window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'detallemoto_cta_repuestos', 'event_name':'detallemoto_cta_repuestos', 'event_action': 'click', 'text_name': textoEnlace, 'text_url': urlText, 'origin': 'web', 'type_element': 'cart' }); console.log("window.dataLayer: ",window.dataLayer); }); //Slider banner $('.gtm_banner').click(function(e) { let textoEnlace = e.target.innerText; var href = $(this).attr('href'); window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'home_banner_principal', 'event_name':'home_banner_principal', 'event_action': 'click', 'text_title': textoEnlace, 'text_url': href, 'origin': 'web', 'type_element': 'slider' }); console.log("window.dataLayer: ",window.dataLayer); }); //Footer $('.gtm_footer').click(function(e) { let textoEnlace = e.target.innerText; var href = $(this).attr('href'); var href2 = $(this).children(".elementor-widget-container").children(".elementor-heading-title").children("a").attr('href'); var urlText = ''; if(href == undefined){ urlText = href2; }else{ urlText =href; } window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'footer_enlaces', 'event_name':'footer_enlaces', 'event_action': 'click', 'text_name': textoEnlace, 'text_url': urlText, 'origin': 'web', 'type_element': 'cart' }); console.log("window.dataLayer: ",window.dataLayer); }); console.log('-->'); }, 300); setTimeout(() => { console.log('maps'); //Mapa $('.sl-item').click(function(e) { let nombre_taller = $(this).children(".sl-addr-sec").children("h3").text(); let direccion = $(this).children(".sl-addr-sec").children(".addr-loc").children("ul").children(".sl-addr").text().split(","); // let phone = $(this).children(".sl-addr-sec").children(".addr-loc").children("ul").children(".sl-phone").text(); let ciudad = direccion[0].trim(); let departamento = direccion[1].trim(); window.dataLayer = window.dataLayer || []; window.dataLayer.push({ 'event': 'talleres_cta_detalle_de_taller', 'event_name':'talleres_cta_detalle_de_taller', 'event_action': 'click', 'text_nombre_taller': nombre_taller.trim(), 'text_departamento': departamento, 'text_ciudad': ciudad, 'origin': 'web', 'type_element': 'cart' }); console.log("window.dataLayer: ",window.dataLayer); }); }, 9000); })( jQuery );