Adding a Javascript snippet to all DNN pages


During the course of building out a DNN portal, designers may want to inject a piece of Javascript into all pages (such as a Google Analytics Code). Instead of manually doing this via headers or footers for each page, there's a workaround that will allow the script to be placed in one spot and be delivered across all pages. 


Requirements: SuperUser access to DNN

NOTE: The following steps will NOT work on versions between 8.5 and 9.2. If you are on one of those versions, you will need to directly modify the SiteAnalytics.config file within Windows from \DesktopModules\DNNCorp\Connectors\GoogleAnalytics\SiteAnalytics.config

1. Log in to the DNN portal with SuperUser credentials.

2. Go to Persona Bar > Settings > Config Manager.


3. Select SiteAnalytics.config from the drop down menu.

4. Insert the Javascript immediately after the Google Analytics code. 


Because the SiteAnalytics.config file is set up to execute on all pages, adding the Javascript there will have the same effect as adding it manually to all pages. 

5. Press the Save Changes button.

6. Clear your cache

7. Validate that the Javascript is working as intended by navigating to a page with the DNN portal. If successful, it will load and execute.


Content Contributor: Michael Ayoub




Please sign in to leave a comment.