Sha256: 9b339f111797130d45824b9c188774b93ce5ead7c0eaa746e4698ea823173e16

Contents?: true

Size: 1.19 KB

Versions: 12

Compression:

Stored size: 1.19 KB

Contents

#
# Google Analytics plugin for tDiary
#
# Copyright (C) 2005 TADA Tadashi <sho@spc.gr.jp>
# You can redistribute it and/or modify it under GPL2.
#
if /^(?:latest|day|month|nyear|search)$/ =~ @mode then
	add_footer_proc do
		google_analytics_insert_code
	end
end

def google_analytics_insert_code
	return '' unless @conf['google_analytics.profile']
	<<-HTML
	<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("UA-#{h @conf['google_analytics.profile']}");
		pageTracker._trackPageview();
	} catch (err) {}
	// --></script>
	HTML
end

# UA-53836-1
add_conf_proc( 'google_analytics', 'Google Analytics' ) do
	if @mode == 'saveconf' then
		@conf['google_analytics.profile'] = @cgi.params['google_analytics.profile'][0]
	end
	<<-HTML
		<h3>Google Analytics Profile</h3>
		<p>set your Profile ID (NNNNN-N)</p>
		<p><input name="google_analytics.profile" value="#{h @conf['google_analytics.profile']}"></p>
	HTML
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
tdiary-contrib-4.2.0 plugin/google_analytics.rb
tdiary-contrib-4.1.3 plugin/google_analytics.rb
tdiary-contrib-4.1.2 plugin/google_analytics.rb
tdiary-contrib-4.1.1 plugin/google_analytics.rb
tdiary-contrib-4.1.0 plugin/google_analytics.rb
tdiary-contrib-4.0.5.1 plugin/google_analytics.rb
tdiary-contrib-4.0.4 plugin/google_analytics.rb
tdiary-contrib-4.0.3 plugin/google_analytics.rb
tdiary-contrib-4.0.2.1 plugin/google_analytics.rb
tdiary-contrib-4.0.2 plugin/google_analytics.rb
tdiary-contrib-3.2.2.20130614 plugin/google_analytics.rb
tdiary-contrib-3.2.2.20130518 plugin/google_analytics.rb