Recently I have tried to implement Google Tag Manager in MS Sharepoint Online. For the usual website this would be the matter of minutes. However, in MS Sharepoint Online, it is kind of bigger challenge.
First and most important – there is no easy way in new Sharepoint Experience interface
- Customizing “modern” lists and libraries on Microsoft Developers page
- Uservoice ticket with official response (older info but it shows you that your are not alone with this problem)
- Sharepoint Framework on office blog (brief intro to Shp Framework)
Back-up your Sharepoint Online
Any method described can be a reason for Sharepoint error. The good thing is, your Sharepoint site collections are back-up regularly and you have 14 days to ask for a back-up. Yes, you must ask via authorized request in Office 365 admin. There are some other back-up option but there are from non-MS vendors.
Method #1 – Use iframe webpart
You may create a web-part as an iframe to your script. Firstly you must allow your source site as allowed iframe location in settings (by default only few sites as YouTube are approved). Read more: Step by step guide how to embed script as webpart
Method #2 – Set-up user custom action
Method #3 – Use extension
There is one extension that can help you. I have not tested it. You can get it on MS Store .
Method #4 – Not recommended – Tweak Master Pages
Yes, you can. If you download software Microsoft Sharepoint Designer, you may easily connect to your Sharepoint instance and edit ASPX source code of all master pages. However, this method is really future-fail. Your Sharepoint can start behave unexpectedly because of new updates. Also 2 times from 3 tries, after master page tweak I got an error that had nothing in common with the change I have just made. I would really not recommend this on MS Sharepoint Online (I am not experienced ASP programmer). You may have problems to connect to your instance. Then you must download SharePoint Online Management Shell and allow that connection. If you edit master pages, always back-up, always preview your changes and be sure that your script is HTTPS not to broke your SSL certificate.
To summarize it, there has been no easy way yet. The new Sharepoint Framework will be the solution (available sometimes in 2017). I would also love to thank two Czech companies who shared some valuable information with me that helped me create this article – RSM Infinity (complex IT services) and Multima (specialists for software development and collaboration). Please feel free to comment bellow or share this article.