My index file for my website is pure PHP, how would I go about inserting the analytics code into it? Will it track all websites throughout my website that way? Thanks.
Try something like this. You can echo or print it out on your page. I recommend doing it at the bottom of the footer so that you don't slow down your website's display time. echo ' <script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"> </script> <script type="text/javascript"> _uacct = "YOURINFOHERE"; urchinTracker(); </script>'; PHP:
Why don't you just end the php tag before you insert the js code? Since you wouldn't need any more php since it should be at the bottom of the page.
Find where the </body></html> tags are located and just above that put the code that jestep meationed. echo '<script src="https://ssl.google-analytics.com/urchin.js" type="text/javascript"></script><script type="text/javascript">_uacct = "YOURINFOHERE";urchinTracker();</script>'; PHP:
Yeah that was my first thought, but there are no html and body tags. I tried creating them in different locations but it isn't working.
Ok, I have tried that, but I am not getting any views/visits on my Analytics page. Here is the code for the main index.php page: <?php error_reporting(E_ALL & ~E_NOTICE); define('NO_REGISTER_GLOBALS', 1); define('THIS_SCRIPT', 'adv_index'); define('VBA_PORTAL', true); define('VBA_SCRIPT', 'CMPS'); $forumpath = '/home/www/website/forum'; if ($forumpath) { if (!is_dir($forumpath)) { echo 'Invalid forum path specified! Please edit this file and be sure to include the correct path for your $forumpath variable.'; exit; } chdir($forumpath); } $phrasegroups = array(); $globaltemplates = array(); $actiontemplates = array(); $specialtemplates = array(); require_once('./includes/vba_cmps_include_template.php'); require_once('./global.php'); print_portal_output($home); ?> PHP: Where would you put the analytics code? Thanks.
Looks like it might me in the './includes/vba_cmps_include_template.php' file. Seems like your file uses a template managing. The </body> tag should be in that file.
Can you post the code of the vba_cmps_include_template.php. i would look for further includes on that page or functions that look like they call specific parts of the actual html. Is this a specific CMS that you are using? That might help us figure out where the html for the template it at.
Ok here it is: <?php error_reporting(E_ALL & ~E_NOTICE); $phrasegroups = array_merge($phrasegroups, array( 'calendar', 'adv_portal', 'postbit' ) ); $specialtemplates = array_merge($specialtemplates, array( 'adv_modules', 'adv_portal_cale', 'adv_portal_home', 'adv_portal_opts', 'adv_portal_page', 'adv_portal_tpst', 'attachmentcache', 'bbcodecache', 'birthdaycache', 'eventcache', 'iconcache', 'maxloggedin', 'rankphp', 'smiliecache', 'userstats' ) ); $globaltemplates = array_merge($globaltemplates, array( 'adv_portal', 'adv_portal_footer', 'adv_portal_nodisplay' ) ); ?> PHP: This is vBAdvanced CMPS, a plugin for vBulletin. Hope you can help
search all the code for </body> it should go right before the closing body tag. adv_portal_footer or adv_portal_nodisplay would be my guess, but search all the code if its not there.
I found a solution to this problem finally I just had to enter the code into the footer template of vBulletin, because this way it will track all pages and still be on the vBAdvanced homepage. Thanks for everyones help Very appreciated.