From 4a8994d2e8c2657d047a7eab9001007d54ccf7e7 Mon Sep 17 00:00:00 2001 From: Anthony Stirling <77850077+Frooodle@users.noreply.github.com.> Date: Fri, 5 Sep 2025 15:41:48 +0100 Subject: [PATCH] pixel changes --- .../resources/templates/fragments/common.html | 33 +++++++++---------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/app/core/src/main/resources/templates/fragments/common.html b/app/core/src/main/resources/templates/fragments/common.html index 16ef24f96..e2fa29790 100644 --- a/app/core/src/main/resources/templates/fragments/common.html +++ b/app/core/src/main/resources/templates/fragments/common.html @@ -169,7 +169,8 @@ -
+ @@ -220,29 +221,25 @@ } function UpdatePixelConsent(){ - const pixelContainer = document.getElementById('pixel-tracker-container'); - if(!pixelContainer) { + const pixelTracker = document.getElementById('pixel-tracker'); + if(!pixelTracker) { return; } if(window.CookieConsent.acceptedCategory('analytics')) { - // Only create and load the pixel if consent is given and it hasn't been loaded yet - if(pixelContainer.children.length === 0) { - const pixelImg = document.createElement('img'); - pixelImg.referrerPolicy = 'no-referrer-when-downgrade'; - pixelImg.src = 'https://pixel.stirlingpdf.com/a.png?x-pxid=4f5fa02f-a065-4efb-bb2c-24509a4b6b92' - + '&machineType=' + /*[[${@machineType}]]*/ '' - + '&appVersion=' + /*[[${@appVersion}]]*/ '' - + '&licenseType=' + /*[[${@license}]]*/ '' - + '&loginEnabled=' + /*[[${@loginEnabled}]]*/ ''; - pixelImg.style.cssText = 'position: absolute; visibility: hidden;'; - pixelContainer.appendChild(pixelImg); + // 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}]]*/ ''; } - pixelContainer.style.display = 'block'; + pixelTracker.style.display = 'block'; } else { - pixelContainer.style.display = 'none'; - // Remove pixel image to prevent any tracking - pixelContainer.innerHTML = ''; + pixelTracker.style.display = 'none'; + // Remove src to prevent any tracking + pixelTracker.src = ''; } } const stirlingPDFLabel = /*[[${@StirlingPDFLabel}]]*/ '';