Skip to content

Commit

Permalink
adding analytics
Browse files Browse the repository at this point in the history
  • Loading branch information
tenderlove committed Jan 1, 2011
1 parent 663d13e commit 0350381
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
21 changes: 21 additions & 0 deletions app/helpers/application_helper.rb
@@ -1,2 +1,23 @@
module ApplicationHelper
def analytics_tag
if Rails.env.production?
<<-eojs
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-1260604-9']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
eojs
else
''
end
end
end
1 change: 1 addition & 0 deletions app/views/layouts/application.html.erb
Expand Up @@ -5,6 +5,7 @@
<%= stylesheet_link_tag :all %>
<%= javascript_include_tag :defaults %>
<%= csrf_meta_tag %>
<%= analytics_tag %>
</head>
<body>

Expand Down

0 comments on commit 0350381

Please sign in to comment.