Sha256: ad1de8ba43f9ae631076edf50c2bb6dfe5d7cc884364e41c679741d364d436ef

Contents?: true

Size: 1.28 KB

Versions: 9

Compression:

Stored size: 1.28 KB

Contents

# Copyright (c) 2010 Samuel Williams. Released under the GNU GPLv3.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# 
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
# 
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

require 'utopia/tags'

Utopia::Tags.create("google_analytics") do |transaction, state|
	html = <<EOF
<!-- Google Analytics -->

<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(#{state[:id].dump});
pageTracker._trackPageview();
} catch(err) {}</script>

<!-- Google Analytics -->
EOF


	transaction.cdata(html)
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
utopia-0.9.26 lib/utopia/tags/google_analytics.rb
utopia-0.9.25 lib/utopia/tags/google_analytics.rb
utopia-0.9.24 lib/utopia/tags/google_analytics.rb
utopia-0.9.23 lib/utopia/tags/google_analytics.rb
utopia-0.9.22 lib/utopia/tags/google_analytics.rb
utopia-0.9.21 lib/utopia/tags/google_analytics.rb
utopia-0.9.20 lib/utopia/tags/google_analytics.rb
utopia-0.9.18 lib/utopia/tags/google_analytics.rb
utopia-0.9.17 lib/utopia/tags/google_analytics.rb