regexper-static/src/setup/analytics.js

13 lines
331 B
JavaScript
Raw Normal View History

2018-02-11 15:27:43 +00:00
import ReactGA from 'react-ga';
2018-02-15 22:33:14 +00:00
const setupAnalytics = () => {
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-02-11 15:27:43 +00:00
};
2018-02-15 22:33:14 +00:00
export default setupAnalytics;