I needed a Google Analytics plugin for Joomla!1.5 that would use the latest asynchronous code, play well with other plugins, and give me the ability to track the behavior of individuals who are logged into the site. Instead of trying to up my last FCGA plugin, I’ve decided to completely rewrite the FreshClicks’ Google Analytics plugin from scratch.
FreshClicks’ Google Analytics plugin features:
- New Asynchronous tracking code: Enhances the speed in which the tracking code is loaded. With this version of the tracking code, you can also place the Analytics snippet higher in the page without delaying subsequent content from rendering.
- New GATC code placement: Your GATC code will appear in the new preferred location in the <head> of the document rather than near the closing </body> tag.
- Track registered individuals: This optional feature gives you the ability to easily see the individual behavior of all of your registered users in Google Analytics using their new Custom Variables function.
- Native Joomla! 1.5 code: the plugin was written in Joomla’s new, more object-orientated format and should play very nicely with other Joomla plugins.
Why track registered individuals?
There are lots of situations where tracking individual behavior on your website could be beneficial. If, for example you run a training website, and you expect your students to read a particular page, or spend 20 minutes a day on the site, you can easily see which of your students are participating.
How the tracking works
If you have activated the “Track registered users” option in the plugin’s administrator interface, and the plugin detects that a registered user is logged in, it will set a custom Variable in Google analytics. Initially I was going to create a user defined value, but Google Analytics recently depreciated their _setVar() function in favor of the more powerful Custom Variables, _setCustomVar() function. This new function gives you much more flexibility than the basic user defined options available in _setVar().
In FreshClicks’ Google Analytics 2.0 I set the Custom Variable as follows:
- Index: 1 – This is the slot in the custom variable report where the data will be stored. Currently they give you 1-5 slots. If you are already using slot 1, you may need to modify this plugin.
- Name: RegisteredUsers – This is a string that identifies the custom variable and appears in the top-level Custom Variables report of the Analytics reports.
- Value: {UserName} – This variable loads in the users name and it is paired with the name, “RegisteredUsers”
- opt_scope: 1 – This custom variable is set at the visitor level and is associated with a visitor.
Viewing your registered Users in Google Analytics:
You can see the behavior of your users by logging into your Google Analytics report and going to Visitors>Custom Variables
From there you will see the column “Custom Variable” with the value “RegisteredUsers”. Clicking on the “RegisteredUsers” link will bring up the report on individual users. You can drill down further and discover all kinds of interesting bits of information about your users.
Free to use and distribute
You are free to use and distribute this application as you wish. I just ask that you leave the attributions in place.
Also, it would be great to hear what you think of the Plugin, how your organization is making use of it, and suggestions for future iterations.
Download:
- Joomla 1.5 plg_FCGanalytics2.0.zip
- Joomla 1.6 plg_FCGanalytics2.2.zip – Special thanks to Osiloke Emoekpere for providing the modification to make it J!1.6 compliant.