diff --git a/site/entry/index.jsx b/site/entry/index.jsx index e2e8f5875..70b37e104 100644 --- a/site/entry/index.jsx +++ b/site/entry/index.jsx @@ -28,6 +28,22 @@ const redirects = Object.keys(config.redirects).map((from, index) => { return ; }); +// Enable Google Analytics +if (!location.port) { + /* eslint-disable */ + (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ + (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), + m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) + })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); + ga('create', 'UA-72788897-1', 'auto'); + ga('send', 'pageview'); + + hashHistory.listen((loc) => { + ga('send', 'pageview', loc.pathname + loc.search); + }); + /* eslint-enable */ +} + ReactDOM.render(