Matomo (formerly Piwik) works well behind all proxies, load balancers, which are used to make websites faster, secure and more resilient. If you wish to use Matomo on your server hosted behind Cloudflare:
1. Restore the real IP addresses of visitors to populate through to logs, stats, and more. Either restore these IP addresses yourself or ask your hosting provider to do it for you. If this is not installed you will only see the default IP addresses that belong to Cloudflare in your Matomo visitor logs.
2. In your Cloudflare domain, go to Speed > Optimization and make sure that Rocket Loader is set to Off.