SocialTwist Tell-a-Friend
facebooklinked_intwitter

Translate

English Afrikaans Albanian Arabic Chinese (Simplified) Czech Danish French German Italian Japanese Portuguese Russian Spanish
TimKrause.info Main Feed

 
PDF

Create a custom Google Analytics module for Joomla

User Rating: / 1
PoorBest 
Joomla FAQs - Components

Overview

You'll notice a ton of Google Analytics modules on Joomla.org. The advantage to using a module is that you're able to keep the code that Google requires to track visitors outside of your template. This is important in the event that you later decide to change templates.

There are some great modules out there, but this is a great opportunity how to create your own module. In addition, many of the current modules use Google's legacy approach to tracking. If you create a custom module, you'll have the opportunity to take advantage of asynchronous tracking which:

  • Optimizes how the browser loads related js files so that pages load more efficiently;
  • Allows you to place your tracking code higher in the page so that it's more likely to load;

There's more information about asynchronous tracking here.

How To

  1. Navigate to the Modules section in the administrative control panel of your site;
  2. Select New to create a new module;
  3. Choose a module of type: HTML snippet;
  4. In your editor, switch to HTML/Code view;
  5. From the asynchronous tracking page, copy and paste the snippet into HTML/Code view;
  6. Updade the tracking code to match the tracking code for your site (line 11; see below for an example of what your work should look like.
  7. Position your module as high on the page as you can (e.g. banner1);
  8. Turn of display title and set publish to yes;
  9. Preview your site to make sure that title is turned off;
  10. View source to verify that your code snippets are appearing as expected;
  11. Wait one day, and confirm results with Google analytics.
google
Sample Google Analytics code

blog comments powered by Disqus
Last Updated on Tuesday, 29 December 2009 10:33
 
 
 
 
Joomla 1.5 Templates by Joomlashack