From ed9140a5e9ec76e78145ca548af9a7303956f754 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 22 Oct 2024 09:49:20 -0500 Subject: [PATCH 1/3] Add tracking components for User and Static Routes --- .../marko-web-p1-events/components/marko.json | 8 +++++++ .../components/track-static-route-view.marko | 22 +++++++++++++++++++ .../components/track-user-route-view.marko | 22 +++++++++++++++++++ 3 files changed, 52 insertions(+) create mode 100644 packages/marko-web-p1-events/components/track-static-route-view.marko create mode 100644 packages/marko-web-p1-events/components/track-user-route-view.marko diff --git a/packages/marko-web-p1-events/components/marko.json b/packages/marko-web-p1-events/components/marko.json index 635ad441b..a4f001e90 100644 --- a/packages/marko-web-p1-events/components/marko.json +++ b/packages/marko-web-p1-events/components/marko.json @@ -70,6 +70,14 @@ }, "@event-name": "string" }, + "": { + "template": "./track-static-route-view.marko", + "@path": "string" + }, + "": { + "template": "./track-user-route-view.marko", + "@path": "string" + }, "": { "template": "./track-website-section.marko", "@node": "object" diff --git a/packages/marko-web-p1-events/components/track-static-route-view.marko b/packages/marko-web-p1-events/components/track-static-route-view.marko new file mode 100644 index 000000000..2b817859c --- /dev/null +++ b/packages/marko-web-p1-events/components/track-static-route-view.marko @@ -0,0 +1,22 @@ +import { getAsArray } from "@parameter1/base-cms-object-path"; +import ns from "../utils/create-namespace"; + +$ const { site } = out.global; +$ const { path } = input; +$ const config = site.getAsObject("p1events"); + + + $ const { type, primarySection, company, createdBy } = node; + $ const entity = { + id: path.replace(/^\//, ""), + ns: ns("static-route"), + }; + $ const data = { + action: 'View', + category: 'Static Route', + entity, + }; + + diff --git a/packages/marko-web-p1-events/components/track-user-route-view.marko b/packages/marko-web-p1-events/components/track-user-route-view.marko new file mode 100644 index 000000000..c525a3214 --- /dev/null +++ b/packages/marko-web-p1-events/components/track-user-route-view.marko @@ -0,0 +1,22 @@ +import { getAsArray } from "@parameter1/base-cms-object-path"; +import ns from "../utils/create-namespace"; + +$ const { site } = out.global; +$ const { path } = input; +$ const config = site.getAsObject("p1events"); + + + $ const { type, primarySection, company, createdBy } = node; + $ const entity = { + id: path.replace(/^\//, ""), + ns: ns("user-route"), + }; + $ const data = { + action: 'View', + category: 'User Route', + entity, + }; + + From 411452cc8ddebe7c4f070add272ad80dafb36e35 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 22 Oct 2024 10:01:12 -0500 Subject: [PATCH 2/3] Remove unused getAsArray import --- .../marko-web-p1-events/components/track-static-route-view.marko | 1 - .../marko-web-p1-events/components/track-user-route-view.marko | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/marko-web-p1-events/components/track-static-route-view.marko b/packages/marko-web-p1-events/components/track-static-route-view.marko index 2b817859c..b927fcc12 100644 --- a/packages/marko-web-p1-events/components/track-static-route-view.marko +++ b/packages/marko-web-p1-events/components/track-static-route-view.marko @@ -1,4 +1,3 @@ -import { getAsArray } from "@parameter1/base-cms-object-path"; import ns from "../utils/create-namespace"; $ const { site } = out.global; diff --git a/packages/marko-web-p1-events/components/track-user-route-view.marko b/packages/marko-web-p1-events/components/track-user-route-view.marko index c525a3214..255c9ac13 100644 --- a/packages/marko-web-p1-events/components/track-user-route-view.marko +++ b/packages/marko-web-p1-events/components/track-user-route-view.marko @@ -1,4 +1,3 @@ -import { getAsArray } from "@parameter1/base-cms-object-path"; import ns from "../utils/create-namespace"; $ const { site } = out.global; From d1b28adbce1ffb20ea45aeebf9b240e7dd6e4407 Mon Sep 17 00:00:00 2001 From: Shinsina Date: Tue, 22 Oct 2024 10:01:33 -0500 Subject: [PATCH 3/3] Remove non-existent node destructure --- .../marko-web-p1-events/components/track-static-route-view.marko | 1 - .../marko-web-p1-events/components/track-user-route-view.marko | 1 - 2 files changed, 2 deletions(-) diff --git a/packages/marko-web-p1-events/components/track-static-route-view.marko b/packages/marko-web-p1-events/components/track-static-route-view.marko index b927fcc12..5a1a3c3ad 100644 --- a/packages/marko-web-p1-events/components/track-static-route-view.marko +++ b/packages/marko-web-p1-events/components/track-static-route-view.marko @@ -5,7 +5,6 @@ $ const { path } = input; $ const config = site.getAsObject("p1events"); - $ const { type, primarySection, company, createdBy } = node; $ const entity = { id: path.replace(/^\//, ""), ns: ns("static-route"), diff --git a/packages/marko-web-p1-events/components/track-user-route-view.marko b/packages/marko-web-p1-events/components/track-user-route-view.marko index 255c9ac13..990a8bd8f 100644 --- a/packages/marko-web-p1-events/components/track-user-route-view.marko +++ b/packages/marko-web-p1-events/components/track-user-route-view.marko @@ -5,7 +5,6 @@ $ const { path } = input; $ const config = site.getAsObject("p1events"); - $ const { type, primarySection, company, createdBy } = node; $ const entity = { id: path.replace(/^\//, ""), ns: ns("user-route"),