Tonne of updates
This commit is contained in:
@@ -0,0 +1,68 @@
|
||||
<script>
|
||||
(function () {
|
||||
// API URL injected from MkDocs config.extra (set by env_config_hook.py)
|
||||
var apiUrl = "http://localhost:4002";
|
||||
if (!apiUrl) return;
|
||||
|
||||
var trackUrl = apiUrl + "/api/docs-analytics/track";
|
||||
|
||||
// Anonymous session UUID (sessionStorage — dies with tab close, no cookies)
|
||||
function getSessionHash() {
|
||||
var key = "__docs_sh";
|
||||
var hash = sessionStorage.getItem(key);
|
||||
if (!hash) {
|
||||
hash = crypto.randomUUID
|
||||
? crypto.randomUUID()
|
||||
: "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function (c) {
|
||||
var r = (Math.random() * 16) | 0;
|
||||
return (c === "x" ? r : (r & 0x3) | 0x8).toString(16);
|
||||
});
|
||||
sessionStorage.setItem(key, hash);
|
||||
}
|
||||
return hash;
|
||||
}
|
||||
|
||||
function trackPageView(path) {
|
||||
var payload = JSON.stringify({
|
||||
path: path,
|
||||
referrer: document.referrer || undefined,
|
||||
sessionHash: getSessionHash(),
|
||||
});
|
||||
|
||||
// Prefer sendBeacon for reliability (works during tab close)
|
||||
if (navigator.sendBeacon) {
|
||||
navigator.sendBeacon(trackUrl, new Blob([payload], { type: "application/json" }));
|
||||
} else {
|
||||
fetch(trackUrl, {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: payload,
|
||||
keepalive: true,
|
||||
}).catch(function () {});
|
||||
}
|
||||
}
|
||||
|
||||
// Track initial page load
|
||||
trackPageView(location.pathname);
|
||||
|
||||
// Subscribe to Material's SPA navigation observable (instant loading)
|
||||
if (typeof document$ !== "undefined") {
|
||||
document$.subscribe(function () {
|
||||
trackPageView(location.pathname);
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script
|
||||
<meta property="og:type" content="website" />
|
||||
<meta property="og:title" content="custom - Changemaker Lite" />
|
||||
<meta property="og:description" content="Build Power. Not Rent It. Own your digital infrastructure." />
|
||||
<meta property="og:image" content="https://bnkserve.org/assets/images/social/partials/integrations/analytics/custom.png" />
|
||||
<meta property="og:image:type" content="image/png" />
|
||||
<meta property="og:image:width" content="1200" />
|
||||
<meta property="og:image:height" content="630" />
|
||||
<meta property="og:url" content="https://bnkserve.org/partials/integrations/analytics/custom/" />
|
||||
<meta property="twitter:card" content="summary_large_image" />
|
||||
<meta property="twitter:title" content="custom - Changemaker Lite" />
|
||||
<meta property="twitter:description" content="Build Power. Not Rent It. Own your digital infrastructure." />
|
||||
<meta property="twitter:image" content="https://bnkserve.org/assets/images/social/partials/integrations/analytics/custom.png" />
|
||||
>
|
||||
Reference in New Issue
Block a user