# # Google Analytics plugin for tDiary # # Copyright (C) 2005 TADA Tadashi # 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 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] @conf['google_analytics.amp.profile'] = @cgi.params['google_analytics.amp.profile'][0] end r = <<-HTML

Google Analytics Profile

set your Profile ID (NNNNN-N)

HTML if defined? AMP r << <<-HTML

Google Analytics Profile for AMP page

set your Profile ID (NNNNN-N) for AMP page

HTML end r end if defined? AMP add_amp_header_proc do %Q|| end add_amp_body_enter_proc do profile_id = %w(google_analytics.amp.profile google_analytics.profile).map {|key| @conf[key] }.find {|profile| profile && !profile.empty? } <<-HTML HTML end end