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 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 Piwik for a Web Hosting Company?

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

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

    • or you can run using
      --idsite-fallback

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

  3. using the Piwik 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 Piwik 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 Piwik reports for their own websites and enjoy all of Piwik’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 Piwik APIs: you would never have to login and administrate Piwik directly.

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

If you are using Piwik in your company and it saves you thousands of dollars in licenses, please consider making a donation to the team or sponsoring a new feature. We rely on our partners and supporters for ongoing Piwik development.