Adding Google Analytics to a DNN site manually


Because the Google Analytics microservice needs an outbound internet connection to be established and work properly, customers who have internal only connections may run into issues setting it up. In these cases, it's advisable to insert the DNN Google Analytics script directly into the site header.

NOTE: Many of the issues surrounding the inability to connect to Google Analytics have been resolved in DNN version 9.2 so it's advisable to consider an upgrade if you're facing issues. 

Requirements: Access to core site code, admin access to DNN. 



        DotNetNuke.Professional.Services.Analytics.GoogleAnalyticsEngine, DotNetNuke.Professional

          <script type="text/javascript">
            (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
            ga('create', '[TRACKING_ID]', 'auto', {'legacyCookieDomain': '[DOMAIN_NAME]'});
            ga('send', 'pageview');


The customer can then validate that the script is working by logging into the DNN portal and going to Persona Bar > Dashboard > Site Analytics where, if successful, they will see the data displayed. 




Please sign in to leave a comment.