vBulletin makes good forum software, but it’s hard to add Google Analytics to it. Most of the instructions that you find online on how to add the Google Analytics code don’t work for the forum archives.
UPDATE: I recommend just installing vbSEO instead of the solution below because you can add Google Analytics directly through the vbSEO interface. vbSEO also adds many other critical SEO improvements to the basic vBulletin installation. However, the solution below can still be used to add other types of tracking code to vBulletin, like Clicky Stats, and excellent free Web 2.0 stats program.
Here are some step-by-step instructions for adding Google Analytics (or other tracking code, like Clicky) to vBulletin:
In your vBulletin admin control panel, click on Style Manager and navigate your way through the options to “edit templates”. Double click on the footer template. Add your Google Analytics or other tracking code right at the bottom of the footer template. That will enable tracking for the main part of your forum.
To get the tracking code into the archives, click on “Add New Plugin”, and from the select box choose archive_complete. Enter the following code in the textarea and make the plugin active:
$output .= "<script src=\"http://www.google-analytics.com/urchin.js\" type=\"text/javascript\"> </script> <script type=\"text/javascript\"> _uacct = \"UA-XXXXXXX-X\"; urchinTracker(); </script>";
If you are using another analytics system, just replace the Google Analytics code with it, being sure to escape all double quotes with a backslash.
vBSEO
Also, if you are using vBulletin, I highly recommend using vBSEO to optimize your forums. vBSEO will create clean, search engine friendly URLs on your forum and 301 redirect the old URLs to the new URLs. It will also provide other SEO benefits like remove the redirects in RSS feeds, remove the links to /index.php, and add trackback and pinging features. vBSEO can also add Google Analytics code to your forum…

3 Comments
Hi there!
thank you so much for this information I have a vbulletin forum, and for I long time I did not find the way to put the analytic code into the vb, but now it’s perfect, thank you so much
Thanks for this, where would you add statcounter code in vbulletin?
Same place as for Google Analytics. Just be sure to escape any double quotes with backslashes when adding the Statcounter code to the vBulletin archives.