📈 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!
TypeScript chartsclickhousedockergdprgoogle-analyticsmetricsmonitoringmysqlnestjsprivacyredisself-hostedselfhostedstatisticstailwindcssweb-analyticswebanalyticswebsite
stop tracking iframe pageviews
Blue Mouse9c2bff701c51
diff --git a/web/app/lib/constants/index.ts b/web/app/lib/constants/index.tsindex ec1a8ef61..3d6691547 100644--- a/web/app/lib/constants/index.ts+++ b/web/app/lib/constants/index.ts@@ -369,6 +369,8 @@ export const REFERRAL_DISCOUNT_CODE = 'REFERRAL_DISCOUNT'export const isBrowser = typeof window !== 'undefined' && typeof document !== 'undefined'+export const isIframe = isBrowser && window.self !== window.top+export type ThemeType = 'dark' | 'light'export const SUPPORTED_THEMES = ['light', 'dark']diff --git a/web/app/utils/analytics.ts b/web/app/utils/analytics.tsindex 3281695a7..2fb274853 100644--- a/web/app/utils/analytics.ts+++ b/web/app/utils/analytics.ts@@ -1,7 +1,7 @@import _includes from 'lodash/includes'import * as Swetrix from 'swetrix'-import { isBrowser, isDevelopment, isSelfhosted } from '~/lib/constants'+import { isBrowser, isDevelopment, isIframe, isSelfhosted } from '~/lib/constants'const SWETRIX_PID = 'STEzHcB1rALV'@@ -108,7 +108,7 @@ Swetrix.init(SWETRIX_PID, {const BLOG_PAGE_REGEX = /^\/blog\/.+$/export const trackViews = () => {- if (isSelfhosted || !isBrowser) {+ if (isSelfhosted || !isBrowser || isIframe) {return}