Installing Google Analytics in DotNetNuke is a fairly common request from many individuals and I know it can be a quite troubling question for most. The primary questions are how and where can I put the javascript code provided by Google. Well you have a few options. First you could put the code directly in the skin for the site, the advantages to that would be that you will automatically have the code on all pages, however, the disadvantage is that you cannot use that skin as is on another portal due to the site specific Google information. I personally go the route of adding a text/html module to my site and set it to show on every page and insert the script in a very specific location which I will discuss below. There are a few drawbacks to this method. First you will not get any statistics information on traffic to "edit pages" where other modules are not displayed and you also will not receive information regarding administration modules. However, in most circumstances this shouldn't be an issue.
The best way to include this information is to include the information in the Module header of the text/html module. This is to prevent the accidental removal of the script code if you happen to click inside the module as an admin to enter in-line edit mode. Below I will walk you through the steps needed to implement Google Analytics using this method. (NOTE: you can extend this for other javascript integrations if needed).
This should complete the setup. You may now test to ensure everything is functioning correctly. You can log out as an administrator and view your site and no extra content should be displayed however if you look at the generated source you should see your javacript listed. Google Analytics should update within about 15 minutes to show that they are receiving your data.
Nice tutorial, i'm using this method for my subportals, also you can use this method to have tracking scripts like ExtremeTracking (example can be seen at my site)
For some reason this method does not work for me. I have two portals running under the same DotNetNuke install and cannot get google Analytics to work on either. (Keeps stating Tracking Unknown under the analytics account for both domains) Any Thoughts?
Joe,Yes I have a few ideas. First of all has google indexed your site yet? Secondly, have you given it at least 3 hours? It does take them time to get it the first time.
Well.. I've seen another tutorial on integrating DNN & Analytics. I just wanted to ask.. will this work ? I mean when I load up his website... his website is connecting to the analytics server.. so I assume it does. But I think you are a better person to comment on this.Thanks
I assume you were trying to link to something, shoot me an e-mail at mitchel.sellers@gmail.com and I'll look into it for you!
I've used this to put Google Analytics into a DNN site. Sometimes, I notice that the pages laod slower. They pause and wait for Google, sometimes Google doesn't respond as quickly...Is there some way to add the Analytics to the page but not have the page wait for it?
Ari,Not as far as I know. The browser must wait for external JS to load and with Google it is pretty much a requirement to use their available JS externally.
OK, thanks
Mitch,In the root DNN folder(not the portal root) is default.aspx. I put my analytics code in there and it works to log everything.I thought about the fact that it will log for all portals, and figured that, for me, it's probably actually a benifit as I should be able to see traffic from any and all portals to compare to other usage logs.Do you see any reason why this is a bad idea?
Josh,The only reason that it would be a bad thing is if you wanted to entirely track the stats for the different portals in a separate Google Analytics collection.In my case, I need to track them individually....but it depends on your needs
EGI Consulting Google AnalyticsEGI Consulting Google Analytics module enables you to include the Google Analytics script necessary to communicate with Google’s servers.
ifinity.com.au has a free Google Analytics module, http://www.ifinity.com.au/Products/Google_Analytics_Script_Module, that works great. It comes with all sorts of bells and whistles that make it a great addition as opposed to using a text/html module.
Great instructions! It works like a charm, thank you very much for posting these!
IF you go with pageblaster (prof edition), this is really easy too. Plus the script is moved to the bottom of the page, before the closing body tag.
We have created a module to support Google Analytics reporting in your DNN website.See some details here: http://www.interactivewebs.com/analyticsreport
Mitchel,Quick question - in DNN 5 there is a google analytics in the drop down. Does it work?In my DNN 4 websites currently install a google analytics module on the page and put in the U code and then set to display on all pages.Does this option in the drop down menu in DNN 5 do the same thing?thanks,Crysta
Just FYI on the Google Analytics module from iFinity mentioned by Scott Allender in 2008: I tried to look at that this morning, and the entire iFinity site appears to be dead.
I install the java script code as you said in the module header of a text/html module and it doesn't work... Need help...
Thanks Mitchel,This tutorial is easy to understand and implement - which is such a rarity on the web. I really appreciate you sharing your knowledge.
I tried a number of processes to get google analytics functioning on my site but this is the only one I was able to get to work. I don't know if it's my lack of understanding/programming experience with the other processes or the fact that this was an easy and well explained way of doing it. (Or both)Thanks
HI,i have added google analytics to my dnn site. Previous so other worked on the site and added google analytics. I have added the latest code using iinfinitygoogle analyitics module. But, im getting previous code on my page. i am not getting where that code is coding from. I have checked all pages and modules and checked with httpdocs also. Please help me out.
I used this method to add google analytics to my dotnetnuke site, but it does not appear to be working.I placed the code over a week ago. It shows 3 visitors in the last week but I've had 5+ people RSVP using a link on my site...so the analytics is not catching every visitor.Anyone have any suggestions? I'm wondering if I need to place the code somewhere other than in a module on the main page?
You must have it on all pages as noted above. Otherwise, you can also use the out of the box DNN way of doing this, or adding it to your skin.
This method works for me. Just make sure you follow the instructions laid out above!
Name (required)
Email (required)
Website
Notify me of followup comments via e-mail
Content provided in this blog is provided "AS-IS" and the information should be used at your own discretion. The thoughts and opinions expressed are the personal thoughts of Mitchel Sellers and do not reflect the opinions of his employer.
Subscribe To Blog RSS Subscribe To Blog Updates by E-Mail * Add to Technorati Favorites
Click here for advertising information.
Content in this blog is copyright protected. Re-publishing on other websites is allowed as long as proper credit and backlink to the article is provided. Any other re-publishing or distribution of this content is prohibited without written permission from Mitchel Sellers.