MyBB Community Forums

Full Version: Inserting phpTrafficA tracking code
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Hi I'm trying to add tracking code from the analytics programme, phpTrafficA, into MyBB. I searched for this but didn't find anything that helped me. I'm supposed to add the following php code onto every page:

$sid="71485";
include("/var/www/html/traffic/write_logs.php");

I read somewhere that php code cannot be added to the templates for security reasons. So I'm not sure how and where to add it?
Add it to the header_include template. Make sure you have the write_logs.php file on your server.
hmm .. I don't seem to have a template named "header_include". Do you know where I can find this? Thanks.
It is under Ungrouped Templates.
Okay I added it to headerinclude, but it's not working. I use the same analytics code on other parts of my site so I know that's not at fault. This is what the template has now:

<link rel="alternate" type="application/rss+xml" title="{$lang->latest_threads} (RSS 2.0)" href="{$mybb->settings['bburl']}/syndication.php" />
<link rel="alternate" type="application/atom+xml" title="{$lang->latest_threads} (Atom 1.0)" href="{$mybb->settings['bburl']}/syndication.php?type=atom1.0" />
<meta http-equiv="Content-Type" content="text/html; charset={$charset}" />
<meta http-equiv="Content-Script-Type" content="text/javascript" />
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/prototype.js?ver=1400"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/general.js?ver=1400"></script>
<script type="text/javascript" src="{$mybb->settings['bburl']}/jscripts/popup_menu.js?ver=1400"></script>
{$stylesheets}
<script type="text/javascript">
<!--
var cookieDomain = "{$mybb->settings['cookiedomain']}";
var cookiePath = "{$mybb->settings['cookiepath']}";
var cookiePrefix = "{$mybb->settings['cookieprefix']}";
var deleteevent_confirm = "{$lang->deleteevent_confirm}";
var removeattach_confirm = "{$lang->removeattach_confirm}";
var loading_text = '{$lang->ajax_loading}';
var saving_changes = '{$lang->saving_changes}';
var use_xmlhttprequest = "{$mybb->settings['use_xmlhttprequest']}";
var my_post_key = "{$mybb->post_code}";
var imagepath = "{$theme['imgdir']}";
// -->
</script>
{$newpmmsg}
<?php
$sid="71485";
include("/var/www/html/traffic/write_logs.php");
?>
You can't put PHP in templates. What are you trying to do, exactly?
That's what I thought. My first post explains what I'm trying to do. I'm trying to add tracking code from the analytics programme, phpTrafficA. I think it has to be in the body of every page.
Ah. Sorry, I can't help you then. I'm not very familiar with how MyBB handles variables, otherwise I could just tell you to make a variable and then put that variable in a template.
Okay thanks anyway. Hopefully someone else knows the answer.
Yep, no problemSmile I'll try and figure it out in the mean time though.
Pages: 1 2