Need to add Google Analytics to a public facing website.
One could easily add a Google Analytics tracking code using the <embed> function, however, this would have to be done page by page.
The best solution is to update the master page so that all pages on the site have the code automatically loaded.
Identify the sites master page (note that you must be logged in as an administrator preferably as a site collection administrator).
Click on Master page
Make a note of the Site Master Page
In site settings click on Master pages and page layouts
Download a copy of the master page master page
Paste the google analytics code complete with <script> tags into the file. In this case the code is pasted towards the bottom of the page within the <body> tag
Go back to the Site Settings
Back in site settings click on Master pages and page layouts
Click the files ribbon tab then click upload
Upload the updated master page file (feel free to make a backup of the original but versioning is enabled in this library so you can normally roll back to a previous version if you make a mistake – shown later in this article)
If the upload button was used testing can be done before “publishing” and making the document life. When ready to make it the active master page click on the file in Master pages and page layouts and then click “publish”. A published file will be visible to all users.
To verify the Google Analytics are working by opening the website in a browser, lick on the Internet Explorer gear icon then click Developer Tools (* do not click the SharePoint gear icon, this is different)
In the Developer Tools window select the html inspector and expand the <body> tag and locate the google analytics script. The findfeature can also be used by searching for the word “google”.
To roll back locate the master page in the Master pages and page layouts gallery and click on version history
Restore a previous version
Rating: 8.7/10 (3 votes cast)
Rating: +1 (from 1 vote)
Adding google analytics to a public Office365 site, 8.7 out of 10 based on 3 ratings
Ulysses Ludwig is a SharePoint architect with over 16 years in the IT and computer industry. Ulysses' primary focus is SharePoint but he dabbles in the latest web technologies and likes to develop software in his spare time.