Only record analytics in production. Also record them in admin backend.

This commit is contained in:
Rohan Mitchell
2015-06-03 16:36:31 +10:00
parent 17d123db63
commit 0569ef0505
2 changed files with 11 additions and 7 deletions

View File

@@ -0,0 +1,3 @@
/ insert_bottom "[data-hook='admin_footer_scripts']"
= render 'shared/analytics'

View File

@@ -1,8 +1,9 @@
:javascript
(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');
- if Rails.env.production?
:javascript
(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-62912229-1', 'auto');
ga('send', 'pageview');
ga('create', 'UA-62912229-1', 'auto');
ga('send', 'pageview');