mirror of https://github.com/VERT-sh/VERT.git
reset pushstate on plausible opt-out (#48)
This commit is contained in:
parent
4c26c84219
commit
2c8cb1922c
|
@ -17,6 +17,7 @@
|
||||||
vertdLoaded,
|
vertdLoaded,
|
||||||
} from "$lib/store/index.svelte";
|
} from "$lib/store/index.svelte";
|
||||||
import "../app.scss";
|
import "../app.scss";
|
||||||
|
import { browser } from "$app/environment";
|
||||||
|
|
||||||
let { children, data } = $props();
|
let { children, data } = $props();
|
||||||
let enablePlausible = $state(false);
|
let enablePlausible = $state(false);
|
||||||
|
@ -73,6 +74,10 @@
|
||||||
// Enable plausible if enabled
|
// Enable plausible if enabled
|
||||||
enablePlausible =
|
enablePlausible =
|
||||||
!!PUB_PLAUSIBLE_URL && Settings.instance.settings.plausible;
|
!!PUB_PLAUSIBLE_URL && Settings.instance.settings.plausible;
|
||||||
|
if (!enablePlausible && browser) {
|
||||||
|
// reset pushState on opt-out so that plausible stops firing events on page navigation
|
||||||
|
history.pushState = History.prototype.pushState;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue