Spaces:
Running
Running
Download shared/js/analytics.js from Tonic/uas-eus-webhook: direct link, hf CLI and curl.
- Browser
- Download file 1.84 kB
-
https://huggingface.co/spaces/Tonic/uas-eus-webhook/resolve/main/shared/js/analytics.js
- Command line
-
hf download hf://spaces/Tonic/uas-eus-webhook/shared/js/analytics.js
-
curl -L -o analytics.js https://huggingface.co/spaces/Tonic/uas-eus-webhook/resolve/main/shared/js/analytics.js
1.84 kB
| /* First-party, consent-gated PostHog loader. | |
| - Loads ONLY after the consent banner opt-in (consent.js sets window.__analyticsAllowed). | |
| - The PostHog snippet is self-hosted (shared/vendor/posthog/array.js) and ALL traffic goes | |
| through our own proxy api.uas.eus/posthog (webhook app) -> PostHog EU. No third-party | |
| requests or cookies ever reach the browser directly. | |
| - Cookieless: memory persistence only; URLs stripped of query strings. */ | |
| (function () { | |
| var started = false; | |
| function start() { | |
| if (started) return; | |
| var cfg = (window.SITE_CONFIG && window.SITE_CONFIG.analytics) || {}; | |
| if (!window.__analyticsAllowed || !cfg.enabled || !cfg.posthogKey || /^PENDING/.test(cfg.posthogKey)) return; | |
| started = true; | |
| var s = document.createElement('script'); | |
| s.src = 'shared/vendor/posthog/array.js'; | |
| s.onload = function () { | |
| try { | |
| window.posthog.init(cfg.posthogKey, { | |
| api_host: cfg.posthogHost || 'https://api.uas.eus/posthog', | |
| persistence: 'memory', // cookieless (GDPR): nothing in localStorage/cookies | |
| autocapture: true, | |
| capture_pageview: true, | |
| capture_pageleave: true, | |
| respect_dnt: true, | |
| disable_session_recording: true, | |
| sanitize_properties: function (props) { | |
| if (props && props.$current_url) props.$current_url = String(props.$current_url).split('?')[0]; | |
| if (props && props.$referrer) props.$referrer = String(props.$referrer).split('?')[0]; | |
| return props; | |
| } | |
| }); | |
| } catch (e) { console.warn('posthog init failed', e); } | |
| }; | |
| document.head.appendChild(s); | |
| } | |
| window.addEventListener('consent', start); | |
| if (document.readyState !== 'loading') start(); | |
| else window.addEventListener('DOMContentLoaded', start); | |
| })(); | |