<?php
/*
Plugin Name: bbAnalytics
Plugin URI: http://valery.bgit.net/
Description: Adds Google Analytics code to bbPress pages.
Author: Valery Dachev
Author URI: http://valery.bgit.net/
Version: 0.1

    Installation instructions:
    * if there is no my-plugins/ directory in your bbPress installation directory, create one;
    * copy bb-analytics.php to the my-plugins/ directory;
    * change the value of GOOGLE_ANALYTICS_UACCT define to the one provided by Google Analytics;
    * have a beer.

*/

define('GOOGLE_ANALYTICS_UACCT''UA-124389-9');

function 
bb_analytics_head()
{    
?>
<script type="text/javascript">
_uacct = "<?php echo GOOGLE_ANALYTICS_UACCT ?>";
urchinTracker();
</script>
<?php
}

bb_enqueue_script('google_analytics''http://www.google-analytics.com/urchin.js');
add_action('bb_head''bb_analytics_head');
?>