2018-02-11 15:27:43 +00:00
|
|
|
import ReactGA from 'react-ga';
|
|
|
|
|
2018-02-15 22:33:14 +00:00
|
|
|
const setupAnalytics = () => {
|
2018-05-24 21:01:17 +00:00
|
|
|
if (navigator.doNotTrack !== '1' && window.doNotTrack !== '1') {
|
|
|
|
ReactGA.initialize(process.env.GA_PROPERTY, {
|
|
|
|
debug: (process.env.NODE_ENV !== 'production')
|
|
|
|
});
|
|
|
|
ReactGA.pageview(document.location.pathname);
|
2018-05-24 22:04:57 +00:00
|
|
|
} else {
|
|
|
|
console.log('Google Analytics disabled by Do Not Track'); // eslint-disable-line no-console
|
2018-05-24 21:01:17 +00:00
|
|
|
}
|
2018-02-11 15:27:43 +00:00
|
|
|
};
|
|
|
|
|
2018-02-15 22:33:14 +00:00
|
|
|
export default setupAnalytics;
|