> ## Content Index
> Fetch the complete content index at: https://blog.lsonline.fr/llms.txt
> Use this file to discover other available public pages before exploring further.

# Setup Matomo Tag Manager to the classic SharePoint site collections
- URL: https://blog.lsonline.fr/2019/08/03/setup-matomo-tag-manager-to-the-classic-sharepoint-site-collections/
- Published: 2019-08-03T22:20:14.000Z
- Updated: 2026-01-27T18:52:55.000Z
- Description: A solution to setup the Matomo Tag Manager script into your SharePoint site collections with classic experience
- Author: Laurent Sittler
- Tags: SharePoint, Analytics, Classic Experience, Development, JavaScript

If you have already read the post about [Setup Matomo Analytics to the classic SharePoint site collections](https://blog.lsonline.fr/2019/07/29/setup-matomo-analytics-to-the-classic-sharepoint-site-collections), you are maybe interested to go ahead with more capabilities.

What is the difference between a **Tag Management System** and an **Analytics Tracker**?

- **Analytics**: generates reports and statistics based on the visits and visitors. It is possible to add some *custom variables* or *custom dimensions* to obtain further information; to add this kind of thing, **you will need a minimum of development skills** because you will need to add scripts into SharePoint.  
Example: add a JavaScript script (via Custom Action of course in addition to the Analytics script) to catch a specific click and perform a push to record it. [More information ›](https://developer.matomo.org/guides/tracking-javascript-guide?ref=blog.lsonline.fr#custom-variables-for-visits)
- **Tag Manager**: This allows you to create and trigger some custom tags in accordance with your business needs in addition to track page views and all information about the visits and the visitors. Furthermore, tags and triggers management can be done without additional developments in your environment; the global configuration is pushed from the Tag Management System into the target environment once published. [More information ›](https://matomo.org/docs/tag-manager/?ref=blog.lsonline.fr#what-is-a-tag-manager)

## **Setup Matomo Tag Manager**

I wrote a script that will allow you to easily implement the Tag Manager script into your SharePoint sites based on classic Templates.

### **Prerequisites**

1. A Matomo (Piwik) server (On-Premises) or instance (Online)
2. A Matomo ****Tag Manager URL**: [https://matomo.org/docs/tag-manager/#how-can-i-set-up-matomo-tag-manager-on-my-website](https://matomo.org/docs/tag-manager/?ref=blog.lsonline.fr#how-can-i-set-up-matomo-tag-manager-on-my-website)
3. You will need to install the [****PnP PowerShell module**](https://github.com/SharePoint/PnP-PowerShell/releases?ref=blog.lsonline.fr) *(I did not create the bash script yet ??)*

### PowerShell

1. Download the **solution** from the [repository](https://gitlab.lsonline.fr/SharePoint/javascript-customactions/tree/master/SharePoint.MTM?ref=blog.lsonline.fr)
2. Unzip the archive
3. Execute the following cmdlet by changing `container_[ID]` with your Matomo URL:

```PowerShell
.\SPMTM.ps1 -siteUrl "https://intranet.mydomain.com/sites/targetSite" -trackingUrl https://matomo.my-domain.com/js/container_[ID].js
```

**If you cannot execute the PowerShell script, because of security reasons, before unzipping the package, execute the* `[**Unblock-File*](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/unblock-file?view=powershell-6&ref=blog.lsonline.fr)` *cmdlet.*

> \[note\]****Note**  
>  
> Other options are available as illustrated into the [README.md](https://gitlab.lsonline.fr/SharePoint/javascript-customactions/blob/master/SharePoint.MTM/README.md?ref=blog.lsonline.fr), that allow you to manage the deployment

> \[note\]****Note**  
>  
> The user account that will perform the following actions has to have sufficient permissions on the target sites collection.
  
  
Hoping this post will help you ?