Example 1. Enable jQuery
The following Activate-JQuery.ps1 script demonstrates how to enable jQuery library in Office 365/SharePoint Online site
Example 2. Enable Google Analytics
The following Activate-GoogleAnalytics.ps1 script demonstrates how to activate tracking code in Office 365/SharePoint Online site
Follow these instructions to use Google Analytics to collect data from Office 365/SharePoint Online sites.
To set up the web tracking code:
- Find the tracking code snippet for your property.
Sign in to your Google Analytics account, and click Admin in the top menu bar. From the Account and Propertycolumns, select the property you’re working with. Click Tracking Info / Tracking Code.
<script>and ends with
The tracking code contains a unique ID that corresponds to each Google Analytics property. Don’t mix up tracking code snippets from different properties, and don’t reuse the same tracking code snippet on multiple domains. Click to expand this image and see where the tracking code snippet is in the interface.
- Open Activate-GoogleAnalytics.ps1, paste the tracking code into $TrackingCode variable and run the script to register tracking code in Office 365/SharePoint Online site
- Check your set up.
Make sure that the tracking snippet installed on your website matches the code shown in the view, and see more ways you can verify your set up.