Permalink
Browse files

add: support for google analytics

  • Loading branch information...
1 parent cf3684f commit d6b1d1f4e4d233d2b78a886828e2e463cc85fb01 @qiao committed Sep 21, 2011
Showing with 14 additions and 0 deletions.
  1. +13 −0 app/views/layouts/application.html.erb
  2. +1 −0 config/config.yml
@@ -50,5 +50,18 @@
</footer>
</div>
+ <% unless APP_CONFIG['google_analytic_id'].blank? %>
+ <script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', '<%= APP_CONFIG['google_analytic_id'] %>']);
+ _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>
+ <% end%>
+
</body>
</html>
View
@@ -1,2 +1,3 @@
base_title: Typedef.me
password: 12345qwert
+google_analytic_id: UA-21856083-2

0 comments on commit d6b1d1f

Please sign in to comment.