Author: dom Date: 2008-08-08 11:42:57 +0100 (Fri, 08 Aug 2008) New Revision: 1204
Modified: trunk/Changes trunk/t/48_google_analytics.t trunk/templates/footer.tt Log: Fix Google Analytics by not trying to escape the key
Modified: trunk/Changes =================================================================== --- trunk/Changes 2008-08-05 20:36:03 UTC (rev 1203) +++ trunk/Changes 2008-08-08 10:42:57 UTC (rev 1204) @@ -22,6 +22,7 @@ Added a Universal Edit Link (http://universaleditbutton.org/) (#254) Update references to http://openguides.org moved URLs Update Google Analytics code to support new version (#255) + Some pages didn't properly include Google Analyatics; fix this (#257)
0.62 8 June 2008 Allow wiki page links (simple: [[Foo]], title: [[Foo|bar]]) in
Modified: trunk/t/48_google_analytics.t =================================================================== --- trunk/t/48_google_analytics.t 2008-08-05 20:36:03 UTC (rev 1203) +++ trunk/t/48_google_analytics.t 2008-08-08 10:42:57 UTC (rev 1204) @@ -10,7 +10,7 @@ exit 0; }
-plan tests => 5; +plan tests => 9;
my ( $config, $guide, $wiki, $cookie, $output );
@@ -57,3 +57,18 @@ ); like( $output, qr/ga.js/, "does show up if key is provided" ); like( $output, qr/ThisIsNotAKey/, "...correct key" ); +# Make sure analytics stuff only shows up if we want it to on recent changes +# recent changes doesnt use CGI. which we dont need anymore but we should test in case we change our mind again. + +$config->google_analytics_key( "" ); +$output = $guide->display_recent_changes( return_output => 1 ); +unlike( $output, qr/ga.js/, "...also if analytics key is blank" ); + +$config->google_analytics_key( 0 ); +$output = $guide->display_recent_changes( return_output => 1 ); +unlike( $output, qr/ga.js/, "...also if analytics key is zero" ); + +$config->google_analytics_key( "ThisIsNotAKey" ); +$output = $guide->display_recent_changes( return_output => 1 ); +like( $output, qr/ga.js/, "does show up if key is provided" ); +like( $output, qr/ThisIsNotAKey/, "...correct key" );
Modified: trunk/templates/footer.tt =================================================================== --- trunk/templates/footer.tt 2008-08-05 20:36:03 UTC (rev 1203) +++ trunk/templates/footer.tt 2008-08-08 10:42:57 UTC (rev 1204) @@ -52,7 +52,7 @@ </script>
<script type="text/javascript"> - var pageTracker = _gat._getTracker("[% CGI.escapeHTML( config.google_analytics_key ) %]"); + var pageTracker = _gat._getTracker("[% config.google_analytics_key %]"); pageTracker._trackPageview(); </script> [% END %]
openguides-commits@lists.openguides.org