Changeset 1203


Ignore:
Timestamp:
Aug 5, 2008, 9:36:03 PM (9 years ago)
Author:
Dominic Hargreaves
Message:

Update Google Analytics code to support new version (closes #255)

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/Changes

    r1197 r1203  
    2222        Added a Universal Edit Link (http://universaleditbutton.org/) (#254)
    2323        Update references to http://openguides.org moved URLs
     24        Update Google Analytics code to support new version (#255)
    2425
    25260.62    8 June 2008
  • trunk/t/48_google_analytics.t

    r967 r1203  
    3535                                return_output => 1,
    3636                              );
    37 unlike( $output, qr/urchinTracker/, "Google analytics omitted by default" );
     37unlike( $output, qr/ga.js/, "Google analytics omitted by default" );
    3838
    3939$config->google_analytics_key( "" );
     
    4242                                return_output => 1,
    4343                              );
    44 unlike( $output, qr/urchinTracker/, "...also if analytics key is blank" );
     44unlike( $output, qr/ga.js/, "...also if analytics key is blank" );
    4545
    4646$config->google_analytics_key( 0 );
     
    4949                                return_output => 1,
    5050                              );
    51 unlike( $output, qr/urchinTracker/, "...also if analytics key is zero" );
     51unlike( $output, qr/ga.js/, "...also if analytics key is zero" );
    5252
    5353$config->google_analytics_key( "ThisIsNotAKey" );
     
    5656                                return_output => 1,
    5757                              );
    58 like( $output, qr/urchinTracker/, "does show up if key is provided" );
     58like( $output, qr/ga.js/, "does show up if key is provided" );
    5959like( $output, qr/ThisIsNotAKey/, "...correct key" );
  • trunk/templates/footer.tt

    r1055 r1203  
    4747
    4848  [% IF config.google_analytics_key %]
    49     <script src="http://www.google-analytics.com/urchin.js"
    50      type="text/javascript">
     49    <script type="text/javascript">
     50    var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
     51    document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
    5152    </script>
     53
    5254    <script type="text/javascript">
    53       _uacct = "[% CGI.escapeHTML( config.google_analytics_key  ) %]";
    54       if ( typeof urchinTracker == 'function' ) urchinTracker();
     55    var pageTracker = _gat._getTracker("[% CGI.escapeHTML( config.google_analytics_key  ) %]");
     56    pageTracker._trackPageview();
    5557    </script>
    5658  [% END %]
Note: See TracChangeset for help on using the changeset viewer.