Add google analytics to SharePoint, SharePoint 2013 and SharePoint online (Office 365)


Google analytics can provide a very concise overview on how your website is doing. It generates nice reports and hosts clear reports.

It is also possible to use google analytics to track usage on an intranet site built on SharePoint, SharePoint 2013 or SharePoint online.

In this tutorial i will explain the steps to implement analytics to your SharePoint site.



  1. You need a google account
  2. You need permissions to edit (master)pages in SharePoint


In short:

  1. go to to generate an analyticsID
  2. copy some code to the site you’d like to track

Not so short:

  • go to
  • Create an account (see this as a group for the sites you track)
  • Add a new property (a new site to track)

google analytics

  • Retrieve the tracking-ID
  • Select the script provided (start at <script> and copy including </script>)
  • trackingID code
  • Open SharePoint designer and navigate to the masterpage folder.
  • Open the masterpage you are using for your intranet (in my case its Seattle)
  • Open and edit the .html version (the .aspx will be modified by SharePoint after editing)
  • scroll all the way to the bottom and look for the tag </body>find body tag
  • past the analytics code just above the </body> tag past analytics code
  • save the masterpage

Now the tracking data will be sent to google analytics. It may take some time before the results start to roll in but they will.


first resultsFirst results coming in after just a minute.