We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent dee7462 commit e91713cCopy full SHA for e91713c
src/lib/analytics.js
@@ -1,10 +1,13 @@
1
import GoogleAnalytics from 'react-ga';
2
3
-GoogleAnalytics.initialize(process.env.GA_ID || window.GA_ID, {
4
- debug: (process.env.NODE_ENV !== 'production'),
5
- titleCase: true,
6
- sampleRate: (process.env.NODE_ENV === 'production') ? 100 : 0,
7
- forceSSL: true
8
-});
+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,
9
+ forceSSL: true
10
+ });
11
+}
12
13
export default GoogleAnalytics;
0 commit comments