siteMapPerso

landingEventos

3/7/2024 5:42:51 PM

Changes

src/mySiteMap.js 82(+79 -3)

Details

src/mySiteMap.js 82(+79 -3)

diff --git a/src/mySiteMap.js b/src/mySiteMap.js
index a29b028..727d2ee 100644
--- a/src/mySiteMap.js
+++ b/src/mySiteMap.js
@@ -84,6 +84,12 @@ let logInWallListeners = [
     { class: `#vplsignup input.vsmform.submit`, labelName: 'Botón - Registrarme', ItPropagation: false },
 ]
 
+let landingEventosListeners = [
+    { class: `#btnInscribite`, labelName: 'Botón - Inscribite', ItPropagation: false },
+    { class: `.vsmform.submit`, labelName: 'Botón - Confirmar', ItPropagation: false },
+]
+
+
 //SELECTORES Articulo
 let articleListeners = [
     { class: `nav.breadcrumb ol li a span`, labelName: 'Breadcrumb', ItPropagation: false },
@@ -168,6 +174,14 @@ let globalDataInteractions = {
     name: "Datos Globales"
 }
 
+let landingEventosGeneralInteractions = {
+    name: "Eventos General"
+}
+
+let landingEventosInteractions = {
+    name: "Inscripción a eventos"
+}
+
 //LLamadas a las distintas page type para el match
 const home = new PageType("Home", "cronista.com", homeInteractions, homeListeners, false);
 const payWall = new PageType("PayWall", "cronista.com/suscripciones", payWallInteractions, payWallListeners, false);
@@ -177,9 +191,12 @@ const mercadosOnline = new PageType("Mercados Online", "cronista.com/informacion
 const streamingExclusivo = new PageType("Streaming Exclusivo", "cronista.com/on-air/streaming-exclusivo", streamingExclusivoInteractions, streamingExclusivoListeners, false);
 const confirmacionOnAir = new PageType("ConfirmacionOnAir", "cronista.com/on-air/confirmacion-on-air", confirmacionOnAirInteractions, [], false);
 const suscriptionsForm = new PageType("Suscriptions form", "cronista.com/suscripciones/plan-xxx", suscriptionsFormInteractions, suscriptionsFormListeners, false);
-//La confirmación a la suscripción se va trackear directamente en el arcchivo suscription.js del cms
+//La confirmación a la suscripción se va trackear directamente en el archivo suscription.js del cms
 //const suscriptionsConfirm = new PageType("Suscriptions Confirm", "cronista.com/suscripciones/plan-xxx/#listo", suscriptionsConfirmInteractions, [], false);
 const globalData = new PageType("Datos Globales", "cronista.com/datos", globalDataInteractions, [], false);
+const landingEventosGeneral = new PageType("Eventos General", "cronista.com/eventos", landingEventosGeneralInteractions, [], false);
+const landingInternaEvento = new PageType("Inscripción a eventos", "cronista.com/eventos/", landingEventosInteractions, landingEventosListeners, false);
+
 
 
 if (validarParteDeURL(window.location.href, "MercadosOnline") && !validarParteDeURL(window.location.href, "cronista.com/MercadosOnline/dolar.html")) {
@@ -251,9 +268,9 @@ if (document.querySelector("#pagecontent .news") || document.querySelector("#pag
 
 //Función que devuelve el array con las info de las pageType
 /*[home, payWall, article, logInWall, landingDolar, mercadosOnline, confirmacionOnAir,
-streamingExclusivo, suscriptionsForm, suscriptionsConfirm]*/
+streamingExclusivo, suscriptionsForm, suscriptionsConfirm, landingEventosGeneral, landingEventos]*/
 function Pages() {
-    pages.push(home, payWall, logInWall, landingDolar, mercadosOnline, confirmacionOnAir, streamingExclusivo, suscriptionsForm, globalData)
+    pages.push(home, payWall, logInWall, landingDolar, mercadosOnline, confirmacionOnAir, streamingExclusivo, suscriptionsForm, globalData, landingEventosGeneral, landingInternaEvento)
     return pages
 }
 
@@ -281,6 +298,16 @@ function PageType(name, myUrl, interaction, myEvents, IsTemplate) {
             if (name == "Suscriptions form" && validarParteDeURL(url, "cronista.com/suscripciones/plan-") && !validarParteDeURL(url, "/#listo")) {
                 isMatch = true
             }
+            if (name == "Inscripción a eventos" && validarParteDeURL(url, "cronista.com/eventos/") && !validarParteDeURL(url, "cronista.com/eventos/thankyou-page")) {
+                interaction.name = name + ": " + SalesforceInteractions.cashDom(document.querySelector(".eventtitle")).text()
+
+                isMatch = true
+            }
+            if (name == "Inscripción a eventos" && validarParteDeURL(url, "cronista.com/eventos/thankyou-page")) {
+                interaction.name = name + ": Thankyou-page" + " " + SalesforceInteractions.cashDom(document.querySelector(".eventtitle")).text()
+                isMatch = true
+            }
+
         }
         return isMatch;
     };
@@ -440,6 +467,53 @@ function ReadGlobalEvents(event, listeners) {
         }
     }
 
+    if (listeners.labelName == 'Botón - Confirmar') {
+        isSend = false
+        const campos = [
+            'vsm_username',
+            'vsm_lastname',
+            'vsm_eMail',
+            'Ocupación',
+            'vsm_company',
+            'vsm_jobtitle'
+        ];
+
+        const valoresCampos = {};
+
+        campos.forEach(nombreCampo => {
+            valoresCampos[nombreCampo] = document.querySelector(`input[name="${nombreCampo}"], select[name="${nombreCampo}"]`).value;
+        });
+
+        for (let nombreCampo in valoresCampos) {
+            if (!valoresCampos[nombreCampo].trim()) {
+                console(`Por favor ingresa ${nombreCampo.replace('_', ' ')}.`);
+                break;
+            }
+        }
+
+        SalesforceInteractions.sendEvent({
+            interaction: {
+                name: dataName + ": " + SalesforceInteractions.cashDom(document.querySelector(".eventtitle")).text(),
+            },
+            user: {
+                attributes: {
+                    userIdCms: vsm.session.id,
+                    name: document.querySelector('input[name="vsm_username"]').value,
+                    lastName: document.querySelector('input[name="vsm_lastname"]').value,
+                    dni: "",
+                    phone: "",
+                    isSuscriber: isSuscriber,
+                    emailAddress: document.querySelector('input[name="vsm_eMail"]').value,
+                    continueUrl: url,
+                    isAnonimus: isAnonimus,
+                    ocupacion: document.querySelector('select[name="Ocupación"]').value,
+                    empresa: document.querySelector('input[name="vsm_company"]').value,
+                    puesto: document.querySelector('input[name="vsm_jobtitle"]').value,
+                },
+            }
+        });
+    }
+
     if (isSend) {
         SalesforceInteractions.sendEvent({
             interaction: {
@@ -460,6 +534,8 @@ function ReadGlobalEvents(event, listeners) {
             }
         });
     }
+
+
 }
 
 function GenerateContentZones(zones) {