A good question, raised by Jack Bremer, prompted the writing of this brief post in case it’s of use to somebody else at some point (including myself). The GA plugin in WordPress has this option, which is great for larger sites with loads of front-end admins all working on the site – you don’t want to be diluting your Analytics with all that noise.
So, how can the same be acheived in Joomla? Well, quite easily actually. Read on to find out how…
Modify the Template
For this to work we will need to make a simple logic change in the site’s template index.php file, which you can find in template/your_template directory of your site. First we’ll need to get the $user variable loaded into the template, so, near the top, add the following line of PHP:
$user =& JFactory::getUser();
This will load an array of variables into $user that we can use to determine who’s currently logged-on to the front-end of your website. The particular value we’re looking for is the User ID, contained in $user->gid (the current user’s Group ID) – this value is zero (false) if a guest is browsing the site, but will be a specific figure depending on which group they are assigned to when logged-on.
Add the logic code
Next step is to locate your GA tracking code, which should be right at the bottom of your index.php file, just before the







Comment by Dan Luton — March 5, 2010 @ 3:43 pm [Link]
For those looking for a solution without changing the template:
http://extensions.joomla.org/extensions/site-management/site-analytics/3356
It won’t be as lightweight as the above solution, but an alternative nontheless (via @JacquesRentzke).
Pingback by Disabling Google Analytics for front-end Administrators in Joomla … | SFWEBDESIGN.com — March 6, 2010 @ 4:22 am [Link]
[...] See more here: Disabling Google Analytics for front-end Administrators in Joomla … [...]