Skip to content
Snippets Groups Projects
Commit e91713c2 authored by Christopher Willis-Ford's avatar Christopher Willis-Ford
Browse files

initialize Google Analytics only if GA_ID is set

parent dee7462c
Branches
No related tags found
No related merge requests found
import GoogleAnalytics from 'react-ga';
GoogleAnalytics.initialize(process.env.GA_ID || window.GA_ID, {
debug: (process.env.NODE_ENV !== 'production'),
titleCase: true,
sampleRate: (process.env.NODE_ENV === 'production') ? 100 : 0,
forceSSL: true
});
const GA_ID = (process.env.GA_ID || window.GA_ID);
if (GA_ID) {
GoogleAnalytics.initialize(GA_ID, {
debug: (process.env.NODE_ENV !== 'production'),
titleCase: true,
sampleRate: (process.env.NODE_ENV === 'production') ? 100 : 0,
forceSSL: true
});
}
export default GoogleAnalytics;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment