Step 5: Adding a trusted script source in SharePoint (Site Analytics)
Once you've connected Google Tag Manager to SharePoint, you'll want to add a trusted script source in SharePoint
Microsoft’s Content Security Policy (CSP) strengthens security across SharePoint Online by controlling how scripts are loaded and run on pages, helping to protect SharePoint environments better (further details available here).
For the Site Analytics app, this guide shows SharePoint Administrators how to add the Google Tag Manager URL as a trusted script source, ensuring the app runs smoothly while following Microsoft’s security best practices.
Note: The SharePoint Administrator role will be required when adding a trusted script source.
-
Navigate to the SharePoint Admin Center. In the left-hand menu, expand Advanced, select Script sources.
-
In the Trusted script sources area, select the Add source button.
-
In the Source expression field, add the following Google Tag Manager URL:
https://www.googletagmanager.com/
-
Select Add to apply the new trusted script source.