diff --git a/packages/web/components/templates/article/ArticleContainer.tsx b/packages/web/components/templates/article/ArticleContainer.tsx index 62e4a7b8d..1ef48a9f7 100644 --- a/packages/web/components/templates/article/ArticleContainer.tsx +++ b/packages/web/components/templates/article/ArticleContainer.tsx @@ -79,14 +79,6 @@ export function ArticleContainer(props: ArticleContainerProps): JSX.Element { } }) - useEffect(() => { - window.analytics?.track('link_read', { - link: props.article.id, - slug: props.article.slug, - url: props.article.originalArticleUrl, - }) - }, [props.article]) - const styles = { fontSize, margin: props.margin ?? 360, diff --git a/packages/web/pages/[username]/[slug]/index.tsx b/packages/web/pages/[username]/[slug]/index.tsx index 2a33bf616..09d0bb303 100644 --- a/packages/web/pages/[username]/[slug]/index.tsx +++ b/packages/web/pages/[username]/[slug]/index.tsx @@ -107,6 +107,17 @@ export default function Home(): JSX.Element { }) ) + useEffect(() => { + if (article && viewerData?.me) { + window.analytics?.track('link_read', { + link: article.id, + slug: article.slug, + url: article.originalArticleUrl, + userId: viewerData.me.id + }) + } + }, [article, viewerData]) + return (