How to add Application Insights to SharePoint without modifying the master page

Google analytics articles are among the most popular articles in this blog and inclusive they got featured on SharePoint Dev Weekly episodes.

On episode #27 Vesa and Waldek discussed the advantages and disadvantages of having internal and potentially confidential data sent from SharePoint to Google servers.

Google Analytics is not the only monitoring tool you can add to SharePoint, Microsoft has Application Insights that provides a similar functionality with the advantage of keeping your data in the same ecosystem.

In this article you will find a solution to add Application Insights to your classic SharePoint sites without modifying the master page, Microsoft also have instructions available here, but it requires the manual manipulation of the master page or the page source code.

Setup Application Insights

Before installing Application Insights on SharePoint, you first need to do the setup on your Azure account following the steps below.

  1. Sign In on the Azure Portal
  2. On the left bar click on Create Resource
  3. Search for Application Insights
  4. Click on Create
  5. Provide a name for the application
  6. Select ASP.NET web application on the Application Type
  7. Create a new Resource Group and provide a name
  8. Select your data center Location
  9. Once created click on overview tab
  10. Copy the Instrumentation Key and save it for later

Install Application Insights on SharePoint

To install the solution in your SharePoint and start tracking your sites follow the steps below:

  1. Download the solution from here
  2. On your site collection root site go to Settings -> Site Settings -> Solutions
  3. Upload and activate the solution
  4. Once you activate the solution, Application Insights script is immediately added to your site however it is not tracking your site yet, you still need to add your instrumentation key to the script

  5. Open your site with SharePoint designer
  6. Go to All Files -> Style Library -> Application Insights -> js
  7. Check out and edit the insights.js file in advanced mode
  8. Locate the words APPLICATION INSIGHTS and replace it by your own

From this moment on all the sites in your site collection are being tracked by Application Insights and your data will live inside the Microsoft Ecosystem.

The project solution as always is available on GitHub and you can modify it according to your needs.

Download Application Insights
Explore Solution on GitHub

One Response to “How to add Application Insights to SharePoint without modifying the master page”

  1. […] my last article I’ve provided a solution to deploy Application Insights to classic SharePoint without modifying […]


Leave a Reply

I've been working with Microsoft Technologies over the last ten years, mainly focused on creating collaboration and productivity solutions that drive the adoption of Microsoft Modern Workplace.

%d bloggers like this: