I'm setting up Google Analytics for the first time and opted to use react-ga for it's simple integration into react-router and our React components. My question is, do I also need to set up the app with Google's analytics.js, or can I simply use the react-ga package? Is there any aspect of analytics.js that will be important to include?
react-ga maintainer here. Thank you for your interest in react-ga
.
React GA helps you to fetch Google's analytics.js
and initializes analytics.js
with the key that you provide to it in the ReactGA.initialize
call. Hence, no you do not need to explicitly add analytics.js
yourself and you can simply use react-ga
package.
The value of react-ga
lies in a React + GA integrated OutboundLink
component and the parameter validations. As of present, React GA is a thin wrapper around the analytics.js
calls but it helps you validate the parameters you pass into it and also provides a debug
flag where you can see console.log
s of events being sent to Google Analytics.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With