Added undefined check for posthog when analytics disabled

This commit is contained in:
Connor Yoh 2025-04-09 16:22:13 +01:00
parent c93722ec05
commit dac3cac3af

View File

@ -83,6 +83,11 @@
<script th:inline="javascript">
function UpdatePosthogConsent(){
if(typeof(posthog) == "undefined") {
console.log("Posthog not initialised");
return;
}
window.CookieConsent.acceptedCategory('analytics')?
posthog.opt_in_capturing() : posthog.opt_out_capturing();
console.log("Posthog: Opted " + (posthog.has_opted_out_capturing()? "out" : "in"));