Adding Google Analytics Tracking code in DNN 9.*

If you’ve setup a new DNN site running on version 9.0 or 9.1, you’ll notice that you don’t have the ability to setup the Google Analytics module/code anymore. For some reason, DNN Corp in its infinite wisdom decided to remove the core, critical functionality from the Platform version of DNN and only leave it in the paid versions.

Well fear not, you can easily add Google Analytics code to your pages, follow these steps.

  1. First step is to go to http://analytics.google.com/ and sign up, register your site, you’ll be given Tracking code that looks similar to

    <script>
       (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
       (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
       m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
       })(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

      ga('create', 'UA-######-##', 'auto');
       ga('send', 'pageview');

    </script>

  2. Copy that code, yours will be slightly different, without the #### in place.
  3. Navigate to your Site Settings page within the DNN Persona Bar.
  4. Navigate to the Site Behavior tab
  5. Scroll down to the Page Output Settings section.
  6. Paste the tracking code into the text box there.
  7. Click save at the bottom of the page.

Boom, you’ve now got your tracking code included on all the pages on your site.

Recent Comments

I want to thank you for this post - there is little advice for people getting started with DNN 9X i'm fairly new to DNN and your information is always helpful... a very simple fix....thanks again, allen Much appreciated,,

Posted By: allen Hunsucker on Wednesday, May 17, 2017 8:38 AM
hello Chris Hammond, i have upgraded my test site to dnn evoq 9.1.0 version. and i want to add google Analytics Tracking Code. but i can not find "Page Output Settings section" under Site Behavior tab of Site Settings page. please help
Posted By: Mitesh Patel on Tuesday, June 27, 2017 9:13 AM
The Page Output Settings is at the bottom of the Site Behavior Tab, Default Settings, very bottom...
Posted By: Rob Hunter on Thursday, June 29, 2017 10:05 PM

Thank you - and thank you again for this elegant solution.

Posted By: Lizzy Johnson on Thursday, July 20, 2017 9:40 PM

Google suggests putting the code after the body tag "Add the following line to each template page immediately after the opening

tag", your method (while technically "ok", isn't the recommended method - just to let everyone know) is inputting the code into the head.

Posted By: Phillip Quinlan on Monday, August 28, 2017 8:07 PM

Add Comment

Please add your comment by filling out the field(s) below. Your comment may need to be approved before it becomes visible.
Enter your first name for display with the comment
Enter your last name for display with the comment.
Enter your email address so that we may contact you if necessary. We will also use this for your Gravatar.
Enter the URL to your website. URLs may be removed from comments.
Enter your comment here.
If you can't type Human in, you can't post, plain and simple.
Submit Comment Cancel

Chris Hammond is

Chris Hammond is a father, husband, leader, developer and car guy. Chris has long specialized in ASP.NET and DotNetNuke development, so you will find a variety of topics here on the website. For more information check out the about me page.

If you are looking for DotNetNuke consulting please visit my business website at http://www.christoc.com/

Disclaimer

Any blog posts here are solely the opinion and views of Chris Hammond only. Comments on blog posts are the opinion of the commenter, and not Chris Hammond.

Powered By

This website is managed by Christoc.com Software Solutions

DotNetNuke Hosting

Hosting for this website is provided by AppliedI.Net. Be sure to visit them for all your DotNetNuke Hosting needs. 

Find Me