lib/caboodle/kits/analytics/analytics.rb in caboodle-0.2.13 vs lib/caboodle/kits/analytics/analytics.rb in caboodle-0.2.14

- old
+ new

@@ -1,20 +1,21 @@ module Caboodle class Analytics < Caboodle::Kit - add_to_layout "after_body" => "<script type=\"text/javascript\"> + description "Adds Google Analytics to every page of the site" + required [:analytics_id] + end +end - var _gaq = _gaq || []; - _gaq.push(['_setAccount', '#{Caboodle::Site.analytics_id}']); - _gaq.push(['_setDomainName', 'none']); - _gaq.push(['_setAllowLinker', true]); - _gaq.push(['_trackPageview']); +Caboodle::Layout.add_to_layout "after_body" => "<script type=\"text/javascript\"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', '#{Caboodle::Site.analytics_id}']); + _gaq.push(['_setDomainName', 'none']); + _gaq.push(['_setAllowLinker', true]); + _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); - })(); + (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>" - required [:analytics_id] - end -end +</script>" \ No newline at end of file