Articles by Upendo Ventures

We "Upendo" to Write for You!

Our team loves to share our thoughts, research, experiences here in our blog. Please enjoy our articles and leave a comment to let us know what you think.

Adding Universal Google Analytics to DNN 9.1

Upgrading Google Analytics in DNN 9.1

Configuring your Google Analytics in previous versions of DNN was super simple.  You would just navigate to the Google Analytics page and paste in your Google Analytics tracking ID.  Since DNN 9 was released, some of the administration that was easily accessible is yet to be added back to the administration area.  This article will help you to enable and update Google Analytics to use the most current version, universal analytics.  This is important since the default version of Google Analytics is using DoubleClick.  You can blame me for that since I submitted that pull request, but it was the current at the time…

Signup for Google Analytics

If you haven’t already done so, create an account with Google Analytics.

https://www.google.com/analytics/

If you’re upgrading from a previous version of Google Analytics, there’s a great Universal Analytics upgrade article for you to review to answer any questions.

Once you have your account created, navigate to the Admin area and to the Tracking Code page, like shown below.

Navigate to Google Analytics Tracking Code

If you scroll down a bit on the Tracking Code page, you’ll find the Universal tracking code, but you’ll need to expand the section.  Click in the code area to select it all.  Copy and paste this somewhere.  You’ll need it later.

Universal Analytics Code

You’ll want to get the tracking ID from this code right away though.  You’ll need it for the next step.  It usually looks something like “UA-XXXXXX-XX” where the X’s are a number.  In the image above, it’s in the blurred area.

Add Your Tracking Code to DNN

In older versions of DNN, adding your tracking code was quite easy.  Now, you’ll need to perform a workaround to get your tracking code saved correctly now and for future updates expected to come to DNN.  These instructions are specific to DNN 9, through 9.1.1 (as of the time of this writing).  Unfortunately, they’re also technical steps, so you may want to get your technical team involved if you’re not comfortable with the steps below.

You’ll need to create a new file called GoogleAnalytics.config and place it into the folder for the site (portal) that you’re updating.  In most cases, your portal is 0 unless you have more than one website in your instance of DNN.  So the folder path will likely look like the following.

[root]\Portals\0\

You’ll want to edit the file to include the following XML, but replace the tracking ID as shown in the code example below (“REPLACEME”).  You just found the tracking ID in the previous step.

<?xml version="1.0" encoding="utf-8"?>
        <AnalyticsConfig xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
          <Settings>
            <AnalyticsSetting>
              <SettingName>TrackingId</SettingName>
              <SettingValue>REPLACEME</SettingValue>
            </AnalyticsSetting>
            <AnalyticsSetting>
              <SettingName>UrlParameter</SettingName>
              <SettingValue />
            </AnalyticsSetting>
            <AnalyticsSetting>
              <SettingName>TrackForAdmin</SettingName>
              <SettingValue>true</SettingValue>
            </AnalyticsSetting>
          </Settings>
        </AnalyticsConfig>

Once you save this file with the code above in the correct place, you have updated your Google Analytics ID for the site.

Update DNN to Use Universal Analytics

The default version of Google Analytics is still DoubleClick in DNN 9.  You’ll need to upgrade this to the Universal Analytics script, which is pretty easy to do.  First, navigate to the Configuration Manager, like shown below.

Navigating to the DNN Configuration Manager

Next, you'll want to choose the "SiteAnalytics.config" file to edit in the list of available files.  When you choose it, the file contents will load into the editor viewing area.

You’ll want to replace the highlighted code below with the code you copied from the first step above.  Take special note that the SCRIPT tags are not highlighted.  You need to be sure they don’t get removed.  Also, there’s a [TRACKING_ID] token that you’ll want to re-use for the next step.

Original Google Analytics Tracking Code (DoubleClick)

When you correctly paste in the Universal Analytics code and replace the ID with the token, it will look like the example below.

Replaced Google Analytics Code

Now all you have to do is click the Save Changes button to save the update.  Once you confirm the change, you’re done.  Your site is now using the Universal Analytics version of Google Analytics.  Congratulations!  Now you can take advantage of all kinds of new features, including ecommerce and custom dimensions.


About the Author

Will StrohlFounder & CEO
Upendo Ventures
Overall, Will has nearly 20 years of experience helping website owners become more successful in all areas, including mentoring, website development, marketing, strategy, e-commerce, and more.

blog comments powered by Disqus