Skip to content

Commit

Permalink
google async tracking code
Browse files Browse the repository at this point in the history
  • Loading branch information
ryonlife committed Jun 13, 2010
1 parent 66ee693 commit 131e375
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
17 changes: 9 additions & 8 deletions views/analytics.haml
@@ -1,11 +1,12 @@
- if @google_analytics_code
:plain
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("#{@google_analytics_code}");
pageTracker._trackPageview();
} catch(err) {}</script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '#{@google_analytics_code}']);
_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>
6 changes: 3 additions & 3 deletions views/layout.haml
Expand Up @@ -19,6 +19,8 @@
%script{ :type => "text/javascript", :src => "/js/app.js"}
%link{ :href => "/articles.xml", :rel => "alternate", :type => "application/atom+xml" }
= haml :analytics, :layout => false
%body{ :class => @body_class }
#wrap
Expand Down Expand Up @@ -47,6 +49,4 @@
This site is Creative Commons-licensed and <a href="http://github.com/RyOnLife/ryonlife.com">open-sourced on Github</a>.
%p Troy, buddy, <a href="http://www.flickr.com/photos/troyholden/4114564467/">thanks</a> for the rad pic taken right here in San Francisco.
#shade
= haml :analytics, :layout => false
#shade

0 comments on commit 131e375

Please sign in to comment.