How to use Google Analytics with DNN
Last Post 06/06/2010 2:32 PM by Joseph Craig. 14 Replies.
Author Messages
todd allison
Nuke Newbie
Nuke Newbie
Posts:8


--
01/16/2007 5:10 PM  

I have signed up for google analytics and it gives you a code to insert into the bottom of all your sites code.  What's the best way to do this in DNN?  I don't have much/any experience in editing the code in DNN... though I know basic HTML... just not where to edit that stuff in DNN.  Thanks for the help.

 

Todd

Lee Sykes
DNN Creative Staff
Nuke Master VI
Nuke Master VI
Posts:4945


--
01/17/2007 3:26 AM  
Hello,

If you are using the code similar to this:

<script src="http://www.google-analytics.com/urchin.js" type="text/javascript">
</script>
<script type="text/javascript">
_uacct = "UA-123456-1";
urchinTracker();
</script>

It needs to be placed before the closing body tag.

You can do this by putting the code at the end of a skin. - This means that you will only have to add the code to each skin that you use and then the code will be placed in all the pages on your website.

(the html code in a skin does not inlude the html and body tags, so all you do is paste this code at the end of the skin.)

If you are new to skinning and how it works, check out issues 5&6 where we give an introduction to skinning. - All of the following magazine issues build on the skinning knowledge explained in 5&6.

Issue no 5 & 6

Thanks,
Lee Sykes
Site Administrator
Subscribe to the website : DotNetNuke Video Tutorials : The Skinning Toolkit : DotNetNuke Podcasts

Twitter: www.twitter.com/DNNCreative

Lee Sykes's Facebook Profile
Gav
Nuke Newbie
Nuke Newbie
Posts:1


--
12/30/2008 11:31 AM  

Hi i was looking for the same tyhing and came accross this free module for adding the tracking code, i installed it and it works perfectly

http://www.ifinity.com.au/LinkClick...9&mid=1046

hope this helps

Gav

http://www.angelasbridal.net/">www.angelasbridal.net
http://www.hr-innovate.com/">www.hr-innovate.com
http://www.lanoviabridalmakeup.co.uk/">www.lanoviabridalmakeup.co.uk  

mattb
Nuke Newbie
Nuke Newbie
Posts:7


--
03/12/2009 4:06 AM  
Hi Lee,

First off all - congrats on DNNCreative - it really is the best source of DNN info for me.

Regarding Google Analytics - I've seen a few articles on the web that mention taking the "Add an invisible Text/HTML module that appears on each page and paste the GA javascript" approach. Your approach seems infinitely simpler to me - in my case just paste the code into all the skin ascx's that DNN generates (I've got 4 sites and only 2 skin pages in each one so not a big job). I was just going to paste it right at the bottom of the ascx code.

I've tried it on a local DNN install (4.9.9) and I didn't get any problems in terms of script errors (didn't think I would though as it is just a script block after all). Looking at the final markup I can see the GA script just before the tag which is where is needs to be.

My question is really are there any benefits to the "hidden module" approach as opposed to your way?

Some of the articles mention that adding directly to markup makes your skin non portable as it ties the skin to your portal - makes sense after all the id GA gives you is specific to your site but is that the only drawback (not really a drawback in my book anyway).

My clients have admin access to their DNN installs which is fine and I don't like the idea of them accidently removing this hidden module if it is on every page :-)

Cheers and once again keep up the good work,
Matt
Joseph Craig
DNN MVP
Posts:11667


--
03/12/2009 9:37 AM  
If you've done this successfully pasting into the skin files, then you should be all set.

If you have multiple portals, each portal will use the same GA account code.  That might not be what you want.  So, using the module approach lets you use a different account on each portal.

You clients can't change things, unless they have permission to upload skins. 

They could remove the module, but it's their portal, right?  If you don't want it that way, put the code in the skins.  Recent versions of DotNetNuke prevent site admins from uploading skins, so you do have that control

Joe Craig, Patapsco Research Group
Complete DNN Support
mattb
Nuke Newbie
Nuke Newbie
Posts:7


--
03/12/2009 9:43 AM  
Joe,

Thanks for the reply.

I went for the adding to skin approach as I didn't want them removing any "hidden modules" by accident within DNN. As you say they haven't got access to the hosting account so they won't be able to edit the skin files direct. There are 4 seperate sites across 4 DNN instances (not 4 portals on 1 DNN instance) each with their own GA account code so this method makes the most sense.

Cheers,
Matt
Joseph Craig
DNN MVP
Posts:11667


--
03/12/2009 9:45 AM  
Great!  That approach certainly works.

Joe Craig, Patapsco Research Group
Complete DNN Support
Lee Sykes
DNN Creative Staff
Nuke Master VI
Nuke Master VI
Posts:4945


--
03/12/2009 12:12 PM  
Hi Matt,

Just wanted to say hello + glad you find the site useful. Yes placing the code in the skin to me is the simplest and easiest way to keep control of it without 'admin' messing it up;-)

Cheers,

Lee
Lee Sykes
Site Administrator
Subscribe to the website : DotNetNuke Video Tutorials : The Skinning Toolkit : DotNetNuke Podcasts

Twitter: www.twitter.com/DNNCreative

Lee Sykes's Facebook Profile
David Finley
Nuke Newbie
Nuke Newbie
Posts:9


--
09/29/2009 5:29 PM  
We have created an Analytics Report Module for DNN. Quick and easy way to display your analytics data directly in your site.
David Finley


InteractiveWebs - DNN Module Development / CRM Integration


iwebs

Anthony
Nuke Pro
Nuke Pro
Posts:72


--
05/31/2010 8:32 AM  
hi, the thing I don't get in this discussion is why no one mentions the Google-Analytics page under Admin in the DotNetNuke framework? There you have a url paramater textbox to put the Javascript. I did notice that putting the Javascript there generates a ');' character on alle pages. Probably a bug in DNN. So maybe after all it's not a good idea to use the Google Analytics page in DNN greetings, Anthony
Joseph Craig
DNN MVP
Posts:11667


--
05/31/2010 9:17 AM  
You don't need to do anything on that page other than entering your Google Tracking code.  The URL parameter is not the same as the Google code.

Perhaps the reason that this is not discussed much is because it is a relatively recent addition. 

Joe Craig, Patapsco Research Group
Complete DNN Support
Anthony
Nuke Pro
Nuke Pro
Posts:72


--
05/31/2010 9:43 AM  
Oh I see. And is there then any advantage of putting the Javascript code manually in your skin file? Thanks, Anthony Belgium
Joseph Craig
DNN MVP
Posts:11667


--
05/31/2010 9:51 AM  
No, none.

Look at the source of any page and you will see that DotNetNuke has injected the Google code with your ID into every page.   It's no different than if you had done it yourself.

Joe Craig, Patapsco Research Group
Complete DNN Support
schmakt
Nuke Newbie
Nuke Newbie
Posts:3


--
06/06/2010 2:01 PM  
I've had Analytics tracking my site for about a year now... there's a wealth of information that google provides, but it's awfully confusing due to the annoying way that dnn creates URL's...

Is there any way to make it so that the page data displayed in Google is "[domain]/SubDirectory/PageName.aspx" instead of the dnn "tabid=22/slagasdlduoewigjlskjgablahblahblah" stuff?

I've tried modifying the web.config file to show "humanfriently" url's, but that doesn't seem to have actually done anything at all. Thanks!
Joseph Craig
DNN MVP
Posts:11667


--
06/06/2010 2:32 PM  
Hopefully Bruce Chapman will chime in here.  I can recommend his URL Master module to help with URLs.

Joe Craig, Patapsco Research Group
Complete DNN Support


---