feat: track domain, path, title
Some checks failed
Node.js CI / Lint and Test (push) Successful in 1m21s
Code Analysis / SonarQube (push) Failing after 1m22s

This commit is contained in:
Naomi Carrigan 2025-04-04 15:10:47 -07:00
parent 1022316d35
commit ea060a775c
Signed by: naomi
SSH Key Fingerprint: SHA256:rca1iUI2OhAM6n4FIUaFcZcicmri0jgocqKiTTAfrt8
2 changed files with 6 additions and 1 deletions

View File

@ -41,7 +41,8 @@ export default defineConfig({
id: "analytics",
src: "https://analytics.nhcarrigan.com/js/script.file-downloads.outbound-links.js",
defer: true,
"data-domain": "nhcarrigan.com"
"data-domain": "nhcarrigan.com",
"event-domain": "docs.nhcarrigan.com",
}
},
{

View File

@ -4,6 +4,10 @@ import { Icon } from "@astrojs/starlight/components";
{/* This is intentionally inlined to avoid FOUC. */}
<script is:inline>
const analytics = document.getElementById('analytics');
const title = document.querySelector('title');
analytics.setAttribute('event-page', title.innerText ?? "NHCarrigan Docs");
analytics.setAttribute('event-path', window.location.pathname);
window.StarlightThemeProvider = (() => {
const storedTheme =
typeof localStorage !== 'undefined' && localStorage.getItem('starlight-theme');