Remove all trackers (Umami, Cloudflare, insights-js) from cookie consent

Strip loadAnalytics, loadCloudflareTunnel and insights-js dependency.
Cookie consent banner kept for future use without any tracking scripts.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Serreau Jovann
2026-03-26 11:29:22 +01:00
parent 3bb676bfda
commit 3a85b6ef68
3 changed files with 1 additions and 44 deletions

View File

@@ -13,48 +13,10 @@ function setCookie(name, value, days) {
document.cookie = name + '=' + value + ';expires=' + date.toUTCString() + ';path=/;SameSite=Lax;Secure'
}
function loadAnalytics() {
if (document.querySelector('script[data-analytics]')) {
return
}
if (document.body.dataset.env === 'dev') {
return
}
const script = document.createElement('script')
script.defer = true
script.src = 'https://tools-security.esy-web.dev/script.js'
script.dataset.websiteId = 'a1f85dd5-741f-4df7-840a-7ef0931ed0cc'
script.dataset.hostUrl = 'https://tools-security.esy-web.dev'
script.dataset.analytics = '1'
document.head.appendChild(script)
loadCloudflareTunnel()
}
function loadCloudflareTunnel() {
if (document.querySelector('script[data-cf-beacon]')) {
return
}
const script = document.createElement('script')
script.defer = true
script.src = 'https://static.cloudflareinsights.com/beacon.min.js'
script.dataset.cfBeacon = '{"token":"5f2f3b8e1f824be6984a348fe31d2f04","spa":true}'
document.head.appendChild(script)
}
export function initCookieConsent() {
const consent = getCookie(COOKIE_NAME)
if ('accepted' === consent) {
loadAnalytics()
return
}
if ('refused' === consent) {
if ('accepted' === consent || 'refused' === consent) {
return
}
@@ -72,7 +34,6 @@ export function initCookieConsent() {
acceptBtn.addEventListener('click', () => {
setCookie(COOKIE_NAME, 'accepted', COOKIE_DAYS)
banner.classList.add('hidden')
loadAnalytics()
})
}