regexper-static/src/setup/analytics.js

13 lines
331 B
JavaScript

import ReactGA from 'react-ga';
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);
}
};
export default setupAnalytics;