Simple PHP tracking

Hello,

I found piwik as an alternative to analytics from Google, and one of the things I like from Piwik is the fact that it offers tracking alternatives than Javascript. I need to avoid javascript to get better page speeds by reducing external JS resources, that’s why I thought about PHP.
However, I’m not a php programmer and I don’t know how to customize the PHP code for tracking.

What I need is simple: I run a big dedicated server and I need to insert some php tracking code inside my footer.php of each blog I have, I just need to have common features like uniq visitors, pageviews, seach keywords and so on.

Can anyone please share a generic PHP tracking code for that?

Thanks

see: Tracking API - Analytics Platform - Matomo