From 8767e0b71dceb43c92edd469fc31e1fd46127c54 Mon Sep 17 00:00:00 2001 From: Jackson Harper Date: Wed, 13 Sep 2023 13:05:16 +0800 Subject: [PATCH] Update link_read call --- packages/web/lib/hooks/useCopyLink.tsx | 4 ---- packages/web/pages/[username]/[slug]/index.tsx | 4 ++-- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/packages/web/lib/hooks/useCopyLink.tsx b/packages/web/lib/hooks/useCopyLink.tsx index c30ce7c27..a7857c908 100644 --- a/packages/web/lib/hooks/useCopyLink.tsx +++ b/packages/web/lib/hooks/useCopyLink.tsx @@ -17,10 +17,6 @@ export const useCopyLink = ( const res = await navigator.clipboard.writeText(link) setIsLinkCopied(true) window.setTimeout(() => setIsLinkCopied(false), 5000) - window.analytics?.track('link_copied', { - link, - type, - }) }, [link, type]) return { link, copyLink, isLinkCopied } diff --git a/packages/web/pages/[username]/[slug]/index.tsx b/packages/web/pages/[username]/[slug]/index.tsx index 533bea5db..c0f7625f5 100644 --- a/packages/web/pages/[username]/[slug]/index.tsx +++ b/packages/web/pages/[username]/[slug]/index.tsx @@ -47,6 +47,7 @@ import { EpubContainerProps } from '../../../components/templates/article/EpubCo import { useSetPageLabels } from '../../../lib/hooks/useSetPageLabels' import { updatePageMutation } from '../../../lib/networking/mutations/updatePageMutation' import { State } from '../../../lib/networking/fragments/articleFragment' +import { posthog } from 'posthog-js' const PdfArticleContainerNoSSR = dynamic( () => import('./../../../components/templates/article/PdfArticleContainer'), @@ -200,11 +201,10 @@ export default function Home(): JSX.Element { useEffect(() => { if (article && viewerData?.me) { - window.analytics?.track('link_read', { + posthog.capture('link_read', { link: article.id, slug: article.slug, url: article.originalArticleUrl, - userId: viewerData.me.id, }) } }, [article, viewerData])