Skip to content

Commit 8da05d0

Browse files
committed
Testing another change with Amplify
1 parent a48c8b7 commit 8da05d0

File tree

2 files changed

+33
-16
lines changed

2 files changed

+33
-16
lines changed

customHttp.yml

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@ customHeaders:
55
value: >-
66
default-src 'self' *.kinde.com; style-src 'self' 'unsafe-inline'
77
https://fonts.googleapis.com; frame-src
8-
https://www.youtube-nocookie.com; child-src 'self'; connect-src 'self'
8+
https://www.youtube-nocookie.com; child-src 'self'; connect-src 'self'
99
ws https://api.management.inkeep.com https://api.inkeep.com
1010
wss://api.inkeep.com https://api.hsforms.com https://app.kinde.com
11-
https://kinde.com https://kinde-api-docs-proxy.pages.dev; base-uri
11+
https://kinde.com https://kinde-api-docs-proxy.pages.dev
12+
https://analytics.usehall.com; base-uri
1213
'none'; font-src 'self' https://fonts.gstatic.com; img-src 'self'
1314
data: https://storage.googleapis.com https://imagedelivery.net
1415
https://customer-xcbruusbiervz265.cloudflarestream.com
@@ -78,7 +79,7 @@ customHeaders:
7879
'self' ws https://api.management.inkeep.com https://api.inkeep.com
7980
wss://api.inkeep.com https://api.hsforms.com https://app.kinde.com
8081
https://kinde.com https://api-spec.kinde.com
81-
https://kinde-api-docs-proxy.pages.dev; img-src
82+
https://kinde-api-docs-proxy.pages.dev https://analytics.usehall.com; img-src
8283
https://storage.googleapis.com
8384
- pattern: /kinde-apis/frontend/*
8485
headers:
@@ -92,5 +93,5 @@ customHeaders:
9293
'self' ws https://api.management.inkeep.com https://api.inkeep.com
9394
wss://api.inkeep.com https://api.hsforms.com https://app.kinde.com
9495
https://kinde.com https://api-spec.kinde.com
95-
https://kinde-api-docs-proxy.pages.dev; img-src
96+
https://kinde-api-docs-proxy.pages.dev https://analytics.usehall.com; img-src
9697
https://storage.googleapis.com

src/components/HallAnalytics.astro

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -72,19 +72,35 @@ const HALL_API_KEY = import.meta.env.HALL_API_KEY;
7272
trackPageView();
7373
}
7474

75-
// Track navigation (for SPA-like behavior)
76-
let currentPath = window.location.pathname;
77-
const observer = new MutationObserver(() => {
78-
if (window.location.pathname !== currentPath) {
79-
currentPath = window.location.pathname;
80-
setTimeout(trackPageView, 100); // Small delay to ensure new page is loaded
81-
}
82-
});
75+
// Also track when body becomes available (fallback)
76+
if (!document.body) {
77+
const bodyObserver = new MutationObserver(() => {
78+
if (document.body) {
79+
bodyObserver.disconnect();
80+
trackPageView();
81+
}
82+
});
83+
bodyObserver.observe(document.documentElement, {
84+
childList: true,
85+
subtree: true
86+
});
87+
}
8388

84-
observer.observe(document.body, {
85-
childList: true,
86-
subtree: true
87-
});
89+
// Track navigation (for SPA-like behavior) - only if document.body exists
90+
if (document.body) {
91+
let currentPath = window.location.pathname;
92+
const observer = new MutationObserver(() => {
93+
if (window.location.pathname !== currentPath) {
94+
currentPath = window.location.pathname;
95+
setTimeout(trackPageView, 100); // Small delay to ensure new page is loaded
96+
}
97+
});
98+
99+
observer.observe(document.body, {
100+
childList: true,
101+
subtree: true
102+
});
103+
}
88104

89105
})();
90106
</script>

0 commit comments

Comments
 (0)