> ## 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 Analytics to Modern SharePoint from any platform
- URL: https://blog.lsonline.fr/2019/05/11/setup-matomo-analytics-to-modern-sharepoint-from-any-platform/
- Published: 2019-05-11T18:31:56.000Z
- Updated: 2026-01-27T18:52:09.000Z
- Description: If Google Analytics is not the solution for your organization, Matomo Analytics can be the alternative for your SharePoint environment with SharePoint Framework extension.
- Author: Laurent Sittler
- Tags: SharePoint Framework, SharePoint Online, Modern Experience, Development, Microsoft Patterns & Practices, CLI for Microsoft 365, PowerShell, Microsoft 365, Docker, Analytics

> Update 2019-09-17: update links of Matomo solution

*This is an alternative to one of my previous posts about* [*Setup Google Analytics to Modern SharePoint from any platform*](https://blog.lsonline.fr/2019/02/07/setup-google-analytics-to-modern-sharepoint-from-any-platform/)*. Google Analytics* means that your organization has to host data about software and users into a tierce solution. For some governance, privacy, and security reasons, some organizations can not use this kind of solution.‌‌ So, what are the alternatives? Is there another free solution?

![](https://blog.lsonline.fr/content/images/2019/05/LsOnline-NoGoogleAnalytics-Logo-3.png)

No Google Analytics

I have done some research for a while ... I found other interesting analytics tools that I tried on my own blog and SharePoint test environments. Two solutions caught my attention based on the following criteria:

1. **Free**: totally free is a must but at least basic features for free
2. **Open-Source**: I like open-source solutions so much! That gives the organization enough flexibilities to improve and customize the solution for their needs. And, incidentally, contribute to this project.
3. **Self-Hosted**: of course, if you want to keep a hand on the data, the best solution is self-hosting. Thanks to this kind of solution, you can potentially have a compliant [GDPR](https://gdpr-info.eu/?ref=blog.lsonline.fr) solution too.
4. **Google Analytics alternative**: is currently a reference in the world of web analytics services. Therefore, I took it as a reference to find solutions that provide sufficient similar features such as real-time, several graphs, create custom dashboards, maps, etc.
5. **Relatively easy to implement**: if you are to present an awesome solution to your customer but he has to spend half of his time and budget to set up the solution itself... hmm, you know what I mean, isn't it? 🤓

## Open Web Analytics

![](https://blog.lsonline.fr/content/images/2019/05/owa_logo_200w.png)

[Open Web Analytics logo](http://www.openwebanalytics.com/?ref=blog.lsonline.fr)

I tested OWA at first because of several features available for free such as heatmap, mouse click, etc.

After several weeks, I noted that the admin interface was really old, some features did not really work (for my part, I did not manage to make it work "heatmap" for example) and the real-time was missing. In addition, I am following the [GitHub repository](https://github.com/padams/Open-Web-Analytics?ref=blog.lsonline.fr) of the solution and I did not see any new fixing issue, enhancement, or whatever for a long time...

> \[note\]**Note**  
>  
> For my tests, I used the [https://github.com/vladk1m0/docker-owa docker](https://github.com/vladk1m0/docker-owa%20docker?ref=blog.lsonline.fr) image.

So, I decided to pass to the next analytics tool...

## Matomo (Piwik)

![](https://blog.lsonline.fr/content/images/2021/01/matomo-logo-certificate-3.jpg)

[Matomo Analytics logo](https://matomo.org/?ref=blog.lsonline.fr)

Matomo is the solution that I am currently using for some weeks; this solution looks a lot like *Google Analytics*:

- Dashboard configuration
- Tracker code implementation
- Features (available for free)

In addition to that, Matomo:

- is GDPR compliance
- is customizable (Open-Source)
- has a Marketplace of features

Moreover, I did a suggestion for a new dashboard widget on the [GitHub repository](https://github.com/matomo-org/matomo?ref=blog.lsonline.fr) anda member of the team answered me the same day! Efficiency.

Now, I will show you how I have configured my environment...

## Matomo for Modern SharePoint - for everybody

You can have *Matomo Analytics* in two ways:

- Cloud Hosting (the providing is not free. A grid of pricing is available [here](https://matomo.org/pricing/?ref=blog.lsonline.fr))
- Self-Hosted with installation (free - some technical knowledge are required)

> \[note\]**Note**  
>  
> See [On-Premise/Cloud hosting comparison table](https://matomo.org/what-is-on-premise/?ref=blog.lsonline.fr) for more information

### Set up Docker Matomo server

Since I do not have several servers on hand, I am using Docker containers to have several services, including Matomo that provides a Docker Image that can be quickly configured and implemented into your environment.

Below, my local Docker composes file that I use for my tests:

```docker
version: '3.7'

services:
  mysql:
    image: mysql:5.7.25
    environment:
      - MYSQL_ROOT_PASSWORD=password01
    restart: always

  phpmyadmin:
    image: phpmyadmin/phpmyadmin:latest
    depends_on:
      - mysql
    ports:
      - "9010:80"
      - "9011:443"
    environment:
      - PMA_HOST=mysql
    restart: always

  matomo:
    image: bitnami/matomo:latest
    depends_on:
      - mysql
    ports:
      - "9020:80"
      - "9021:443"
    environment:
      - MARIADB_HOST=mysql
      - MARIADB_ROOT_PASSWORD=password01
      - MYSQL_CLIENT_CREATE_DATABASE_NAME=matomo
      - MYSQL_CLIENT_CREATE_DATABASE_USER=matomo
      - MYSQL_CLIENT_CREATE_DATABASE_PASSWORD=password01
      - MATOMO_DATABASE_NAME=matomo
      - MATOMO_DATABASE_USER=matomo
      - MATOMO_DATABASE_PASSWORD=password01
      - MATOMO_USERNAME=matomo
      - MATOMO_HOST=matomo
      - MATOMO_PASSWORD=password01
      - MATOMO_EMAIL=matomo@localhost.fr
    restart: always

networks:
  default:
```

### Set up Matomo client (SharePoint Framework extension)

I wrote two scripts that will allow you to easily implement the solution💡

#### Prerequisites

1. Matomo Analytics **Tracking Site ID**
2. Tenant App Catalog or Site Collection App Catalog:  
  - Configure your Tenant App Catalog: [https://docs.microsoft.com/en-us/sharepoint/use-app-catalog](https://docs.microsoft.com/en-us/sharepoint/use-app-catalog?ref=blog.lsonline.fr)
  - Configure your Site Collection App Catalog *(optional)*: [https://docs.microsoft.com/en-us/sharepoint/dev/general-development/site-collection-app-catalog](https://docs.microsoft.com/en-us/sharepoint/dev/general-development/site-collection-app-catalog?ref=blog.lsonline.fr)
3. If you choose to use the **PowerShell** solution, you will need to install the **[PnP PowerShell module](https://github.com/SharePoint/PnP-PowerShell/releases?ref=blog.lsonline.fr)**
4. If you choose to use **any platform** solution, you will need **Bash** and **[Office365-CLI](https://pnp.github.io/office365-cli?ref=blog.lsonline.fr)**

> \[note\]**Note**  
>  
> The user account that will perform the following actions has to have sufficient permissions on the target sites collection and on the App Catalog.

#### PowerShell (Windows only)

1. Download the **PowerShell solution** from the [repository](https://gitlab.lsonline.fr/SharePoint/sp-dev-fx-webparts/matomo/-/releases?ref=blog.lsonline.fr)

![](https://blog.lsonline.fr/content/images/2019/05/LsOnline-Matomo-ps-release-1.jpg)

PowerShell script release

1. Unzip the package
2. From your *PowerShell terminal*, connect to your target site collection with [Connect-PnPOnline](https://docs.microsoft.com/en-us/powershell/module/sharepoint-pnp/connect-pnponline?ref=blog.lsonline.fr) cmdlet

```powershell
Connect-PnPOnline -Url https://contoso.sharepoint.com/sites/target-site

```

1. Launch the `setup.ps1`

```powershell
.\setup.ps1 -siteUrl https://contoso.sharepoint.com/sites/target-site -trackingUrl https://matomo.my-domain.com -trackingSiteId '2'

```

> \[note\]Note  
>  
> 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**  
>  
> In this example, the package is deployed to the Site Collection App Catalog. You have other options illustrated into the [README.md](https://gitlab.lsonline.fr/SharePoint/sp-dev-fx-webparts/matomo/blob/master/README.md?ref=blog.lsonline.fr), that allow you to manage the deployment.

#### Any platform (Linux, Mac OS, Windows)

1. Download **any platform** solution from the [repository](https://gitlab.lsonline.fr/SharePoint/sp-dev-fx-webparts/matomo/-/releases?ref=blog.lsonline.fr)

![](https://blog.lsonline.fr/content/images/2019/05/LsOnline-Matomo-bash-release-1.jpg)

Bash script release

1. Unzip the package
2. Allow `setup.sh` script execution

```bash
chmod +x ./setup.sh

```

1. From your *Bash terminal*, connect to your target site collection with [spo login](https://pnp.github.io/office365-cli/cmd/spo/login/?ref=blog.lsonline.fr) cmdlet

```bash
spo login https://contoso.sharepoint.com/sites/target-site

```

1. Launch the `setup.sh`

```bash
./setup.sh --siteUrl https://contoso.sharepoint.com/sites/target-site --trackingUrl https://matomo.my-domain.com --trackingSiteId '2'

```

> \[note\]Note  
>  
> In this example, the package is deployed to the Site Collection App Catalog. You have other options illustrated into the [README.md](https://gitlab.lsonline.fr/SharePoint/sp-dev-fx-webparts/matomo/blob/master/README.md?ref=blog.lsonline.fr), that allow you to manage the deployment

Pretty simple, isn't it?

### Samples of results

![](https://blog.lsonline.fr/content/images/2019/05/LsOnline-SPFx-Matomo-ResultVisitsLog-1.jpg)

![](https://blog.lsonline.fr/content/images/2019/05/LsOnline-SPFx-Matomo-ResultTransitions-1.jpg)

![](https://blog.lsonline.fr/content/images/2019/05/LsOnline-SPFx-Matomo-ResultSearchKeywords-1.jpg)

![](https://blog.lsonline.fr/content/images/2019/05/LsOnline-SPFx-Matomo-ResultRealTimeMaps-1.jpg)

Some results of Matomo Analytics with SharePoint Framework

Enjoy 🥳
  
  
Hoping this post will help you 🚀