Using Google Tag Manager With DNN


The Google Tag Manager (GTM) is a tool that allows a website owner to quickly integrate different script-based products into a website without needing to edit the underlying pages of the site.

This article will provide the steps to include the GTM tracking script in DNN to manage your Google Analytics account.




Note: You do not need to enable Google Analytics to utilize Google Tag Manager.

Google Tag Manager is a way of including different Html Tags into your site without needing to edit each page to add them.

While ‘tag’ in this context can be confusing to some, it means ‘Html Tag’ rather than ‘Taxonomy Tag.’

  • The most common use case is to add the Google Analytics script tag, which tracks the page views and other interactions on a page. This is less of an issue with DNN because DNN allows easy editing of pages without the need for getting a technical resource involved.

The traditional way to add Google Analytics is to edit your website to include a script tag that contains the snippet used by Google to track the page views and events which occur while the page is being viewed.  

  • The Google Tag Manager replaces that by adding a GTM script tag instead. When the page is loaded, this then calls back to your GTM account and loads any scripts dynamically. You can then use the GTM console to add various pre-defined products or to create your tags.


GTM acts as a type of Content Manager for externally linked products that use ‘script tags include.’

  • This is especially helpful for those who cannot easily edit the files on their website (i.e., a Marketing team owns the analytics and tracking of a site, but an IT team owns the files or application).
  • GTM resolves when the site is run, meaning that changes can be quickly made without any modifications to the underlying system.



Back to top



Using the DNN Google Analytics Module to Add GTM Script


DNN ships with a ‘Google Analytics’ component. This works by injecting the GA script onto each page of the site and merging the UA-xxyyzz-nn User Account Id with the script. While most people just use this for Google Analytics, it can easily be used to inject the GTM script by using the steps below:

  1. Sign up for a GTM account. Find the location of the Tracking Script – you can click on the account identifier (it will look like GTM-AABBCC). The tracking script is a chunk of Html script tags.

  2. Make sure you are using the Google Analytics module:
    • Before Evoq 9: Navigate to Admin > Google Analytics or Admin > Google Analytics Pro (if using Evoq). You should have the ‘Enable’ checkbox checked.

    • After Evoq 9: Navigate to Settings > Connectors > Connect Google Tag Manager.

  1. Open the ‘SiteAnalytics. Config’ file (located in the root folder of your DNN installation) in a text or XML editor, such as Notepad++.

  2. Paste the GTM tracking script into the XML element in the ‘SiteAnalytics. Config’ file. Place the script according to the latest guidelines on Install Google Tag Manager for web pages.

    Remember that it should go between the opening and closing tags, e.g.:

  3. Save the ‘SiteAnalytics. Config’ and refresh one of the pages of your sites. Check the page source using your browser tools and verify that the GTM script tag is appearing.


Back to top


Working With Multi-Site Installations


The above method locks an entire DNN installation to a single GTM account, whereas GTM accounts are typically site/domain-specific. If you have multiple sites in your DNN installation, and you want to use GTM in each site, you will need a slightly different solution. 

This is easy to do because the GA module being used here must solve the same problem. 

  1. Make sure you are using the Google Analytics module:

    • Before Evoq 9: Navigate to Admin > Google Analytics or Admin > Google Analytics Pro (Evoq editions) and enter the GTM ID (in the posted example, it is GTM-MRGHSJ).

    • After Evoq 9: Accessing Settings > Connectors > Connect Google Tag Manager.

  2. After pasting the snippet directly from the GTM console into your ‘SiteAnalytics. Config’ file, replace the ‘GTM-XXYYZZ’ ID with the [TRACKING_ID] token.


  3.  Save your work and review it by looking at the Html source for the site in question:


    The GTM ID will be substituted into where the [TRACKING_ID] token is. This will be done for each site in the DNN installation where the module is enabled and has the specific GTM ID inserted in the Google Analytics section.


Back to top



Please sign in to leave a comment.