Need an internal system of collection statistics, what do you recommend?

Good afternoon.
Please recommend a system for the collection of statistics of visits to your website - an analogue of Yandex.Metric and Google Analytics.
Requirements: the system must be internal (Ala the library), or is installed parallel to the observed site.
The system should work under PHP, PostgreSQL and MySQL.
The external system of statistics collection is not suitable. Watched Piwik, but it with PostgreSQL quite sad.
July 8th 19 at 15:53
2 answers
July 8th 19 at 15:55
https://github.com/sri-soham/piwik/blob/master/cor...
It's not so sad... Like something is....
this adapter is in the main package... - Newell_Lueilwitz61 commented on July 8th 19 at 15:58
: Have you tried to work through it? - Kyleigh_Hills commented on July 8th 19 at 16:01
: through what? using the PostgreSQL driver? there is no try, only information from the FAQ - Newell_Lueilwitz61 commented on July 8th 19 at 16:04
: then try it, should all work. - Kyleigh_Hills commented on July 8th 19 at 16:07
July 8th 19 at 15:57
OpenStat watched? Or purely a matter of principle that data is never left on the side?

PS.
Was just thinking recently about writing a system for the collection of internal metrics that track the metric using a General purpose hard. For example: how many clicks were on a specific commodity or closing of a particular UI element, how many users have won/lost in any competition since randomized, etc.
What to record in server-side logic, and client part.

Find more questions by tags PHPMySQLPostgreSQL