From 00610bbc1b32f6689fa71559f3db1f572688acfb Mon Sep 17 00:00:00 2001 From: Visnu Pitiyanuvath Date: Thu, 4 Apr 2024 09:06:14 -0700 Subject: [PATCH] Send our own pageLoad, routeChanged events (#2044) --- docs/.vitepress/theme/index.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/.vitepress/theme/index.ts b/docs/.vitepress/theme/index.ts index 3fa857990e..fd9606bd99 100644 --- a/docs/.vitepress/theme/index.ts +++ b/docs/.vitepress/theme/index.ts @@ -17,11 +17,11 @@ export default { } }; -async function enableAnalytics(router) { +function enableAnalytics(router) { if (typeof location === "undefined" || location.origin !== "https://observablehq.com") return; - const {pageLoad, routeChanged} = await import("https://events.observablehq.com/client.js?pageLoad"); let pageLoaded = false; - watch(router.route, () => { + watch(router.route, async () => { + const {pageLoad, routeChanged} = await import("https://events.observablehq.com/client.js"); if (pageLoaded) { routeChanged(); } else {