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!

Don't track blog posts manually

Blue Mouse7f1447832afb
diff --git a/web/app/pages/Blog/Post.tsx b/web/app/pages/Blog/Post.tsx
index 072d3f69b..31d42db72 100644
--- a/web/app/pages/Blog/Post.tsx
+++ b/web/app/pages/Blog/Post.tsx
@@ -1,5 +1,5 @@
import { CaretLeftIcon } from '@phosphor-icons/react'
-import { useEffect, useRef } from 'react'
+import { useRef } from 'react'
import { useTranslation } from 'react-i18next'
import { Link } from '~/ui/Link'
import { useLoaderData, useLocation } from 'react-router'
@@ -8,7 +8,6 @@ import ExitIntentPopup from '~/components/ExitIntentPopup'
import NotFound from '~/pages/NotFound'
import ArticleNav from '~/pages/Blog/ArticleNav'
import { Text } from '~/ui/Text'
-import { trackPageview } from '~/utils/analytics'
interface Post {
slug: string
@@ -28,21 +27,6 @@ export default function PostSlug() {
const { t } = useTranslation('common')
const articleRef = useRef<HTMLElement>(null)
- useEffect(() => {
- const meta = post?.author
- ? {
- author: post.author,
- }
- : undefined
-
- trackPageview({
- payload: {
- pg: location.pathname,
- meta,
- },
- })
- }, [post, location])
-
if (!post) {
return <NotFound />
}
diff --git a/web/app/utils/analytics.ts b/web/app/utils/analytics.ts
index 7a66b1672..d60e747c3 100644
--- a/web/app/utils/analytics.ts
+++ b/web/app/utils/analytics.ts
@@ -76,8 +76,6 @@ const PATHS_REPLACEMENT_MAP = [
},
]
-const IGNORED_PAGE_REGEX = /^(\/blog\/.+|\/comparison)$/
-
const checkIgnore = (path: string | undefined | null, ignore: RegExp[]) => {
if (!path) {
return false
@@ -125,10 +123,6 @@ export const trackViews = () => {
ref,
} as Swetrix.IPageViewPayload
- if (pg && IGNORED_PAGE_REGEX.test(pg)) {
- return false
- }
-
result.pg = getNewPath(pg)
if (checkIgnore(ref, REFS_TO_IGNORE)) {
@@ -141,14 +135,6 @@ export const trackViews = () => {
})
}
-export const trackPageview = (options: Swetrix.IPageviewOptions) => {
- if (isSelfhosted || isIframe) {
- return
- }
-
- Swetrix.pageview(options)
-}
-
export const trackErrors = () => {
if (isSelfhosted || !isBrowser || isDevelopment || isIframe) {
return