6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
# File 'lib/analytics/rails/action_view/base.rb', line 6
def google_analytics_include_tag(account)
if ::Rails.env.production?
script = <<-SCRIPT
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '#{account}']);
_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
content_tag(:script, script.html_safe, :type => 'text/javascript')
end
end
|