Author: dom
Date: 2008-08-05 21:36:03 +0100 (Tue, 05 Aug 2008)
New Revision: 1203
Modified:
trunk/Changes
trunk/t/48_google_analytics.t
trunk/templates/footer.tt
Log:
Update Google Analytics code to support new version (closes #255)
Modified: trunk/Changes
===================================================================
--- trunk/Changes 2008-07-30 22:40:38 UTC (rev 1202)
+++ trunk/Changes 2008-08-05 20:36:03 UTC (rev 1203)
@@ -21,6 +21,7 @@
* Reduce acres of whitespace in output and clean up indenting.
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)
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-07-30 22:40:38 UTC (rev 1202)
+++ trunk/t/48_google_analytics.t 2008-08-05 20:36:03 UTC (rev 1203)
@@ -34,26 +34,26 @@
id => "Red Lion",
return_output => 1,
);
-unlike( $output, qr/urchinTracker/, "Google analytics omitted by default" );
+unlike( $output, qr/ga.js/, "Google analytics omitted by default" );
$config->google_analytics_key( "" );
$output = $guide->display_node(
id => "Red Lion",
return_output => 1,
);
-unlike( $output, qr/urchinTracker/, "...also if analytics key is blank" );
+unlike( $output, qr/ga.js/, "...also if analytics key is blank" );
$config->google_analytics_key( 0 );
$output = $guide->display_node(
id => "Red Lion",
return_output => 1,
);
-unlike( $output, qr/urchinTracker/, "...also if analytics key is zero" );
+unlike( $output, qr/ga.js/, "...also if analytics key is zero" );
$config->google_analytics_key( "ThisIsNotAKey" );
$output = $guide->display_node(
id => "Red Lion",
return_output => 1,
);
-like( $output, qr/urchinTracker/, "does show up if key is provided" );
+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-07-30 22:40:38 UTC (rev 1202)
+++ trunk/templates/footer.tt 2008-08-05 20:36:03 UTC (rev 1203)
@@ -46,12 +46,14 @@
</div>
[% IF config.google_analytics_key %]
- <script
src="http://www.google-analytics.com/urchin.js"
- type="text/javascript">
+ <script type="text/javascript">
+ var gaJsHost = (("https:" == document.location.protocol) ?
"https://ssl." : "http://www.");
+ document.write(unescape("%3Cscript src='" + gaJsHost +
"google-analytics.com/ga.js'
type='text/javascript'%3E%3C/script%3E"));
</script>
+
<script type="text/javascript">
- _uacct = "[% CGI.escapeHTML( config.google_analytics_key ) %]";
- if ( typeof urchinTracker == 'function' ) urchinTracker();
+ var pageTracker = _gat._getTracker("[% CGI.escapeHTML(
config.google_analytics_key ) %]");
+ pageTracker._trackPageview();
</script>
[% END %]