From d15a8af1f15734482abbf7dcfad97360d534cea2 Mon Sep 17 00:00:00 2001 From: Dave O'Connor Date: Mon, 6 Jan 2025 16:10:19 -0800 Subject: [PATCH] Updated plausible logging to more useful iframe url instead of "srcdoc" (#1579) --- templates/base.html | 11 ++++++++++- templates/docsiframe.html | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/templates/base.html b/templates/base.html index 425e1df8..d65d5b08 100644 --- a/templates/base.html +++ b/templates/base.html @@ -7,7 +7,7 @@ + src="https://plausible.io/js/script.manual.js"> {% block title %}Boost{% endblock %} @@ -547,12 +547,21 @@ } } + const manualPlausibleTrigger = async () => { + window.plausible = window.plausible || function() { + (window.plausible.q = window.plausible.q || []).push(arguments) + } + let loc = window.parent.location.href || window.location.href; + plausible("pageview", { u: loc + window.location.search }); + }; + window.addEventListener('DOMContentLoaded', () => { // resets the form on back button press document.getElementById("id_category")?.closest('form').reset(); document.getElementById("id_version")?.closest('form').reset(); document.getElementById("id_category")?.addEventListener("change", changeVersionAndCategory); document.getElementById("id_version")?.addEventListener("change", changeVersionAndCategory); + manualPlausibleTrigger(); }); (async () => { await trackLoginUpdateCheck(); diff --git a/templates/docsiframe.html b/templates/docsiframe.html index 80d2d29e..f3876146 100644 --- a/templates/docsiframe.html +++ b/templates/docsiframe.html @@ -2,7 +2,7 @@ {% block content %}