Topic: Best way to embed stats tracking code?
First off, I'm sorry I'm not too php savvy.
I use Reinvigorate and Google Analytics for my stats. They both do different things well so I tend to use both at the same time.
Reinvigorate says the javascript should be put before </head> and Google wants to be right before </body>. I was just wondering what file(s) I should be putting this code in.
I think it should be a feature or extension to be able to paste any stats code into a text box somewhere in the administration.
Also with both services you can track registered users. I was wondering what code I should use to get the current logged-in user's username. Here's the example of the code I've been using with Ning.
<?php
$user = XN_Profile::current();
echo "$user->fullName";
?>
What would be the punbb version of this? Thanks!
Google:
<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">
var pageTracker = _gat._getTracker("*****");
pageTracker._initData();
pageTracker._trackPageview();
pageTracker._setVar("<?php
$user = XN_Profile::current();
echo "$user->fullName";
?>");
</script>
Reinvigorate:
<script type="text/javascript" src="http://include.reinvigorate.net/re_.js"></script>
<script type="text/javascript">
// <![CDATA[
var re_name_tag = "<?php
$user = XN_Profile::current();
echo "$user->fullName";
?>";
re_("******");
// ]]>
</script>