Skip to content

Commit

Permalink
chore: disallow matomo from tracking query params
Browse files Browse the repository at this point in the history
  • Loading branch information
mbaraa committed Feb 13, 2024
1 parent 5ad9616 commit 3d5706c
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions snappass/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,16 @@
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(["setTrackerUrl", u + "/matomo.php"]);
_paq.push(["setSiteId", "{{site_id}}"]);

// remove query parameters before sending the url to matomo
let page_url = location.href;
const query_pos = location.href.indexOf("?");
if (query_pos) {
page_url = location.href.substring(0, query_pos);
}
_paq.push(["setCustomUrl", page_url]);
_paq.push(["trackPageView"]);

let d = document,
g = d.createElement("script"),
s = d.getElementsByTagName("script")[0];
Expand Down

0 comments on commit 3d5706c

Please sign in to comment.