Google Analytics for SharePoint 2013 / Office 365

Oct 23
Google Analytics for SharePoint 2013 / Office 365

The solution is based on the Google Analytics solution for SharePoint 2010. It enables on all pages the Google Analytics code or some other JavaScript without modifying the underlying master pages or any other file delivered from Microsoft. The solution runs as a non-code sandbox solution. That should limit deployment difficulties.

The solution works with SharePoint 2010 and 2013.

Why this is not an App? The solution uses a special behavior of features so that the master pages or other pages haven’t to be modified. Unfortunately that’s not possible with an app. The following app looks as it's modifying the pages, it's another way to solve the issue:





  1. Open your SharePoint 2013 site collection or your public website
  2. Rename the URL in the browser (Login as needed with a site collection administrator / your admin account):

    Current URL:

    Rename to:

    Note: Somehow Microsoft has removed the possibility to show the sandbox solutions folder from the UI in public websites. Anyway as they are using it for design packages and website templates, I assume there will be no difficulties with no-code sandbox solutions.

  3. Select Upload Solution

  4. Select Browse…


  5. Download the solution package, extract it and upload the wsp file:

  6. Click Open and OK to upload the solution.


  7. Select Activate to install the solution.
  8. Now, verify the activation was successfully
  9. Finally you have to add your Google Analytics code. For that you can open Site Settings:
  10. There is a new menu entry point under Site Collection Administration which is called Google Analytics



  11. Paste the google analytics code into the red square and press OK. That's it.

To test if it works as expected, just open the website in a different browser and take a look on the html source. If your Google Analytics code is there, then everything is fine.

If you are unhappy with the solution, then just deactivate the sandbox solution over the same URL. As there is no modification on existing sites done, your site will work as before.


Adrian Fiechter (Google Link)