siteMapPerso

article

11/14/2023 3:05:30 PM

Changes

mySiteMap.js 42(+31 -11)

Details

mySiteMap.js 42(+31 -11)

diff --git a/mySiteMap.js b/mySiteMap.js
index 75b5101..b154381 100644
--- a/mySiteMap.js
+++ b/mySiteMap.js
@@ -32,7 +32,7 @@ let globalListeners = [
 ]
 //
 
-//SELECTORES y zonas Home
+//SELECTORES Home
 let homeListeners = [
     { class: `.section article.item`, labelName: '' },
     { class: `.sectionfull article.item`, labelName: '' },
@@ -40,6 +40,7 @@ let homeListeners = [
     { class: `.columnists .items article.item`, labelName: 'Clumnists from Home' },
 ]
 
+//SELECTORES Home pay wall
 let payWallListeners = [
     { class: `.page.suscripciones a.logo`, labelName: 'Botón - Header Logo El Cronista from Pay Wall' },
     { class: `.panel:first-child .suscripcion .items:first-child .item .button`, labelName: 'Botón - Quiero suscribirme:  Promo elecciones' },
@@ -48,7 +49,8 @@ let payWallListeners = [
     { class: `.panel:nth-child(2) .suscripcion .items .item:nth-child(3) .button`, labelName: 'Botón - Quiero suscribirme: Print Full' },
     { class: `.panel .suscripcion .items .item .list_items`, labelName: 'Botón - Mostrar detalles de  planes' },
     { class: "#page-header-session-box .sign-in-button", labelName: 'Botón Ingresar From Pay wall' },
-    { class: `.otros-planes__item a`, labelName: '' },
+    { class: `.otros-planes .otros-planes__item:first-child p a`, labelName: 'Botón - Plan Jubilado' },
+    { class: `.otros-planes .otros-planes__item:nth-child(2) p a`, labelName: 'Botón - Plan Estudiante' },
     { class: `.page.suscripciones .whatsapp-wrapper`, labelName: 'Botón Whatsapp from Pay Wall' },
     { class: `.footer-footer a:first-child`, labelName: 'Botón Terminos y condiciones from Pay Wall' },
     { class: `.footer-footer a:nth-child(2)`, labelName: 'Botón Precios vigentes from Pay Wall' },
@@ -58,8 +60,15 @@ let homeInteractions = {
     name: "Home"
 }
 
+let payWallInteractions = {
+    name: "PayWall"
+}
+
 const home = new PageType("Home", "cronista.com", homeInteractions, homeListeners);
-const payWall = new PageType("PayWall", `cronista.com/suscripciones/`, homeInteractions, payWallListeners);
+const payWall = new PageType("PayWall", `cronista.com/suscripciones`, payWallInteractions, payWallListeners);
+//const article = new PageType("Article", `article`, payWallInteractions, payWallListeners);
+
+
 
 function Pages() {
     return [home, payWall]
@@ -107,26 +116,37 @@ function PageType(name, myUrl, interaction, myEvents) {
     this.interaction = interaction;
     this.isMatch = () => {
         let url = window.location.href;
-        if (url.includes('?') || url.includes('/')) {
+        if (url.includes('?')) {
             url = url.slice(0, window.location.href.lastIndexOf('?'));
         }
-        console.log(url)
+        if (url.charAt(url.length - 1) === '/') {
+            url = url.slice(0, window.location.href.lastIndexOf('/'));
+        } else {
+            console.log('La URL NO termina con "/"');
+        }
+
         isMatch = (url === `${enviroment}${myUrl}` ? true : false);
+        console.log(url)
         console.log(isMatch)
         return isMatch;
     };
     this.listeners = GenerateListeners(name, myEvents);
     if (name == "PayWall") {
         this.onActionEvent = (actionEvent) => {
-            if (email) {
-                let limit = new URL(window.location.href).searchParams.get("limit")
-                console.log("limit: " + limit)
+            let limit = new URL(window.location.href).searchParams.get("limit")
+            actionEvent.user = actionEvent.user || {};
+            actionEvent.user.attributes = actionEvent.user.attributes || {};
+            console.log("limit: " + limit)
+            console.log(typeof (limit))
+            if (limit != null) {
+                const isLimit = limit === 'true';
+                actionEvent.user.attributes.typeOfEntry = !isLimit ? "choque exclusivo" : "choque metered";
                 let continueUrl = new URL(window.location.href).searchParams.get("continue")
-                actionEvent.user = actionEvent.user || {};
-                actionEvent.user.attributes = actionEvent.user.attributes || {};
-                actionEvent.user.attributes.typeOfEntry = limit ? "limite de 9 notas" : "choque metered";
                 actionEvent.user.attributes.continueUrl = continueUrl;
+            } else {
+                actionEvent.user.attributes.typeOfEntry = "Choque directo";
             }
+
             return actionEvent;
         }
     }