How to Add Google Analytics To vBulletin (including archives)

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…

Popularity: 19% [?]

Share This:
  • Sphinn
  • Digg
  • del.icio.us
  • Reddit
  • StumbleUpon
  • Twitter
  • Facebook
  • Google Bookmarks
  • Mixx
  • Tumblr
  • FriendFeed
  • LinkedIn

9 Comments

  1. Posted December 7, 2007 at 3:47 am | Permalink

    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

  2. Posted February 3, 2008 at 11:26 am | Permalink

    Thanks for this, where would you add statcounter code in vbulletin?

  3. Posted February 3, 2008 at 12:00 pm | Permalink

    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.

  4. Posted February 8, 2009 at 8:19 am | Permalink

    Thanks a lot.. information very helpful!ü

  5. Posted April 5, 2009 at 3:18 pm | Permalink

    Thanks – where would you find the “Add New Plugin” area in vBulletin? I would love to be able to place GA in the archives…if I knew where the “Add new plugin” was!

    Thanks in advance!

  6. Posted June 6, 2009 at 6:57 pm | Permalink

    Perfect! I have been always curious on how many visitors are coming to my site but never knew how to install GA with VB. Very helpful info!

  7. Ruark Mozilla Firefox Windows
    Posted July 6, 2009 at 3:17 am | Permalink

    Thanks for the heads up :P VB plugin works 100%

  8. Matt PHP
    Posted December 25, 2009 at 12:29 am | Permalink

    What about the new google analytics code?

    I can’t figure out the strikeouts, lol.

  9. Posted December 26, 2009 at 12:43 pm | Permalink

    @Matt
    You have to put a backslash before every double quote in the Analytics code — that is the only modification.

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*