Deploy Google Analytics globally on modern SharePoint
Google Analytics articles are very popular in this blog and there are a few already available here, here and here but there is still room for one more, as the SharePoint Framework evolves so does this solution.
Today’s article introduces an easy way to deploy Google Analytics globally to all modern sites in your tenant taking advantage of the Tenant Wide Deployment.
On the previous versions this solution navigation between pages was not properly monitored, this happened due to a bug in the navigation event. Joel Rodrigues took the original code and implemented a fix to it that is included in this version.
The original project available on GitHub was migrated to SPFx 1.7.1, to make use of the Tenant Wide Deployment, the use of this feature requires version 1.6 or higher.
How to use Google Analytics on modern SharePoint
The new version of the solution no longer requires the use of PowerShell, to get it globally deployed follow the steps below:
- Download and Extract the solution from here
- Open your tenant app catalog
- Click on Apps for SharePoint
- Upload the solution to the catalog
- Check the option Make this solution available to all sites in the organization
- Go to Site Contents
- Open the list Tenant Wide Extensions
- Edit the GoogleAnalytics item
- Modify the Component Properties and replace the trackingID value by your Google Analytics tracking ID. Instructions on how to get the tracking ID are available here.
- Save the item and all your modern SharePoint site on Office 365 are ready to be monitored. If this was the first solution globally deployed on your tenant, it may take up to 20 minutes get available.