· Chris Hammond
Last Updated
Adding Google Analytics Tracking code in DNN 9.*
Learn how to easily add a Google Analytics tracking code to your DNN site's pages without the module. Follow these simple steps for seamless integration.
Update: This can now be handled through DNN's persona bar under the Connectors option. Choose Google 4 and add your tracking id there, just the number, instead of the full javascript mentioned below.
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.
- First step is to go to https://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>
- Copy that code, yours will be slightly different, without the #### in place.
- Navigate to your Site Settings page within the DNN Persona Bar.
- Navigate to the Site Behavior tab
- Scroll down to the Page Output Settings section.
- Paste the tracking code into the text box there.
- Click save at the bottom of the page.
Boom, you've now got your tracking code included on all the pages on your site.