Merge pull request #11022 from Matt-Yorkley/matomo

Call matomo manually on asynchronous page visits
This commit is contained in:
Filipe
2023-06-29 12:02:48 +01:00
committed by GitHub
3 changed files with 12 additions and 0 deletions

View File

@@ -0,0 +1,10 @@
// Call Matomo on asynchronous page loads
["turbo:load", "ujs:afterMorph"].forEach((listener) =>
document.addEventListener(listener, (event) => {
if (typeof event?.detail?.timing === "object" && Object.keys(event?.detail?.timing).length === 0) {
return;
}
window._mtm?.push({ "event": "mtm.PageView" });
})
);

View File

@@ -2,6 +2,7 @@ import "controllers";
import "channels";
import "@hotwired/turbo";
import "../js/mrujs";
import "../js/matomo";
import "../js/moment";
import bigDecimal from "js-big-decimal";

View File

@@ -1,6 +1,7 @@
import "controllers";
import "@hotwired/turbo";
import "../js/mrujs";
import "../js/matomo";
import "../js/moment";
require.context("../fonts", true);