Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

Commit

Permalink
Merge pull request #993 from Shinsina/track-route-components
Browse files Browse the repository at this point in the history
Add tracking components for User and Static Routes
  • Loading branch information
brandonbk authored Oct 28, 2024
2 parents c0c155c + d1b28ad commit 26e6bad
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 0 deletions.
8 changes: 8 additions & 0 deletions packages/marko-web-p1-events/components/marko.json
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@
},
"@event-name": "string"
},
"<marko-web-p1-events-track-static-route-view>": {
"template": "./track-static-route-view.marko",
"@path": "string"
},
"<marko-web-p1-events-track-user-route-view>": {
"template": "./track-user-route-view.marko",
"@path": "string"
},
"<marko-web-p1-events-track-website-section>": {
"template": "./track-website-section.marko",
"@node": "object"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import ns from "../utils/create-namespace";

$ const { site } = out.global;
$ const { path } = input;
$ const config = site.getAsObject("p1events");

<if(config.enabled)>
$ const entity = {
id: path.replace(/^\//, ""),
ns: ns("static-route"),
};
$ const data = {
action: 'View',
category: 'Static Route',
entity,
};
<script>
p1events('track', ${JSON.stringify(data)});
</script>
</if>
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import ns from "../utils/create-namespace";

$ const { site } = out.global;
$ const { path } = input;
$ const config = site.getAsObject("p1events");

<if(config.enabled)>
$ const entity = {
id: path.replace(/^\//, ""),
ns: ns("user-route"),
};
$ const data = {
action: 'View',
category: 'User Route',
entity,
};
<script>
p1events('track', ${JSON.stringify(data)});
</script>
</if>

0 comments on commit 26e6bad

Please sign in to comment.