Need Help?
 

If you're having trouble with an iFinity Product, use the Support Forums to search for answers, and to post questions.

If you need help faster than that, or can't figure out the answer, try our Premium Support service.

 
Crafty Code  
Aug 27

Written by: Bruce Chapman
Monday, August 27, 2007 10:00 AM

I've used Google Analytics on my websites for some time. It's very full featured analytics package and is indispensible if you are also using Google Adwords. But you don't need to be using Adwords to get the best out of it - far from it. Anyone with a website and a willingness to share visit statistics with a third-party should probably get hooked up to Analytics sooner or later.

I'll assume that anyone reading this already has an Analytics account, and quite possible, a DotNetNuke website. If not, there is plenty of information on the internet about these two free technologies - but you'll need a website and analytics account to follow the example. So I'll cut straight to the chase: I've developed a DotNetNuke module which gives you quick integration of Google Analytics with DotNetNuke.

How to hook up Google Analytics to your DotNetNuke Website

Step 0: Create and/or locate your login details for your Google analytics account. If you haven't already got an account, follow the instructions on the Analytics site to create an account and website profile

Step 1: Download the Module install file from the DotNetNuke Downloads page on this site. (link opens in new window)

Step 2: Install the module by using the 'Module Install' functionality in your DotNetNuke portal. To check that the module installed correctly, it should appear in the 'module' drop down list in your Control Panel, under the name "iFinity Google Analytics".

Step 3: Go to the home page of your DotNetNuke portal, and use the 'Add New Module' functionality to add an instance of the iFinity Google Analytics module to the page. I normally use the bottom pane to keep it out of the way of other modules. Don't be worried that you can see the module in 'Edit' mode. The module will dissappear when you log out as Administrator.

Step 4: Click on the 'Settings' control for the Google Analytics module you just created. Then scroll the Settings page until you get to the 'Advanced Settings' section, and check the 'Display Module on All Pages'. This ensures that all pages on your website are tracked by Google Analytics.
See the red highlighted area:



Advanced Settings Section of DotNetNuke module

If for any reason you didn't want all pages on your site to be tracked, you can just copy the module from the home page onto the pages you want tracked. Scroll further down the page, expand the 'Page Settings' section until you get to the 'Basic Settings' section, and select Visibility: None, and make Display Container unchecked. This hides the Google Analytics module from visitors.
See the red highlighted area:

Basic Settings Section of DotNetNuke module

Step 5: Scroll down the page further until you reach the 'Analytics Script Generator Settings' section. Under here is the specific settings for your site. Leave this page for a minute and open up a new browser window to go to Google Analytics.

Step 6: Go to Google Analytics at http://analytics.google.com (make sure you sign in with your account) and click on 'Edit' next to the website profile you have set up. This will bring up the details of the website profile. Then find the 'check status' link on the page and click that. You should see a box containing some javascript. Instead of copying out all the javascript as directed, you only need the account number, or the 'UA' number. Copy the UA number from the Google Page into your DotNetNuke site, in the 'Google Analytics Tracking ID' field. You do not need the inverted commas around the number.

See the following example:

Analytics Settings Section of the DotNetNuke Module

Step 7: (optional) If you'd like to restrict tracking so that it doesn't show on the reports for certain visitors, you can select a DotNetNuke security group in the next drop down list. For example: you don't want the administrative editing to show up as page hits on Google Analytics. In that case, you would select 'Administrators' as the group to exclude from tracking.

Step 8: Click on Update. The page should refresh and return to the home page of your site. If you do a "view source" on your browser, and scroll to the bottom of the html, just before the body tag you should see the generated script. (NOTE : if you selected the adminstrator group, you'll have to sign out first).

Step 9: Go back to your Google Analytics account. It should still be on the page showing the tracking code to be added. Click on the 'finish' button at the bottom. When it returns to the website profile page, you should see a green tick and the words 'Receiving Data'. If you do see this, your site is providing statistics to Analytics and you are all set.

Advanced Options

The security group option is there so that any editing and other administrative activity doesn't show up on the analytics reports. However, if you wanted to separate out usage for, say, registered vs non-registered users, you can set up two profiles in Analytics and create two Analytics modules in your DotNetNuke site. You can then set one to track unregistered users by excluding registered users and vice versa. The other box on the setting page is the 'Do not generate tracking script for calls to this host'. This option allows you to interrupt calls to Google when the site is called using a specific host-name. I normally use this so that when running testing on localhost, I'm not bothering the Google server. However, instead of totally hiding the code, all that happens is that the urchinTracker() javascript call is commented out, so you can still check that it is working.

So how does it work?

If you want to know the technical details, the source code is included with the module. But for a high level intro, all that happens in the module is the collection of the module settings (UA-id, security groups and host name). The code determines if tracking should be done for the incomign request and checked against those variables. If the answer is yes, some javascript is inserted using the 'RegisterClientScript' ASP.NET call. And that's it.

Update

This product has been updated since this blog entry was written. See the Google Analytics Module for DotNetNuke page for details.

Support

Please use the Google Analytics Module Support Forums to request support and assistance.

Copyright Bruce Chapman 2007

Tags:

14 comments so far...

Re: A DotNetNuke module for Google Analytics Integration

Thanks for putting this one out. Very nice.

By Rob on   Monday, September 10, 2007 9:12 PM

Re: A DotNetNuke module for Google Analytics Integration

Excellent job! Been looking out for something like that. Thanks for sharing it!

By Sven on   Friday, September 14, 2007 7:29 PM

Re: A DotNetNuke module for Google Analytics Integration

Does this work with the NEW GA.js code from Google?? Or is this for the old urchin.js code??

Thank you, Tom

By Tom (1) on   Saturday, January 19, 2008 4:56 AM

Re: A DotNetNuke module for Google Analytics Integration

@Tom

Yes, the latest release in the Free Downloads section uses the new Ga.js code. If you do a 'view soruce' on this page you'll see the code at the bottom. The latest release also has some new features for setting timeouts and tracking external links from the website.

-Bruce

By Bruce on   Saturday, January 19, 2008 8:49 AM

Re: A DotNetNuke module for Google Analytics Integration

How long does it usually take for Google to detect the tracking code?

By JM on   Tuesday, February 12, 2008 10:00 AM

Re: A DotNetNuke module for Google Analytics Integration

@jm
Google should detect the tracking code immediately if it has been installed properly - you should be able to see this in your Google Analytics settings. BUT it might take a day or two for the information to start coming through - that depends on traffic to your site and Google Analytics itself.If you aren't seeing the tracking code in your GA account, then do a view source of your website and see if the tracking code is there, and that the UA number is correct.

By bchapman on   Tuesday, February 12, 2008 10:02 AM

Can't install

Mine started off okay with the installation, then I get this error:

Failure Did not find any .dnn file ???
Failure ExceptionSystem.Exception: File load failed, aborting at DotNetNuke.Modules.Admin.ResourceInstaller.PaInstaller.ReadZipStream() at DotNetNuke.Modules.Admin.ResourceInstaller.PaInstaller.Install()

Not sure what to do now! I'm using DNN 4.08.02 so maybe it's not compatible with that yet?

By Emily on   Tuesday, April 29, 2008 6:39 AM

Re: A DotNetNuke module for Google Analytics Integration

Thank you for making your product available.

I installed it about a year ago and we were getting reports just fine, but recently we noticed that only one of our pages on our DNN site is providing hit counts. (The module is set to work on all pages and is visible to an Admin.) When I check "View Source" I don't see the javascript at the bottom of the source.

What should I do?

By dwjones on   Thursday, May 01, 2008 12:18 PM

Re: A DotNetNuke module for Google Analytics Integration

@dwjones

You first need to check that it actually appears on pages when not logged in as admin. Check the permissions, that the module appears on all pages, etc. It's likely to be a change in permissions or module settings that has caused it to stop working.

If you can't figure it out, open up a thread on the support forums and I'll help you work through it.

By Bruce on   Thursday, May 01, 2008 11:23 PM

Re: A DotNetNuke module for Google Analytics Integration

@emily

I haven't tested it yet with 4.8.2 - I'll take a look and see if there are any problems. Keep an eye on the SUpport Forums threads for the Analytics module to see when I do the next release.

By Bruce on   Thursday, May 01, 2008 11:24 PM

Re: A DotNetNuke module for Google Analytics Integration

Is this compatible with DNN Version 4.8.0 ?

By PG on   Wednesday, June 18, 2008 8:23 AM

Re: A DotNetNuke module for Google Analytics Integration

@PG - yes it is. This site runs on 4.8.x and has the Google Analytics module in it. It's a very simple module so there aren't a lot of problems to come across.

-Bruce

By Bruce on   Wednesday, June 18, 2008 9:44 AM

Re: A DotNetNuke module for Google Analytics Integration

Guys i am getting a strange error when i am trying to install this module can any one help me out. I am using DNN4.8.4 with SQL 2005. Hosting and domain from godaddy. I am getting the following error

ExceptionSystem.UnauthorizedAccessException: Access to the path '....\DesktopModules\iFinity.GoogleAnalytics' is denied. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.Directory.InternalCreateDirectory(String fullPath, String path, DirectorySecurity dirSecurity) at System.IO.Directory.CreateDirectory(String path, DirectorySecurity directorySecurity) at DotNetNuke.Modules.Admin.ResourceInstaller.PaDnnInstallerBase.CreateModuleFile(PaFile File, PaFolder Folder) at DotNetNuke.Modules.Admin.ResourceInstaller.PaDnnInstallerBase.CreateFiles(PaFolder Folder) at DotNetNuke.Modules.Admin.ResourceInstaller.PaDnnInstallerBase.Install(PaFolderCollection folders) at DotNetNuke.Modules.Admin.ResourceInstaller.PaInstaller.Install()

By Mujahed Khan on   Tuesday, August 19, 2008 10:33 PM

Re: A DotNetNuke module for Google Analytics Integration

@mujahed

The worker process for asp.net is going to need write access to the \desktopmodules\iFinity.GoogleAnalytics\ directory. Either change the settings in your host setup or get your hosting company to do it for you.

Please log any future support issues in the provided support forums.
-Bruce

By Bruce on   Wednesday, August 20, 2008 8:42 AM

Your name:
Title:
Comment:
Security Code
Enter the code shown above in the box below
Add Comment    Cancel  
   
Page Tags