pixel changes

This commit is contained in:
Anthony Stirling 2025-09-05 15:41:48 +01:00
parent c36d63c6db
commit 4a8994d2e8

View File

@ -169,7 +169,8 @@
<link rel="stylesheet" th:href="@{'/css/bootstrap-icons.min.css'}"> <link rel="stylesheet" th:href="@{'/css/bootstrap-icons.min.css'}">
<!-- Pixel, doesn't collect any PII--> <!-- Pixel, doesn't collect any PII-->
<div th:if="${!@disablePixel and @analyticsEnabled}" id="pixel-tracker-container" style="display: none;"></div> <img th:if="${!@disablePixel and @analyticsEnabled}" id="pixel-tracker" referrerpolicy="no-referrer-when-downgrade"
style="position: absolute; visibility: hidden; display: none;" />
<!-- Custom --> <!-- Custom -->
<link rel="stylesheet" th:href="@{'/css/general.css'}"> <link rel="stylesheet" th:href="@{'/css/general.css'}">
@ -220,29 +221,25 @@
} }
function UpdatePixelConsent(){ function UpdatePixelConsent(){
const pixelContainer = document.getElementById('pixel-tracker-container'); const pixelTracker = document.getElementById('pixel-tracker');
if(!pixelContainer) { if(!pixelTracker) {
return; return;
} }
if(window.CookieConsent.acceptedCategory('analytics')) { if(window.CookieConsent.acceptedCategory('analytics')) {
// Only create and load the pixel if consent is given and it hasn't been loaded yet // Only set the src if consent is given and it hasn't been loaded yet
if(pixelContainer.children.length === 0) { if(!pixelTracker.src) {
const pixelImg = document.createElement('img'); pixelTracker.src = 'https://pixel.stirlingpdf.com/a.png?x-pxid=4f5fa02f-a065-4efb-bb2c-24509a4b6b92'
pixelImg.referrerPolicy = 'no-referrer-when-downgrade'; + '&machineType=' + /*[[${@machineType}]]*/ ''
pixelImg.src = 'https://pixel.stirlingpdf.com/a.png?x-pxid=4f5fa02f-a065-4efb-bb2c-24509a4b6b92' + '&appVersion=' + /*[[${@appVersion}]]*/ ''
+ '&machineType=' + /*[[${@machineType}]]*/ '' + '&licenseType=' + /*[[${@license}]]*/ ''
+ '&appVersion=' + /*[[${@appVersion}]]*/ '' + '&loginEnabled=' + /*[[${@loginEnabled}]]*/ '';
+ '&licenseType=' + /*[[${@license}]]*/ ''
+ '&loginEnabled=' + /*[[${@loginEnabled}]]*/ '';
pixelImg.style.cssText = 'position: absolute; visibility: hidden;';
pixelContainer.appendChild(pixelImg);
} }
pixelContainer.style.display = 'block'; pixelTracker.style.display = 'block';
} else { } else {
pixelContainer.style.display = 'none'; pixelTracker.style.display = 'none';
// Remove pixel image to prevent any tracking // Remove src to prevent any tracking
pixelContainer.innerHTML = ''; pixelTracker.src = '';
} }
} }
const stirlingPDFLabel = /*[[${@StirlingPDFLabel}]]*/ ''; const stirlingPDFLabel = /*[[${@StirlingPDFLabel}]]*/ '';