How to add Google analytics on SMF forum ?

How to add Google analytics on SMF forum ?

google  analytics smfSMF (Simple Machine Forum) the simple yet discussion open source forum software. I have been using this software in one of my website from one year. I love SMF because of its simplicity and fast loading. Recently, I have added Google analytics in my SMF to track the visitors. The file structure of  SMF is easy to understand and is easy to put the analytics code as well.

If you are using SMF and confused on how to add Google Analytics tracking then this post will help you overcome your confusion. First of all navigate to the your theme folder, there you will see a file “index.template.php,” it is the core file that controls the theme. Open this file with your favorite text editor, for example, Notepad++. Then find in this file andpaste your trackingcode just before like this,

 echo ‘

<script type="text/javascript">

  var _gaq = _gaq || [];
  _gaq.push(['_setAccount', 'UA-xxxxxxx']);

  (function() {
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '';
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);



The code above is for demonstration purpose only, you need to keep your own Google Analytics code. You can now confirm the code from page source and webmaster tool.

If you don’t want to mess up editing files then you can install SMF mod named Google Analytics code from here.


Bikram Kawan

Hello Readers,This is Bikram Kawan from Nepal. You can follow me onG+ Facebook Twitter Connect with me on Google+

Leave a Reply

Notify of