Compare commits

...
2 Commits
Author SHA1 Message Date
Anthony Stirling 4a8994d2e8 pixel changes 2025-09-05 15:41:48 +01:00
Anthony Stirling c36d63c6db fix pixel 2025-09-05 15:13:13 +01:00
@@ -169,13 +169,8 @@
<link rel="stylesheet" th:href="@{'/css/bootstrap-icons.min.css'}">
<!-- Pixel, doesn't collect any PII-->
<img th:if="${!@disablePixel}" referrerpolicy="no-referrer-when-downgrade"
th:src="'https://pixel.stirlingpdf.com/a.png?x-pxid=4f5fa02f-a065-4efb-bb2c-24509a4b6b92'
+ '&machineType=' + ${@machineType}
+ '&appVersion=' + ${@appVersion}
+ '&licenseType=' + ${@license}
+ '&loginEnabled=' + ${@loginEnabled}"
style="position: absolute; visibility: hidden;" />
<img th:if="${!@disablePixel and @analyticsEnabled}" id="pixel-tracker" referrerpolicy="no-referrer-when-downgrade"
style="position: absolute; visibility: hidden; display: none;" />
<!-- Custom -->
<link rel="stylesheet" th:href="@{'/css/general.css'}">
@@ -224,6 +219,29 @@
window.CookieConsent.acceptedCategory('analytics')?
posthog.opt_in_capturing() : posthog.opt_out_capturing();
}
function UpdatePixelConsent(){
const pixelTracker = document.getElementById('pixel-tracker');
if(!pixelTracker) {
return;
}
if(window.CookieConsent.acceptedCategory('analytics')) {
// Only set the src if consent is given and it hasn't been loaded yet
if(!pixelTracker.src) {
pixelTracker.src = 'https://pixel.stirlingpdf.com/a.png?x-pxid=4f5fa02f-a065-4efb-bb2c-24509a4b6b92'
+ '&machineType=' + /*[[${@machineType}]]*/ ''
+ '&appVersion=' + /*[[${@appVersion}]]*/ ''
+ '&licenseType=' + /*[[${@license}]]*/ ''
+ '&loginEnabled=' + /*[[${@loginEnabled}]]*/ '';
}
pixelTracker.style.display = 'block';
} else {
pixelTracker.style.display = 'none';
// Remove src to prevent any tracking
pixelTracker.src = '';
}
}
const stirlingPDFLabel = /*[[${@StirlingPDFLabel}]]*/ '';
const analyticsEnabled = /*[[${@analyticsEnabled}]]*/ false;
@@ -289,6 +307,8 @@
window.addEventListener("cc:onConsent", UpdatePosthogConsent);
window.addEventListener("cc:onChange", UpdatePosthogConsent);
window.addEventListener("cc:onConsent", UpdatePixelConsent);
window.addEventListener("cc:onChange", UpdatePixelConsent);
</script>
</th:block>