Changeset 1204


Ignore:
Timestamp:
Aug 8, 2008, 11:42:57 AM (9 years ago)
Author:
dom
Message:

Fix Google Analytics by not trying to escape the key

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r1203 r1204  
    2323        Update references to http://openguides.org moved URLs
    2424        Update Google Analytics code to support new version (#255)
     25        Some pages didn't properly include Google Analyatics; fix this (#257)
    2526
    26270.62    8 June 2008
  • trunk/t/48_google_analytics.t

    r1203 r1204  
    1111}
    1212
    13 plan tests => 5;
     13plan tests => 9;
    1414
    1515my ( $config, $guide, $wiki, $cookie, $output );
     
    5858like( $output, qr/ga.js/, "does show up if key is provided" );
    5959like( $output, qr/ThisIsNotAKey/, "...correct key" );
     60# Make sure analytics stuff only shows up if we want it to on recent changes
     61# recent changes doesnt use CGI. which we dont need anymore but we should test in case we change our mind again.
     62
     63$config->google_analytics_key( "" );
     64$output = $guide->display_recent_changes( return_output => 1 );
     65unlike( $output, qr/ga.js/, "...also if analytics key is blank" );
     66
     67$config->google_analytics_key( 0 );
     68$output = $guide->display_recent_changes( return_output => 1 );
     69unlike( $output, qr/ga.js/, "...also if analytics key is zero" );
     70
     71$config->google_analytics_key( "ThisIsNotAKey" );
     72$output = $guide->display_recent_changes( return_output => 1 );
     73like( $output, qr/ga.js/, "does show up if key is provided" );
     74like( $output, qr/ThisIsNotAKey/, "...correct key" );
  • trunk/templates/footer.tt

    r1203 r1204  
    5353
    5454    <script type="text/javascript">
    55     var pageTracker = _gat._getTracker("[% CGI.escapeHTML( config.google_analytics_key  ) %]");
     55    var pageTracker = _gat._getTracker("[% config.google_analytics_key %]");
    5656    pageTracker._trackPageview();
    5757    </script>
Note: See TracChangeset for help on using the changeset viewer.