Load Cloudflare Web Analytics beacon on cookie accept with tunnel token
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -25,6 +25,20 @@ function loadAnalytics() {
|
||||
script.dataset.hostUrl = '/stats'
|
||||
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"}'
|
||||
document.head.appendChild(script)
|
||||
}
|
||||
|
||||
export function initCookieConsent() {
|
||||
|
||||
Reference in New Issue
Block a user