Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

using analytics.js and react-ga

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?

like image 530
Rachel Lanman Avatar asked Jul 26 '16 21:07

Rachel Lanman


1 Answers

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.logs of events being sent to Google Analytics.

like image 60
Yangshun Tay Avatar answered Nov 15 '22 06:11

Yangshun Tay