Permalink
Browse files

Installed google analytics

  • Loading branch information...
1 parent 5955916 commit b8b9d928b29ab8fb03777dcfa4ce0d6a11737ef1 @PavelTyk committed Aug 1, 2011
Showing with 18 additions and 0 deletions.
  1. +16 −0 app/helpers/application_helper.rb
  2. +2 −0 app/views/layouts/frontend.html.haml
@@ -19,4 +19,20 @@ def follow_link(user = nil)
def title(page_title)
content_for(:title) { page_title }
end
+
+ def render_google_analytics
+ <<EOD
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-11357677-6']);
+ _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>
+EOD
+ end
end
+
@@ -8,6 +8,7 @@
%meta{:content => '', :name => 'description'}
%link{:rel => "shortcut icon", :href => "/favicon.gif"}
= stylesheet_link_tag 'reset', 'highlight-github', 'styles'
+ = render_google_analytics if Rails.env.production?
%body
#container
%header
@@ -25,3 +26,4 @@
:javascript
hljs.initHighlightingOnLoad();
$(document).ready(function(){#{yield :javascript}});
+

0 comments on commit b8b9d92

Please sign in to comment.