Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58260 - website/public_html/beta/doc
From: daniel_james_at_[hidden]
Date: 2009-12-09 20:59:32


Author: danieljames
Date: 2009-12-09 20:59:31 EST (Wed, 09 Dec 2009)
New Revision: 58260
URL: http://svn.boost.org/trac/boost/changeset/58260

Log:
Try implementing multiple domain tracking for google analytics in the spirit docs.
Text files modified:
   website/public_html/beta/doc/display_libs.php | 13 +++++++++++--
   1 files changed, 11 insertions(+), 2 deletions(-)

Modified: website/public_html/beta/doc/display_libs.php
==============================================================================
--- website/public_html/beta/doc/display_libs.php (original)
+++ website/public_html/beta/doc/display_libs.php 2009-12-09 20:59:31 EST (Wed, 09 Dec 2009)
@@ -2,11 +2,16 @@
 require_once(dirname(__FILE__) . '/../common/code/boost_archive.php');
 
 function add_spirit_analytics($content) {
+ if(stripos($content, '_uacct = "UA-11715441-2"') !== FALSE)
+ return $content;
+
     $analytics = <<<EOS
 <script type="text/javascript">
   var _gaq = _gaq || [];
   _gaq.push(['_setAccount', 'UA-11715441-2']);
   _gaq.push(['_trackPageview']);
+ _gaq.push(['_setDomainName', 'none']);
+ _gaq.push(['_setAllowLinker', true]);
 
   (function() {
     var ga = document.createElement('script');
@@ -17,8 +22,12 @@
 </script>
 EOS;
 
- return stripos($content, '_uacct = "UA-11715441-2"') !== FALSE ? $content :
- str_ireplace('</head>', $analytics.'</head>', $content);
+ $content = preg_replace(
+ '@<a\s+href="(http://spirit.sourceforge.net[^"]*)"@i',
+ '<a href="${1}" onclick=\'_gaq.push(["_link", "${1}"); return false;\'',
+ $content );
+
+ return str_ireplace('</head>', $analytics.'</head>', $content);
 }
 
 $_file = new boost_archive('@^[/]([^/]+)[/](.*)$@',$_SERVER["PATH_INFO"],array(


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk