diff --git a/astro.config.mjs b/astro.config.mjs index dc7ebb2..a99102f 100644 --- a/astro.config.mjs +++ b/astro.config.mjs @@ -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", } }, { diff --git a/src/components/ThemeProvider.astro b/src/components/ThemeProvider.astro index b5330ae..62380bf 100644 --- a/src/components/ThemeProvider.astro +++ b/src/components/ThemeProvider.astro @@ -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');