Skip to content

Commit 08cbad2

Browse files
committed
[change] Updated event tracking JS to use page URL as category
1 parent 572236b commit 08cbad2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

js/faq.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,10 +58,11 @@ document.addEventListener("DOMContentLoaded", function () {
5858
if (typeof _paq === "undefined") {
5959
return;
6060
}
61+
var pageName = window.location.pathname.split("/").filter(Boolean).pop() || "faq";
6162
document.querySelectorAll("aside.faq .menu-list > li > a").forEach(function (link) {
6263
link.addEventListener("click", function () {
6364
var linkText = link.textContent.trim();
64-
_paq.push(["trackEvent", "FAQ", "Open", linkText]);
65+
_paq.push(["trackEvent", pageName, "open-faq", linkText]);
6566
});
6667
});
6768
});

js/modal.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,10 +86,11 @@ document.addEventListener("DOMContentLoaded", function () {
8686
if (typeof _paq === "undefined") {
8787
return;
8888
}
89+
var pageName = window.location.pathname.split("/").filter(Boolean).pop() || "modal";
8990
document.querySelectorAll("a.open-modal").forEach(function (link) {
9091
link.addEventListener("click", function () {
9192
var linkText = link.textContent.trim();
92-
_paq.push(["trackEvent", "Feature", "Modal", linkText]);
93+
_paq.push(["trackEvent", pageName, "open-modal", linkText]);
9394
});
9495
});
9596
});

0 commit comments

Comments
 (0)