Skip to content
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

Merged
merged 5 commits into from
Aug 2, 2022
Merged

Attach GA tag to index html #355

merged 5 commits into from
Aug 2, 2022

Conversation

hochiw
Copy link
Contributor

@hochiw hochiw commented Jul 30, 2022

refs #349

@hochiw hochiw requested a review from elise-ng July 30, 2022 05:41
@elise-ng
Copy link
Contributor

elise-ng commented Aug 1, 2022

@hochiw
Copy link
Contributor Author

hochiw commented Aug 2, 2022

this is awkward cos ViteRadar happens during build time so it burns the GA ID into the index.html when it gets generated.

@elise-ng
Copy link
Contributor

elise-ng commented Aug 2, 2022

@hochiw hochiw force-pushed the 349-ga branch 2 times, most recently from d566c14 to 69cee77 Compare August 2, 2022 08:18
@hochiw
Copy link
Contributor Author

hochiw commented Aug 2, 2022

@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(
Copy link
Contributor

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);
Copy link
Contributor

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🆗

@hochiw
Copy link
Contributor Author

hochiw commented Aug 2, 2022

@chihimng added wallet analytics :adore2x:

@elise-ng
Copy link
Contributor

elise-ng commented Aug 2, 2022

please also see if we can track transaction type & set/unset reaction?

@hochiw hochiw merged commit dbc0a56 into oursky:master Aug 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants