You can embed custom script into your SharePoint pages to enable analytics and tracking. You can also integrate 3rd party apps which require you to add their script to the page
Here is how to add a custom script to be executed on every page:
- Navigate to the main page of your intranet - aka the Hub Site
- Click the [*] -> Site contents
- Open the [Site Assets] library and upload your custom script as a file, for example: [myscript.js]
- Copy the URL of this file; we’ll be using it in the next step.
Now, let’s reference this script to be loaded on every page:
- Navigate back to the site contents by clicking the [*] -> Site contents
- Find the [Config] list and open it
- Add the following new item in the list:
Value: [URL of the file you copied in step 4 above]
- Save the new item and refresh the Hub Site page. Your script will now be inserted into the [head] of each page and load on each page.
You can also insert a script into the Body of your page.
To do that, create an additional script file and a secondary [TrackingCode] element in the [Config] list. You will now have two [TrackingCode] elements. The first one will automatically go into the [Head] of the document and the second one into the [Body].
Anything unclear or doesn’t work?
Post your question or comment here