Topic: [Request] Stats code embed box

I'd like just a simple extension that would put a text box in the admin settings where I could paste whatever custom stats tracking code I want (Google Analytics, Reinvigorate.net etc) and it would be embedded before </body>. I'd love you forever if someone could put this together. Seems simple enough; I just know enough about coding to break things, otherwise I'd attempt to make it myself.

Thanks!

Re: [Request] Stats code embed box

Enjoy! http://garciat.us.to/code/before_body.zip

3 (edited by NetworkShadow 2008-12-10 14:03)

Re: [Request] Stats code embed box

Thanks so much Garciat!

Quick question. Does this code still work with 1.3.2? It doesn't seem to be working with this extension. hmm

<?php echo $forum_user['username']; ?>

4 (edited by User33 2008-12-10 16:25)

Re: [Request] Stats code embed box

Oh... you want to use PHP on it... let me see what I can do.

5 (edited by NetworkShadow 2008-12-10 16:21)

Re: [Request] Stats code embed box

Garciat wrote:

Oh... you want to use PHP on it... let me see what I can do.

Ahh I had a feeling the extension didn't allow php. Thanks again for your help. Here's the code I want to use:

<script type="text/javascript" src="http://include.reinvigorate.net/re_.js"></script>
<script type="text/javascript">
// <![CDATA[
var re_name_tag = "<?php
echo $forum_user['username'];
?>";
re_("******");
// ]]>
</script>

<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
echo $forum_user['username'];
?>");
</script>

Re: [Request] Stats code embed box

Ok, I changed some stuff, redownload the ZIP.

If you want to use a variable, just put it in brackets. Like this: {$forum_user['username']}.

7 (edited by NetworkShadow 2008-12-11 14:36)

Re: [Request] Stats code embed box

Ok getting an error:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/httpd/vhosts/untitledimage.com/httpdocs/forums/header.php(51) : eval()'d code(13) : eval()'d code on line 1

Re: [Request] Stats code embed box

Here's my stats code:

<script type="text/javascript" src="http://include.reinvigorate.net/re_.js"></script>
<script type="text/javascript">
// <![CDATA[
var re_name_tag = "{$forum_user['username']}";
re_("*******");
// ]]>
</script>

<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("{$forum_user['username']}");
</script>

Re: [Request] Stats code embed box

Ok, download it again and see if that works.

Re: [Request] Stats code embed box

Works like a charm! Thanks so much for your time and help. Hopefully this will also come in handy other punBB administrators too.