How to install Google Analytics to SMF Forum

What is Google Analytics ?

Google Analytics is a webmaster tool for tracking your traffic and give you a lot of your website’s information. For more information, please go to https://www.google.com/analytics/. The other convenience thing is you can share your Google Analytic  between google accounts. So you and your friends can both monitor your website.
[smartads]

SMF Forum

SMF Forum is a open source source for creating forum from Simple Machine http://www.simplemachines.org/

The theme source is very complicated so it is difficult to know how to modify and add the Google Analytic code in your theme. So now I will help you how to add to your SMF forum:

Step 1

Get the Google analytic code. I use the new tracking code. It should look like that:

<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”>
try {
var pageTracker = _gat._getTracker(“UA-4022109-7”);
pageTracker._trackPageview();
} catch(err) {}</script>

or like the Legacy Tracking Code (urchin.js):

<script src=”http://www.google-analytics.com/urchin.js” type=”text/javascript”>
</script>
<script type=”text/javascript”>
try {
_uacct = “UA-4022109-7”;
urchinTracker();
} catch(err) {}</script>

Step 2

Download Global Headers and Footers mod or easily add code in the code in the header or footer of the theme. It can be done by going to Package section under the Main tab in your admin panel.

hb_001

Simple way is to fulfill the URL and name of that package into Download a package by url section and click Download button, and Apply that mod.

Step 3: Add the code

Finally, you will be able to see Global Headers and Footers in the Configuration tab. Now you just paste your tracking code in the footer section:

hb_002

Step 4:Confirm the Google Analytic

You have to confirm google to make sure that everything is going OK by clicking in Edit and Check status button and click check status.

DONE !

{ 4 comments… add one }
  • Bymnmessine December 18, 2009, 3:56 am

    Your welcome everyone,
    My PC worked slowly, many errors. Please, help me to fix errors on my computer.
    My operation system is Windows7.
    With best regards,
    Bymnmessine

    Reply
  • ju4ns3 November 3, 2010, 11:59 pm

    Hey Thanks!! the mod is great

    Reply
  • Alin March 23, 2012, 1:06 am

    thanks, you saved me

    Reply

Leave a Comment