-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Attach GA tag to index html #355
Conversation
this is awkward cos ViteRadar happens during build time so it burns the GA ID into the index.html when it gets generated. |
d566c14
to
69cee77
Compare
@chihimng updated :adore2x: tested by confirming there are analytics request sent every time I click a page |
ReactGA.pageview(location.pathname + location.search); | ||
}, [location, isInitialized]); | ||
|
||
useEffectOnce( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's use useEffect with empty dep array if we are not waiting for first occurrence of an condition
useEffectOnce( | ||
() => { | ||
if (id) { | ||
ReactGA.initialize(id); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We might want to put this in a provider, so we can add tracking for user actions other than page view e.g. vote, reaction, post comment in the future
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🆗
@chihimng added wallet analytics :adore2x: |
please also see if we can track transaction type & set/unset reaction? |
refs #349