Skip to content

Commit

Permalink
Updated plausible logging to more useful iframe url instead of "srcdo…
Browse files Browse the repository at this point in the history
…c" (#1579)
  • Loading branch information
daveoconnor committed Jan 7, 2025
1 parent 577acf6 commit d15a8af
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
11 changes: 10 additions & 1 deletion templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<head>
<script defer
data-domain="preview.boost.org"
src="https://plausible.io/js/script.js"></script>
src="https://plausible.io/js/script.manual.js"></script>
<title>{% block title %}Boost{% endblock %}</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
Expand Down Expand Up @@ -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();
Expand Down
2 changes: 1 addition & 1 deletion templates/docsiframe.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

{% block content %}
<iframe
href="{{ content_url }}" srcdoc="{{ content }}"
srcdoc="{{ content }}"
onload="iframeCustomizations(this)"
id="docsiframe"
></iframe>
Expand Down

0 comments on commit d15a8af

Please sign in to comment.