Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fixed building issue for ssr

Blue Mousefe8f8d14a3e8
diff --git a/src/index.ts b/src/index.ts
index fa48e6e99..6e59a4cce 100644
--- a/src/index.ts
+++ b/src/index.ts
@@ -48,7 +48,7 @@ export function trackViews(options?: PageViewsOptions): Promise<PageActions> {
}
// We need to verify that document.readyState is complete for the performance stats to be collected correctly.
- if (document.readyState === 'complete') {
+ if (typeof document === 'undefined' || document.readyState === 'complete') {
resolve(LIB_INSTANCE.trackPageViews(options))
} else {
window.addEventListener('load', () => {