Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r58374 - in website/public_html/live: . doc
From: daniel_james_at_[hidden]
Date: 2009-12-14 05:14:33


Author: danieljames
Date: 2009-12-14 05:14:33 EST (Mon, 14 Dec 2009)
New Revision: 58374
URL: http://svn.boost.org/trac/boost/changeset/58374

Log:
Merge analytics changes from beta.
Properties modified:
   website/public_html/live/ (props changed)
Text files modified:
   website/public_html/live/doc/display_build.php | 35 +++++++++++++++++++++++------------
   website/public_html/live/doc/display_jam.php | 20 +++++++++++++-------
   website/public_html/live/doc/display_libs.php | 34 +++++++++++++++++++++++++++++++++-
   3 files changed, 69 insertions(+), 20 deletions(-)

Modified: website/public_html/live/doc/display_build.php
==============================================================================
--- website/public_html/live/doc/display_build.php (original)
+++ website/public_html/live/doc/display_build.php 2009-12-14 05:14:33 EST (Mon, 14 Dec 2009)
@@ -3,16 +3,22 @@
 
 function add_boost_build_analytics($content) {
     $analytics = <<<EOS
-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
-</script>
 <script type="text/javascript">
-_uacct = "UA-2917240-2";
-urchinTracker();
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-2917240-2']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script');
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ ga.setAttribute('async', 'true');
+ document.documentElement.firstChild.appendChild(ga);
+ })();
 </script>
 EOS;
 
     return stripos($content, '_uacct = "UA-2917240-2"') !== FALSE ? $content :
- str_ireplace('</body>', $analytics.'</body>', $content);
+ str_ireplace('</head>', $analytics.'</head>', $content);
 }
 $_file = new boost_archive('@^[/]([^/]+)[/](.*)$@',$_SERVER["PATH_INFO"],array(
   //~ array(version-regex,path-regex,raw|simple|text|cpp|boost_book_html|boost_libs_html,mime-type[,preprocess hook]),
@@ -42,7 +48,18 @@
 }
   /*]]>*/
   </style>
-
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-2917240-2']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script');
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ ga.setAttribute('async', 'true');
+ document.documentElement.firstChild.appendChild(ga);
+ })();
+</script>
 </head><!-- <?php print $_file->file_; ?> -->
 
 <body>
@@ -85,11 +102,5 @@
 
     <div class="clear"></div>
   </div>
- <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
- </script>
- <script type="text/javascript">
- _uacct = "UA-2917240-2";
- urchinTracker();
- </script>
 </body>
 </html><?php } ?>
\ No newline at end of file

Modified: website/public_html/live/doc/display_jam.php
==============================================================================
--- website/public_html/live/doc/display_jam.php (original)
+++ website/public_html/live/doc/display_jam.php 2009-12-14 05:14:33 EST (Mon, 14 Dec 2009)
@@ -19,6 +19,18 @@
   <!--[if IE 7]> <style type="text/css"> body { behavior: url(/style/csshover3.htc); } </style> <![endif]-->
   <?php #~ pwn_head(); ?>
 
+<script type="text/javascript">
+ var _gaq = _gaq || [];
+ _gaq.push(['_setAccount', 'UA-2917240-2']);
+ _gaq.push(['_trackPageview']);
+
+ (function() {
+ var ga = document.createElement('script');
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ ga.setAttribute('async', 'true');
+ document.documentElement.firstChild.appendChild(ga);
+ })();
+</script>
 </head><!-- <?php print $_file->file_; ?> -->
 
 <body>
@@ -68,12 +80,6 @@
     </div>
 
     <div class="clear"></div>
- </div>
- <script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
- </script>
- <script type="text/javascript">
- _uacct = "UA-2917240-2";
- urchinTracker();
- </script>
+ </div>
 </body>
 </html><?php } ?>

Modified: website/public_html/live/doc/display_libs.php
==============================================================================
--- website/public_html/live/doc/display_libs.php (original)
+++ website/public_html/live/doc/display_libs.php 2009-12-14 05:14:33 EST (Mon, 14 Dec 2009)
@@ -1,6 +1,37 @@
 <?php
 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'],
+ ['_trackPageview'],
+ ['_setDomainName', 'none'],
+ ['_setAllowLinker', true]
+ );
+
+ (function() {
+ var ga = document.createElement('script');
+ ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+ ga.setAttribute('async', 'true');
+ document.documentElement.firstChild.appendChild(ga);
+ })();
+</script>
+EOS;
+
+ $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(
   //~ array(version-regex,path-regex,raw|simple|text|cpp|boost_book_html|boost_libs_html,mime-type[,preprocess hook]),
   //~ this handles most of the simple cases of index.htm(l) redirect files
@@ -34,7 +65,8 @@
   array('@.*@','@^libs/preprocessor/doc/.*(html|htm)$@i','raw','text/html'),
   array('@.*@','@^libs/test/doc/components/test_tools/reference/.*(html|htm)$@i','raw','text/html'),
   array('@.*@','@^libs/python/doc/PyConDC_2003/bpl.html$@i','raw','text/html'),
- array('@.*@','@^libs/spirit/.*(html|htm)$@i','raw','text/html'),
+ array('@.*@','@^libs/spirit/.*(html|htm)$@i','simple','text/html', 'add_spirit_analytics'),
+ array('@.*@','@^libs/fusion/.*(html|htm)$@i','basic','text/html', 'add_spirit_analytics'),
   array('@.*@','@^libs/static_assert/static_assert.htm$@i','raw','text/html'),
   array('@.*@','@^libs/type_traits/cxx_type_traits.htm$@i','raw','text/html'),
   array('@.*@','@^libs/utility/iterator_adaptors.htm$@i','raw','text/html'),


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