How to use the Log Analytics script to provide Web Analytics reports to your customers.

Imagine that you are a web hosting company with a few hundred customers. Many web hosts would like to offer modern, beautiful, powerful, Free/Libre web analytics to their customers. This is easy to do with Matomo (Piwik). This tutorial explain how to use the Log Analytics script to provide Web Analytics reports to your customers.

How to setup Log File Analytics with Matomo for a Web Hosting Company?

  1. install Matomo on a powerful dedicated server, rotate all web server logs to a centralized log server.
  2. run the Matomo import script daily soon after midnight to import all of the logs from the day before
    • the script can run with

      to automatically add new websites to Matomo for new hostnames not yet known to Matomo

    • or you can run using

      to record log lines with an “unknown” URL hostname to a specific catch-all website in Matomo

  3. using the Matomo API, you can a) create a new user and b) assign permissions for this user to view one or several websites. Using the Manage Users API, this would be as easy as 2 HTTP requests.
    • Typically, a developer or sysadmin at your company would make this change in your existing customer signup workflow to add these few http requests
    • the same user can have access to several websites in Matomo and we recommend that you use this feature to make sure all your customers access all of their websites’ statistics under one account. And don’t forget, you can enjoy the All Websites Dashboard quick view of all of their websites
  4. at this point, your users should be able to access Matomo reports for their own websites and enjoy all of Matomo’s great functionality
  5. as an extra step, you could, for example, create a custom PDF or HTML report sent daily/weekly/monthly to your customers.
    The report could use your company logo and include only the reports you specified when creating the report (check the Scheduled Reports API Doc)

All these steps can be easily automated with the powerful Matomo APIs: you would never have to login and administrate Matomo directly.

If you have more suggestions or other use cases to submit for this page, please let us know!