iFinity Blogs 

Updated Google Analytics Provider for DotNetNuke

Jun 29

Written by:
Tuesday, June 29, 2010 10:27 AM  RssIcon

My last update of the iFinity Google Analytics provider was back in December 2007 – and a lot has changed since then.  Probably the biggest change is the inclusion of a standard Analytics provider in the DotNetNuke core.  That doesn’t seem to have dented enthusiasm for the iFinity Google Analytics provider, with nearly 6,000 downloads since it’s original release and still running at a healthy rate of about 7 downloads per day.

With my work on Multi-Language Urls for DotNetNuke with the Url Master module, I have setup the Url Master demonstration site which shows how to setup language-specific sub-domains to tidy up and optimise the Urls on a DotNetNuke site.  Here’s the sub-domains created for the site:

  • fr.url-master.com – French language version
  • nl.url-master.com – Dutch language version
  • de.url-master.com – German language version
  • es.url-master.com – Spanish language version

What has this got to do with Analytics?  Very simple, actually.  With a range of subdomains in the one DotNetNuke portal, the trusty old 1.01 version of the iFinity Google Analytics provider was no longer performing as needed, because it regards the subdomains as separate domains, and will not track the traffic as a ‘whole’.  For some people, this will be the option they prefer, however, for me, I wished to view the data for the entire site, and to have all the sub-domain traffic merged into one set of reports.

Tracking across Sub-domains

Google Analytics covers this scenario (wishing to track all sub-domains in one profile), all I had to do was to include the ‘trackDomain’ call into the Analytics script.  This was pretty easy to add : a new option called ‘Track Domain’ which feeds through to the generated script.

But once I had the project open and was building a new release, I decided to go through and bring the entire module up to date, and work through the long list of requests that had come in since the last release.

Asynchronous Tracking

One of the big changes in Google Analytics has been the introduction of Asynchronous Tracking.  Without drilling down to the depths of explanation, in the ‘old’ [ga.js] tracking script, the Page View was recorded once all the page had loaded, and the Analytics script had run.

Asynchronous in this respect is a bit similar to the ‘A’ in AJAX (which is Asynchronous Javascript and XML) – the script loads, and then records a page view asynchronously, which basically means it does it without slowing down all the other script on your page.

Google have made it pretty clear this is the direction they are headed with Analytics, so, with the new version of the iFinity Google Analytics module, you have the option of ticking a box and choosing Asynchronous tracking, which will generate the correct script for you behind the scenes.  You don’t have to do anything else other than checking the box.

Removing Deprecated Code

Google is continually upgrading the Analytics script to keep up with it’s customers requirements.  To this end, they sometimes deprecate (remove support for) some of the functions, and replace them with newer, better versions. The new version of the Analytics module has removed all of the old deprecated functions and replaced them with new versions.

Automatic Container Hiding

One of the lessons I learnt while building the Canonical Linker module was how to hide a module container unless an administrator needed to see it.  This technique has now been applied to the iFinity Google Analytics module, so you no longer have to go into the module settings and check the ‘hide container’ option.  The module detects when the site is in ‘edit’ mode, and will show itself on the page, so that settings can be modified.  When in ‘view’ mode, the module does not appear on the page. 

Note : the placement of the module in the skin does not affect where the script is inserted.  The script is inserted into the output DNN page in the correct location independently of where in the page skin the module is loaded.  This was a common misconception with the previous version – you don’t need to move the module to the bottom of the page in order to get the script further down.

No more CSS files

One of the faults of the prior version was that it had a module.css file – the DNN framework automatically detects this file and sends it to the browser, even if it is not needed.  The module.css file just contained a few classes to define how the module settings should be displayed and was not required.  Yet, every page that had the Google Analytics module installed ended up sending a /desktopmodules/ifinity.googleanalytics/module.css file down to the browser, taking up precious connections, downloads and speed.  This often shows up in YSlow reports, and it’s something that has been requested a few times.

With the new version, the module.css file is no longer used, and using the module will not create a reference to this file. 

Note : If you are on DNN 4.x and upgrade to the Google Analytics 2.0 module, you will have to manually delete the module.css file after upgrading.  This is because of the lack of support for a cleanup routine.  If you are on DotNetNuke 5.x, the old module.css file should be deleted for you once the module is upgraded.  If you have upgraded to the new version of the module, and you are still seeing the Analytics module.css file being downloaded for your site, just go in and delete the module.css file.  It will do no harm at all.

Same Great Features

While this new functionality was being added, all the old functionality has been kept.  This includes:

  • Ability to exclude traffic for specified user group, for example: Administrators
  • Ability to track Registered users as a custom segment
  • Ability to track external link clicks in Analytics reports
  • Exclude calls to Analytics when running in development/test environments.  This helps when you wish to view how the script behaves without actually calling the Google servers

And, despite the temptation to convert thousands of downloads into dollars, it remains the same great price : free!

Download your copy from the iFinity Google Analytics Product page

If you have any comments, please leave in the comments field below.  For product support and questions, please use the iFinity Google Analytics product support forum.

Tags:
Categories:
Location: Blogs Parent Separator Crafty Code

3 comment(s) so far...


Gravatar

Re: Updated Google Analytics Provider for DotNetNuke

Excellent, thanks! Time to upgrade.

By Adam Paxton on   Tuesday, June 29, 2010 9:29 PM
Gravatar

Re: Updated Google Analytics Provider for DotNetNuke

Hi ,

I have 3 sites test.com test1.com test3.com . test2 and test3 is under test.com/test2,3

how I can track this domains separately

Warm Regards,
Anish

By Anish on   Saturday, March 17, 2012 12:04 AM
Gravatar

Re: Updated Google Analytics Provider for DotNetNuke

@anish you can only track domains at a top level, you can't track different child paths separetly (though you can set up segments to filter out for those child paths).

There's no trick to trackign separate domains - just install the module, configure the UA values, and then configure your Analytics settings to track the various domains. There are many Analytics articles on how to track the different domains, but the changes are all at the Analytics configuration.

By Bruce Chapman on   Sunday, March 18, 2012 8:46 AM

Your name:
Gravatar Preview
Your email:
(Optional) Email used only to show Gravatar.
Your website:
Title:
Comment:
Add Comment   Cancel 
Bruce Chapman
Hi, I'm Bruce Chapman, and this is my blog. You'll find lots of information here - my thoughts about business and the internet, technical information, things I'm working on and the odd strange post or two.

 

Share this
Get more!
Subscribe to the Mailing List
Email Address:
First Name:
Last Name:
You will be sent a confirmation upon subscription

 

Follow me on Twitter
Stack Exchange
profile for Bruce Chapman at Stack Overflow, Q&A for professional and enthusiast programmers
Klout Profile