Commit b50d4f42 authored by Andrew Hrdy's avatar Andrew Hrdy
Browse files

Redux dev tools not loaded in production, google analytics not loaded in develop.

parent 4958b167
...@@ -33,14 +33,6 @@ ...@@ -33,14 +33,6 @@
</head> </head>
<!-- Global site tag (gtag.js) - Google Analytics --> <!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-112607180-1"></script> <script async src="https://www.googletagmanager.com/gtag/js?id=UA-112607180-1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag() {
dataLayer.push(arguments);
}
gtag('js', new Date());
gtag('config', 'UA-112607180-1');
</script>
<body> <body>
<noscript> <noscript>
......
...@@ -17,13 +17,17 @@ import 'typeface-roboto'; ...@@ -17,13 +17,17 @@ import 'typeface-roboto';
// Create a history of your choosing (we're using a browser history in this case) // Create a history of your choosing (we're using a browser history in this case)
const history = createHistory(); const history = createHistory();
const extension = window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__(); const extension = window.__REDUX_DEVTOOLS_EXTENSION__ && window.__REDUX_DEVTOOLS_EXTENSION__();
const isProduction = process.env.NODE_ENV === 'production';
let enhance; const enhance = compose(applyMiddleware(ReduxThunk, routerMiddleware(history)), !isProduction && extension);
if (extension) { if (isProduction) {
enhance = compose(applyMiddleware(ReduxThunk, routerMiddleware(history)), extension); window.dataLayer = window.dataLayer || [];
} else { const gtag = (args) => {
enhance = compose(applyMiddleware(ReduxThunk, routerMiddleware(history))); window.dataLayer.push(args);
};
gtag('js', new Date());
gtag('config', 'UA-112607180-1');
} }
const store = createStore(reducers, enhance); const store = createStore(reducers, enhance);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment