Sha256: e6c67b6b2f036211271cca4cca09426c7f056db4f2594647f9801be1ef99c5b4

Contents?: true

Size: 1.31 KB

Versions: 44

Compression:

Stored size: 1.31 KB

Contents

#
# Google Universal Analytics plugin for tDiary
#
# Copyright (C) 2014 TSUNEMATSU Shinya <s@tnmt.info>
# You can redistribute it and/or modify it under GPL2.
#
if /^(?:latest|day|month|nyear|search)$/ =~ @mode then
	add_footer_proc do
		google_universal_analytics_insert_code
	end
end

def google_universal_analytics_insert_code
	return '' unless @conf['google_universal_analytics.profile']
	<<-HTML
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-#{h @conf['google_universal_analytics.profile']}', 'auto');
  ga('require', 'displayfeatures');
  ga('send', 'pageview');
</script>
	HTML
end

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

Version data entries

44 entries across 38 versions & 2 rubygems

Version Path
tdiary-contrib-5.3.0 plugin/google_universal_analytics.rb
tdiary-contrib-5.2.4 plugin/google_universal_analytics.rb
tdiary-contrib-5.2.3 plugin/google_universal_analytics.rb
tdiary-contrib-5.2.2 plugin/google_universal_analytics.rb
tdiary-contrib-5.2.1 plugin/google_universal_analytics.rb
tdiary-contrib-5.2.0 plugin/google_universal_analytics.rb
tdiary-contrib-5.1.7 plugin/google_universal_analytics.rb
tdiary-contrib-5.1.6 plugin/google_universal_analytics.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/plugin/google_universal_analytics.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/bundler/gems/tdiary-contrib-d1e41204db13/plugin/google_universal_analytics.rb
tdiary-contrib-5.1.5 plugin/google_universal_analytics.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/tdiary-contrib-5.1.4/plugin/google_universal_analytics.rb
tdiary-contrib-5.1.4 plugin/google_universal_analytics.rb
tdiary-contrib-5.1.3 plugin/google_universal_analytics.rb
tdiary-contrib-5.1.2 plugin/google_universal_analytics.rb
tdiary-contrib-5.1.1 plugin/google_universal_analytics.rb
tdiary-contrib-5.1.0 plugin/google_universal_analytics.rb
tdiary-contrib-5.0.13 plugin/google_universal_analytics.rb
tdiary-contrib-5.0.12 plugin/google_universal_analytics.rb
tdiary-contrib-5.0.11 plugin/google_universal_analytics.rb