siteMapPerso

paywall

11/22/2023 3:24:37 PM

Changes

siteMap.js 21(+8 -13)

Details

siteMap.js 21(+8 -13)

diff --git a/siteMap.js b/siteMap.js
index 9ce8c56..69cb107 100644
--- a/siteMap.js
+++ b/siteMap.js
@@ -78,7 +78,7 @@ let payWallInteractions = {
 }
 
 const home = new PageType("Home", "cronista.com", homeInteractions, homeListeners, false);
-const payWall = new PageType("PayWall", `cronista.com/suscripciones`, payWallInteractions, payWallListeners, false);
+const payWall = new PageType(PayWallActions(), `cronista.com/suscripciones`, payWallInteractions, payWallListeners, false);
 
 if (document.querySelector("#pagecontent .news") || document.querySelector("#pagecontent .news-minisite") || document.querySelector("#pagecontent .news-es") || document.querySelector("#pagecontent .news-mx")) {
     const metaTag = document.querySelector('meta[property="og:image"]');
@@ -132,11 +132,6 @@ function PageType(name, myUrl, interaction, myEvents, isArticle) {
     };
     this.interaction = interaction;
     this.listeners = GenerateListeners(name, myEvents);
-    if (name == "PayWall") {
-        this.onActionEvent = (actionEvent) => {
-            return PayWallActions(actionEvent);
-        }
-    }
 }
 
 function GlobalActions(actionEvent) {
@@ -157,20 +152,20 @@ function GlobalActions(actionEvent) {
     return actionEvent;
 }
 
-function PayWallActions(actionEvent) {
+function PayWallActions() {
+    let typeOfPayWall = "";
     let limit = new URL(window.location.href).searchParams.get("limit")
-    actionEvent.user = actionEvent.user || {};
-    actionEvent.user.attributes = actionEvent.user.attributes || {};
+
     if (limit != null) {
         const isLimit = limit === 'true';
-        actionEvent.user.attributes.typeOfEntry = !isLimit ? "choque exclusivo" : "choque metered";
+        typeOfPayWall = !isLimit ? "choque exclusivo" : "choque metered";
         let continueUrl = new URL(window.location.href).searchParams.get("continue")
-        actionEvent.user.attributes.continueUrl = continueUrl;
+        typeOfPayWall = "Pay wall - " + typeOfPayWall + "Continue: " + continueUrl;
     } else {
-        actionEvent.user.attributes.typeOfEntry = "Choque directo";
+        typeOfPayWall = "Choque directo";
     }
 
-    return actionEvent;
+    return typeOfPayWall;
 }
 
 function ReadHomeBlocks(event) {