To include Matomo Tracking Code into your SharePoint Online sites, you can use the following app: Web Analytics Integration. It lets you insert the Matomo (Piwik) web analytics code within your SharePoint online websites and learn more about the productivity of your employees and overall user engagement.

If you’re looking for instructions for SharePoint On-Premises Farm, see our FAQ about including Matomo Tracking in your Master Page on SharePoint On-Premises