How to deploy a script to all pages on SharePoint Online

%3CLINGO-SUB%20id%3D%22lingo-sub-982543%22%20slang%3D%22en-US%22%3EHow%20to%20deploy%20a%20script%20to%20all%20pages%20on%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-982543%22%20slang%3D%22en-US%22%3E%3CP%3EOur%20organization%20uses%20a%20third-party%20software%20for%20analyzing%20our%20intranet%20sites%20on%20SharePoint%20Online.%20This%20software%20uses%20a%20JavaScript%20code.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThe%20code%20has%20been%20added%20manually%20to%20every%20pages%20by%20using%20the%20Modern%20Script%20Editor%20web%20part%20at%20this%20moment.%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIs%20there%20way%20to%20deploy%20this%20code%20to%20all%20pages%20centrally%20on%20the%20tenant%20level%3F%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-1028729%22%20slang%3D%22en-US%22%3ERe%3A%20How%20to%20deploy%20a%20script%20to%20all%20pages%20on%20SharePoint%20Online%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-1028729%22%20slang%3D%22en-US%22%3E%3CP%3EHi%26nbsp%3B%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F443651%22%20target%3D%22_blank%22%3E%40T_Kujala%3C%2FA%3E%26nbsp%3B%2C%3C%2FP%3E%3CP%3Eyou%20can%20build%20an%20SPFx%20application%20customizer%20(an%20SPFx%20extension)%20and%20follow%20this%20approach%20used%20for%20Google%20Analytics.%3C%2FP%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Fsharepoint.handsontek.net%2F2017%2F12%2F21%2Fhow-to-add-google-analytics-to-the-modern-sharepoint%2F%22%20target%3D%22_blank%22%20rel%3D%22nofollow%20noopener%20noreferrer%22%3Ehttps%3A%2F%2Fsharepoint.handsontek.net%2F2017%2F12%2F21%2Fhow-to-add-google-analytics-to-the-modern-sharepoint%2F%3C%2FA%3E%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3ECheers%2C%3C%2FP%3E%3CP%3EFederico%3C%2FP%3E%3C%2FLINGO-BODY%3E
Occasional Visitor

Our organization uses a third-party software for analyzing our intranet sites on SharePoint Online. This software uses a JavaScript code.

 

The code has been added manually to every pages by using the Modern Script Editor web part at this moment.

 

Is there way to deploy this code to all pages centrally on the tenant level?

1 Reply

Hi @T_Kujala ,

you can build an SPFx application customizer (an SPFx extension) and follow this approach used for Google Analytics.

https://sharepoint.handsontek.net/2017/12/21/how-to-add-google-analytics-to-the-modern-sharepoint/

 

Cheers,

Federico