iFinity Blogs 

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.

Tags:

41 comment(s) 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

Re: A DotNetNuke module for Google Analytics Integration

Er - it seems that the zip you're currently linking to contains no dlls? It installs cleanly in my portal but gives me the ubiquitous "Could not load type" error. I could always just compile it myself obviously but thought you should be aware.


Thanks!
K

By Ken on   Wednesday, August 27, 2008 1:04 AM

Re: A DotNetNuke module for Google Analytics Integration

Hmm nevermind - seems to install fine as-is in my development portal but not production. There must be something funky going on.


Thanks,
K

By Ken on   Wednesday, August 27, 2008 1:55 AM

Re: A DotNetNuke module for Google Analytics Integration

@Ken

There are no DLLs in the file, that is correct. The module runs on code-behind asp.net controls, and is compiled in the site the first time you run it.
-Bruce

By bchapman on   Wednesday, August 27, 2008 8:39 AM

Re: A DotNetNuke module for Google Analytics Integration

Gotchya. Well the issue persists. I tried giving the worker process account full control over the files in the iFinity.GoogleAnalytics directory to no avail. I'm at a loss :)

By Ken on   Wednesday, August 27, 2008 10:47 PM

Re: A DotNetNuke module for Google Analytics Integration

Ken - please open up a thread at http://www.ifinity.com.au/Products/Support_Forums/forumid/4/scope/threads/ and post the full error details you're getting, and I'll help you work it out if I can.
-Bruce

By bchapman on   Wednesday, August 27, 2008 11:10 PM

Re: A DotNetNuke module for Google Analytics Integration

Thanks for the great module. I was looking for a way to prevent my site edits from polluting my Analytic's info and this does the trick. Fast, simple and easy.

By Mark on   Sunday, January 04, 2009 2:56 PM

Re: A DotNetNuke module for Google Analytics Integration

Does it track by Page Name, Page Title or URL?

By steve on   Friday, March 27, 2009 4:45 AM

Re: A DotNetNuke module for Google Analytics Integration

@steve : this module just inserts the Google Analytics tracking code. Analytics does the tracking for you. And yes, it can track by page title or page url (not page name, that's just a DNN concept).

By Bruce on   Friday, March 27, 2009 9:17 AM

Re: A DotNetNuke module for Google Analytics Integration

Hi, I'm trying to install the module on our site and unfortunately got this error message:

Unhandled error loading module.
DotNetNuke.Services.Exceptions.ModuleLoadException: Unhandled Error Adding Module to ContentPane ---> DotNetNuke.Services.Exceptions.ModuleLoadException: Error: Scripter is currently unavailable. ---> System.Web.HttpParseException: Parser Error: Could not load type 'iFinity.DNN.Modules.GoogleAnalytics.Scripter'. ---> System.Web.HttpException: Could not load type 'iFinity.DNN.Modules.GoogleAnalytics.Scripter'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase) at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective) at System.Web.UI.TemplateControlParser.ProcessMainDirective(IDictionary mainDirective) at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text) at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) at System.Web.UI.TemplateParser.ParseFile(String filename, String virtualPath) at System.Web.UI.TemplateParser.Parse() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace --- at DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(String FriendlyMessage, PortalModuleBase ctrlModule, Exception exc, Boolean DisplayErrorMessage) at DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(PortalModuleBase ctrlModule, Exception exc) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---

Our site is DNN v 3.3.7 and .NETv1.1. Any help you can provide is appreciated!

By Steve on   Friday, April 03, 2009 2:46 AM

Re: A DotNetNuke module for Google Analytics Integration

Hi, I'm trying to install the module on our site and unfortunately got this error message:

Unhandled error loading module.
DotNetNuke.Services.Exceptions.ModuleLoadException: Unhandled Error Adding Module to ContentPane ---> DotNetNuke.Services.Exceptions.ModuleLoadException: Error: Scripter is currently unavailable. ---> System.Web.HttpParseException: Parser Error: Could not load type 'iFinity.DNN.Modules.GoogleAnalytics.Scripter'. ---> System.Web.HttpException: Could not load type 'iFinity.DNN.Modules.GoogleAnalytics.Scripter'. at System.Web.UI.TemplateParser.GetType(String typeName, Boolean ignoreCase) at System.Web.UI.TemplateParser.ProcessMainDirective(IDictionary mainDirective) at System.Web.UI.TemplateControlParser.ProcessMainDirective(IDictionary mainDirective) at System.Web.UI.TemplateParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateControlParser.ProcessDirective(String directiveName, IDictionary directive) at System.Web.UI.TemplateParser.ParseStringInternal(String text) at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) --- End of inner exception stack trace --- at System.Web.UI.TemplateParser.ParseString(String text, String virtualPath, String basePhysicalDir) at System.Web.UI.TemplateParser.ParseFile(String filename, String virtualPath) at System.Web.UI.TemplateParser.Parse() at System.Web.UI.TemplateParser.GetParserCacheItemThroughCompilation() at System.Web.UI.TemplateParser.GetParserCacheItemInternal(Boolean fCreateIfNotFound) at System.Web.UI.TemplateParser.GetParserCacheItemWithNewConfigPath() at System.Web.UI.TemplateParser.GetParserCacheItem() at System.Web.UI.TemplateControlParser.CompileAndGetParserCacheItem(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControlParser.GetCompiledType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.UserControlParser.GetCompiledUserControlType(String virtualPath, String inputFile, HttpContext context) at System.Web.UI.TemplateControl.LoadControl(String virtualPath) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace --- at DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(String FriendlyMessage, PortalModuleBase ctrlModule, Exception exc, Boolean DisplayErrorMessage) at DotNetNuke.Services.Exceptions.Exceptions.ProcessModuleLoadException(PortalModuleBase ctrlModule, Exception exc) at DotNetNuke.UI.Skins.Skin.InjectModule(Control objPane, ModuleInfo objModule, PortalSettings PortalSettings) --- End of inner exception stack trace ---

Our site is DNN v 3.3.7 and .NETv1.1. Any help you can provide is appreciated!

By Steve on   Friday, April 03, 2009 5:54 AM

Re: A DotNetNuke module for Google Analytics Integration

@steve it's not supported for .net 1.1 : there are specific .net 2.0 concepts in the code. You could try backwards porting the source but it's not going to work out of the box.

By Bruce Chapman on   Friday, April 03, 2009 8:28 AM

Re: A DotNetNuke module for Google Analytics Integration

Hello!

I installed the module and it seemed to go smoothly, however when i look at my home page source i do not see any code concerning my UA number. When i log into the website DNN CMS i can see the module and all the settings look correct. In my google analytics account it's showing tracking not installed. Any advice?

Thank you,

-Allan

By Allan on   Wednesday, April 08, 2009 5:16 AM

Re: A DotNetNuke module for Google Analytics Integration

Hello!

I installed the module and it seemed to go smoothly, however when i look at my home page source i do not see any code concerning my UA number. When i log into the website DNN CMS i can see the module and all the settings look correct. In my google analytics account it's showing tracking not installed. Any advice?

Thank you,

-Allan

By Allan on   Wednesday, April 08, 2009 5:37 AM

Re: A DotNetNuke module for Google Analytics Integration

@allan if you've followed the instructions and placed the module on every page, then it should be working OK. Just check that you have 'all users' for the view permission of the module, and that you're signed out (by default it blocks administrators and hosts) when you're looking at the code.

By Bruce Chapman on   Wednesday, April 08, 2009 8:23 AM

Re: A DotNetNuke module for Google Analytics Integration

hi Bruce,

i want to display google analytics report on my website....i checked on google but didnt find out anything.

i have google script which i put on default.aspx page. i m using ddn 4.0.

if i installed this module can i have see the report on my web site or still i have use google analytics?

or any suggestions to view report on my website?

waitng for your reply...

thanks

By prit16 on   Friday, July 03, 2009 8:53 PM

Re: A DotNetNuke module for Google Analytics Integration

@prit16 : no, this module just feeds the data back to Google Analytics. The only way to show analytics in your site is to put in an iframe.

By Bruce Chapman on   Friday, July 03, 2009 9:50 PM

Re: A DotNetNuke module for Google Analytics Integration

Does this module work on 4.8 or 4.9? Thanks.

By armando on   Sunday, August 23, 2009 3:37 AM

Re: A DotNetNuke module for Google Analytics Integration

does this work on 4.8 or 4.9

By armando on   Sunday, August 23, 2009 3:37 AM

Re: A DotNetNuke module for Google Analytics Integration

Sorry, forgot to be more specific. I run a lynchburg web design company www.vision2life.com and have dnn 4.9.1 running and another one running on 4.8.2. Does your module work on these versions? Thanks.

By armando on   Sunday, August 23, 2009 3:40 AM

Re: A DotNetNuke module for Google Analytics Integration

@armando : works on 4.8 and 4.9

By Bruce Chapman on   Sunday, August 23, 2009 5:19 PM

Re: A DotNetNuke module for Google Analytics Integration

This module work with DNN 5.1.2?

Thanks

By Jaime And'res Giarldo on   Friday, September 11, 2009 7:25 AM

Re: A DotNetNuke module for Google Analytics Integration

This module work with DNN 5.1.4?

By Rui on   Tuesday, October 13, 2009 1:14 AM

Re: A DotNetNuke module for Google Analytics Integration

@yes, the module will work with 5.1.2 and 5.1.4

By Bruce Chapman on   Tuesday, October 13, 2009 8:07 AM

Re: A DotNetNuke module for Google Analytics Integration

I'm using Hubspot for our analytics, much the same as Google - simply trying to install the code on all pages via text/html module at the bottom. It is not registering/verifying with Hubspot and I receive this error message - do we need to create a new skin to install this on all pages? I was hoping that this workaround would suffice.
Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Trident/4.0; GTB6; SLCC1; .NET CLR 2.0.50727; Media Center PC 5.0; .NET CLR 3.5.21022; .NET CLR 1.1.4322; .NET CLR 3.5.30729; .NET CLR 3.0.30618; MS-RTC LM 8; MS-RTC EA 2; msn OptimizedIE8;ENUS)
Timestamp: Tue, 17 Nov 2009 14:47:28 UTC


Message: 'ScrollTop' is null or not an object
Line: 46
Char: 3
Code: 0
URI: www.davidkennethgroup.com/js/dnncore.js

By KRueber on   Wednesday, November 18, 2009 2:28 AM

Re: A DotNetNuke module for Google Analytics Integration

@krueber : I'm not familiar with hubspot but the error you provide looks like a generic javascript error caused by an incorrect reference somewhere, probably where you included your code. I would suggest that you either check your javascript inclusion, or use a script injector module (there are several available) to insert the script into your page, instead of trying to code it into the text/html module. The google analytics module won't help you, because it only emits the google code.

By KRueber on   Wednesday, November 18, 2009 10:55 AM

Re: A DotNetNuke module for Google Analytics Integration

Worked perfectly for a DNN site I built for a local physician. Thanks for the great tool.

By Dene Brock on   Wednesday, December 23, 2009 1:54 PM

Re: A DotNetNuke module for Google Analytics Integration

I tried to get this going but still was getting problems. All I really wanted to display was a simple line graph of my last months visitors by day. I found this separate solution which has suited me well: embeddedanalytics.com

By Randy Benedict on   Wednesday, February 10, 2010 10:50 PM

Your name:
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.