mirror of
https://github.com/safing/web
synced 2025-04-12 06:59:10 +00:00
Run plausible before query param cleanup
This commit is contained in:
parent
79772b2375
commit
0aa9cb28f3
1 changed files with 8 additions and 3 deletions
|
@ -3,9 +3,7 @@
|
|||
anonymous usage data for statistical purposes. The goal is to track overall
|
||||
trends in our website traffic, it is not to track individual visitors. All
|
||||
the data is in aggregate only. No personal data is collected.
|
||||
-->
|
||||
<script defer data-domain="safing.io" data-api="https://plausible.safing.io/event" src="https://plausible.safing.io/init.js"></script>
|
||||
<!--
|
||||
|
||||
There are some occasions, where we need to add a simple "source" query parameter
|
||||
to URLs so that we can see where visitors are coming from, as referrers only
|
||||
work within browsers and with platforms that don't use special redirect mechanisms.
|
||||
|
@ -17,8 +15,15 @@
|
|||
Here are some keywords, so that everyone who is curious will find this code snippet faster:
|
||||
plausible, analysis, analytics, campaign, tracking, query, hash, URL, #disabled?source=
|
||||
-->
|
||||
<script defer data-domain="safing.io" data-api="https://plausible.safing.io/event" src="https://plausible.safing.io/manual-init.js"></script>
|
||||
<script>
|
||||
// Wait until everything is loaded - the plausible script is deferred.
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
// Initialize plausible.
|
||||
window.plausible = window.plausible || function() { (window.plausible.q = window.plausible.q || []).push(arguments) }
|
||||
// Trigger pageview.
|
||||
plausible('pageview');
|
||||
// Move query parameters to "#disabled" hash.
|
||||
if (document.location.search !== "") {
|
||||
window.history.replaceState({}, document.title, document.location.pathname + "#disabled" + document.location.search);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue