How to Integrate Google Analytics with SharePoint 2013?

Google Analytics is a popular free service for website analytics. Why don’t we use Google analytics with our SharePoint sites? Here is how to add Google analytics to SharePoint 2013:

Step 1: Sign-up & Get Google analytics Tracking code

You need to have a Google analytics account to start with! Signup for the Google Analytics account at:,  Login to Google Analytics site, Navigate to “Admin” tab, and setup new property for your website by filling the farm, Click on “Get Tracking ID” button to generate  Google Analytics tracking code for SharePoint. We need this tracking code to add google analytics to sharepoint site.

google analytics sharepoint integration

You’ll get tracking code something like:

install google analytics sharepoint 2013

Step 2: Edit Master page and Add Google Analytics tracking code

The next step is to add Google Analytics to the SharePoint master page. Edit your master page in ‘Advanced mode’ with SharePoint designer 2013 and insert this code just before </head> tag.

google analytics in sharepoint master page

Save-Check-in-publish/Approve the master page.

Step 3: view Google Analytics data for SharePoint

Wait for 24 Hours and you should see Google Analytics statistics populated based on your site’s traffic.

google analytics for sharepoint 2013

Can I have Google Analytics for SharePoint intranet sites?
How does Google Analytics work? Well, every time when users access the site, Google script runs on their browsers and registers the hit with Google Analytics along with some analytics data. So it doesn’t matter even if your website is an intranet site, as long as the user viewing it has access to the internet network to reach Google Analytics servers.

Google Analytics vs SharePoint analytics:
We all know SharePoint already has some built-in usage analysis capabilities. Why we need Google Analytics still? Well, Google Analytics extends these OOTB capabilities and provides more data such as: Say, you have a public internet SharePoint site and want to track which country your visitors are coming from, What they are looking for? How did they get to your site, What browsers they are using, etc.

You can use this technique to integrate Google Analytics with any version of SharePoint such as SharePoint 2010, SharePoint Online, SharePoint foundation, etc.

Salaudeen Rajack

Salaudeen Rajack is a SharePoint Architect with Two decades of SharePoint Experience. He loves sharing his knowledge and experiences with the SharePoint community, through his real-world articles!

9 thoughts on “How to Integrate Google Analytics with SharePoint 2013?

  • July 16, 2018 at 9:12 PM

    I love your website. You have helped me so much with your Powershell scripts for SharePoint. THANK YOU!!

    Wondering… is there a way to get user id information in Google Analytics?

  • December 11, 2017 at 1:13 PM

    can any one share detailed Blog url

  • November 13, 2017 at 4:09 PM

    Any idea on how to install analytics for the modern SharePoint experience?

  • September 26, 2017 at 5:15 PM

    I followed the above instructions and could see the script on my intranet site. But the google analytics reporting is zero. How should I troubleshoot this issue?

    • September 27, 2017 at 7:55 AM

      Usually, It takes 24-48 hours to show up in the standard reports for Google Analytics.

  • July 27, 2017 at 10:40 PM

    Could you please explain how you can track embedded SharePoint video (not YouTube) with GA or GTM

  • March 24, 2017 at 7:38 AM

    i don’t understand, google analytcs that you set it refers to sharepoint intranet site or external web site? i need analytics for my external site on sharepoint intranet site

    • March 26, 2017 at 9:07 AM

      Works on Intranet sites as long as your Intranet servers able to communicate with Google Analytics!

  • April 7, 2016 at 7:10 AM

    Yes. This is really helpful for beginners.


Leave a Reply