DotNetNuke 5.6.0 Bug in Google Analytics Module No Hits

The Problem

We found that after updating to DNN 5.6.0 that the hits on Google Analytics dropped to 0 Page Views.

image

We looked at the reason behind the problem with 0 hits being reported. What we found was that the code that Google states we should use on the page (and was working fine in DNN 5.5.1) is now not valid in 5.6.0.

The tracking code for us looks like this:

 

<script type=”text/javascript”>

var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, ‘UA-1111111-1’]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();

</script>

When we looked at the rendered source code on the DNN 5.6.0 website, we found that the code was different in the line:

_gaq.push([‘_setAccount’, ‘UA-1111111-1‘]);

Note the “” marks around the ID Number.

So this was someone’s buggy code from DNN Corp.   In the file: SiteAnalytics.config file.

 

The Fix

To fix the problem, is as simple as undoing the buggy code.

in the root directory of your site, is a file called:  SiteAnalytics.config

Open this file in your text editor to reveal:

<?xml version=”1.0″ encoding=”utf-8″ ?>
<AnalyticsEngineConfig>
<Engines>
<AnalyticsEngine>
<EngineType>DotNetNuke.Services.Analytics.GoogleAnalyticsEngine, DotNetNuke</EngineType>
<ElementId>Head</ElementId>
<InjectTop>False</InjectTop>
<ScriptTemplate>
<![CDATA[

<script type=”text/javascript”>
var _gaq = _gaq || [];
_gaq.push([‘_setAccount’, [TRACKING_ID] ]);
_gaq.push([‘_trackPageview’]);

(function() {
var ga = document.createElement(‘script’); ga.type = ‘text/javascript’; ga.async = true;
ga.src = (‘https:’ == document.location.protocol ? ‘https://ssl’ : ‘http://www’) + ‘.google-analytics.com/ga.js’;
var s = document.getElementsByTagName(‘script’)[0]; s.parentNode.insertBefore(ga, s);
})();
</script>

]]>
</ScriptTemplate>
</AnalyticsEngine>
</Engines>
</AnalyticsEngineConfig>

Just replace the two quotation marks highlighted above “” with single ‘’  one either side of the two [ ]and save the file. This will fix the buggy code.

So the line becomes:

_gaq.push([‘_setAccount’, [TRACKING_ID] ]);

 

Notes on DNN 5.6.1

Originally we suggested that the “” be taken out. We then found after updating the 5.6.1 that the removal of the “” broke that upgrade with regard to Google Analytics. So we have modified these notes to say to replace the “” with single ‘’.

 

Side Note

We stayed stable on DNN 4.9.5 for some time, enjoying not having DNN broken each time we updated. Finally we bit the bullet and with much pain, a Code Expert, a Server Admin Expert and the help of Hyper V rollback capability we updated to DNN 5.x.

Now we are finding ourselves back in the game of undoing crap code every time we run a DNN update. Yes there are some great shiny new features, but we just blew 2 man days working out bugs in the UrlRewriter system and now this analytics bug.

This is disappointing and annoying to again be on this roundabout!

SiteAnalytics – Download File

 

10 thoughts on “DotNetNuke 5.6.0 Bug in Google Analytics Module No Hits

  1. Thanks for this post.. was a big help and saved us much time.

    You may find it interesting that DNN 5.6 breaks XHTML 1.0 Transitional validation with some kind of crazy link tags it adds to all the content zones. This is part of some “Google” enhancements “they” rolled out with the update.

    We had to do a version rollback to 5.3 which was quite comical indeed just to have our sites validate again.

  2. Thank you for the information!

    We are about to drop DotNetNuke and move to commercial CMS (EPiServer). It might cost money, but it’s worth not having to find out that this or that has stopped working.

    /Bj

  3. Thank you! I noticed our Analytics numbers dropped like a rock after upgrading to 5.6. Thankfully, I ran across your comment on CodePlex about this issue and just fixed it. FWIW, in my SiteAnalytics.config file, the ID had single quotes around it (as opposed to the double-quotes you show in your post) but removing those produced the same result. Now I just have to wait until tomorrow to see if Analytics starts recording our numbers again.

    • As it turns out Ray, the removal of the “” was not a good idea, as it broke the update to 5.6.1 in relation to Analytics. We too have changed the advice to replacing with ”. Thanks for the feedback.

  4. Pingback: Google Analytics Broken in DotNetNuke 5.6 « i blog

  5. You can’t get rid of the double quotes in my version -05.06.00 (459)-
    There were single quotes in the config file, but it seems the double quotes are generated in code.
    Now I deleted the singles and let’s hope I see tracking data tomorrow.

Leave a Reply

Your email address will not be published. Required fields are marked *