Matomo is one of the best alternative (in terms of ease of implementation and basic features, not in terms of advanced features) in Europe for GDRP compliant analytics solution 🚀.
Matomo comes in two flavours :
- Cloud Hosting (prices here – with commercial plugins included)
- Self-Hosted with manuel installation (open source/free of licence cost – no commercial plugins included)
Once you have your Matomo environment ready, take the train :
Prerequisites
- Create your website in Matomo and get your « tracking site ID »
- Check your account have the right permission to add a solution to your Tenant App Catalog (if you deploy to your tenant app catalog => https://docs.microsoft.com/en-us/sharepoint/use-app-catalog) or in your Site collection App Catalog (if you deploy your tracking custom action to a site collection, or on a per site collection basis => https://docs.microsoft.com/en-us/sharepoint/dev/general-development/site-collection-app-catalog)
- Install Pnp PowerShell by following these steps : Installing PnP PowerShell | PnP PowerShell
- If you need to upgrade your Pnp Powershell, please find instructions here : Upgrading from the Legacy version of PnP PowerShell | PnP PowerShell
- Sometimes, an error « Import-Module : Could not load file or assembly ‘System.Management.Automation, Version=7.2.0.0 » could happens, please follow the steps in the accepted answer of this page : Import-Module : Could not load file or assembly ‘System.Management.Automation – Microsoft Q&A
- Download the addin and the setup script zip archive here (lastest is v1.1.0 now) : Releases · Microsoft SharePoint / SPFx / Matomo Analytics · GitLab (lsonline.fr). Feel freee to modify the source to add whatever features you need (ex : custom dimensions, …).
Add and setup the Matomo SPfx custom action
- Open a PowerShell console prompt
- Connect to your tenant with : Connect-PnPOnline -Url https://<your_tenant_name>.sharepoint.com -Interactive
- Interactive parameter is for MFA authentication. If you don’t use MFA, omit this parameter
- Unzip the zip archive previously downloaded in the prerequisites
- Execute the following command at the root of the unzipped folder : .\setup.ps1 -siteUrl https://<your-tenant_name>.sharepoint.com -trackingUrl https://matomo.mydomain.com -trackingSiteId ‘<my_tracking_site_id>’ -tenantSolutionDeployment
- In this case, I deployed on the entire tenant (all site collections). You can omit this parameter to deploy only on a site collection.
- Crack your favorite webbrowser, connect to your Matomo instance, your SharePoint is already recording user actions.
Happy analytics 👍😎