Sha256: 2acc0e249c62f0159eb236c6f2fb567c7272bc3cd493069fd716f5e662182c2c

Contents?: true

Size: 800 Bytes

Versions: 2

Compression:

Stored size: 800 Bytes

Contents

#	This file is part of the "Utopia Framework" project, and is licensed under the GNU AGPLv3.
#	Copyright 2010 Samuel Williams. All rights reserved.
#	See <utopia.rb> for licensing details.

require 'utopia/tags'

Utopia::Tags.create("google_analytics") do |transaction, state|
	html = <<EOF
<script type="text/javascript">
	var _gaq = _gaq || []; _gaq.push(['_setAccount', #{state[:id].to_quoted_string}]); _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>
EOF


	transaction.cdata(html)
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
utopia-0.9.58 lib/utopia/tags/google_analytics.rb
utopia-0.9.57 lib/utopia/tags/google_analytics.rb