mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
Merge pull request #516 from omnivore-app/fix/non-user-events
Move the analytics event for link_read out of the container, supply userId
This commit is contained in:
commit
834afe7877
2 changed files with 11 additions and 8 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 (
|
||||
<PrimaryLayout
|
||||
pageTestId="home-page-tag"
|
||||
|
|
|
|||
Loading…
Reference in a new issue