• Welcome to Simple Machines Community Forum. Please login or sign up.

Google Analytics Code

Started by SMF Customization Team, October 15, 2009, 12:10:12 PM

Previous topic - Next topic

SMF Customization Team

October 15, 2009, 12:10:12 PM Last Edit: May 24, 2015, 05:45:41 AM by margarett
Link to Mod

Google Analytics

Original idea and original developer: Arantor, live627.
Link To Mod | Mod Discussion | Other SMF Customization Team Mods[/center]

SMF 2.0.x

This mod allows a user to specify their Google Analytics code, e.g. UA-00000000-0, in the admin panel and the appropriate loader code will be added automatically.

It should work on any theme (no theme edits).

Installation Information
The Package Manager should work in most cases, if you have problems installing please use the discussion topic as well as the Manual Installation of Mods wiki page.

Change Log
1.5.1 - 07 April 2015
! Remove unnecessary files.
! Change license to SMF's BSD license.
+ Add English-utf8 language file.

1.5 - 17 May 2014
- Drop support for all 2.0 RC versions
- Drop support for 1.1.x
- Drop all file edits
! Adding the ISC license
! Changed analytic javascript code from ga.js to analytics.js (see https://developers.google.com/analytics/devguides/collection/upgrade/reference/gajs-analyticsjs)

1.4 - 4 March 2011
! Fixed error with mod breaking XML responses

1.3 - 10 February 2011
! 2.0 RC4+ no longer requires any theme edits
+ Updated language support
! Changed analytic javascript code to latest Google recommendations

1.2 - 19 January 2011
+ Added support for 2.0 RC4

1.1 - 22 October 2009
+ Added support for 2.0 RC2

1.0 - October 14, 2009
  Initial release

Copyright (c) 2015, Simple Machines, under BSD 3-Clause License.
All rights reserved.


Works like a charm!  THANK YOU!


Good to know this worked for you. I'd like to add that this is part of a trend; more mods will be released by SMF Customization Team in due course :)
No good deed goes unpunished
All helpful urges should be circumvented

صلاح الدين

Thank you this is the arabic translated

$txt['googleAnalyticsCode'] = 'كود تحليلات قوقل<br /><span class="smalltext">E.g. UA-00000000-0</span>';
$helptxt['googleAnalyticsCode'] = 'هنا تضيف كود تحليلات قوقل الخاص بك, e.g. UA-00000000-0 بالتحديد كما قدمته قوقل لك, بعدها ستضاف تحليلا قوقل الى المنتدى من اجلك.';


Never used the Google Analytics Code before.   When signing up, it gives you a code to put on your forum.  Do I still need to do this? 

Or, do I simply take out the UA string and put it in the textbox here once I install this mod?

Or, do I do both?  (If I have to do something else other than this mod, where do I paste the code that google gave me?)

Sorry, like I said.  N00b here regarding this.

-img removed-


As part of the code Google Analytics gives you, there is a small reference code unique to you, in the form of UA-00000000-1. You simply add that into the box provided in the admin panel.
No good deed goes unpunished
All helpful urges should be circumvented


For those that already have Analytics with the
script hard-coded in index.template.php, do we have to remove it entirely from the code to use this Mod?


All this mod does is add the code you already have in index.template.php.
No good deed goes unpunished
All helpful urges should be circumvented


Excellent mod! Must try it out!

Mac dual G5, OSX 10.4.11 - SMF 2.0 RC2


Quote from: Saladine on October 16, 2009, 01:56:45 PM
Thank you this is the arabic translated

Thanks - would the "E.g." part not be translated to Arabic?
No good deed goes unpunished
All helpful urges should be circumvented


Is the Google Analytics code not functional for the admin or is functional to all users?
SMF, other software developing and some other stuff on my website, you can also hire someone at myFreelancing website . xD


The admin is the one who sets the GA code, but it appears in the page for every user.

It doesn't add anything visible to the page, but adds the GA tracker so that when you go to the Google Analytics homepage you can view your forum's stats.
No good deed goes unpunished
All helpful urges should be circumvented


Thank you this is the turkish translated

$txt['googleAnalyticsCode'] = 'Google Analytics Kodu<br /><span class="smalltext">E.g. UA-00000000-0</span>';

$helptxt['googleAnalyticsCode'] = 'Buraya Google Analytics için yayıncı kodunu ekleyin, e.g. UA-00000000-0 tam olarak Google, daha sonra Google Analytics foruma sizin için eklenmelidir';


fantastic mod.  I was taking the easy way out, and putting the google analytics script in the global footer, but it has always acted a bit odd.  I took it as karmic backwash for being lazy.  ;)  I installed the mod and pulled the script out of the footer last night, and my numbers in google analytics today are tracking like I would expect.

thanks for the great mod.


Hi, I've just created a new Google Analytics account, entered the given code, but on the google analytics page it says: Tracking not installed ... Anyone knows, what the problem could be ?



Can I see a link to your forum please?
No good deed goes unpunished
All helpful urges should be circumvented


I found out what the problem was eventually. The GoogleA code had been put just into the default theme, not the core theme, which I was using during installation. So I'll probably just add the code manually.


If you're using 2.0, you can uninstall it, and reinstall it to the default plus other themes using the bottom section in the package manager when it displaying the test results.
No good deed goes unpunished
All helpful urges should be circumvented


Sorry for the confusion, I forgot about that option to select other themes during installation, thanks for your help