MatomoTracker.php With Local Install (No URL)

I have matomo installed on the same domain as the main website. To have absolutely optimal tracking, I would like to post visits using php to this matomo install, however it appears the only option with MatomoTracker.php is to include a URL - so in essence it would be referencing itself.

Is it possible to make calls locally without having to use a remote url?


What is the issue if your Website (in PHP) calls the Matomo tracking (HTTP) API to send requests there?

This has the huge advantage that all tracking methods are using the same API and therefore work more reliably.

There is a clear performance hit if the server has to essential do an external call to itself (somewhat avoidable using IP etc to cut down on resolution).

It’s not a big deal, just something that I had hoped might be supported.



I get your point, there is definitely some overhead in making a HTTP request.

WP-Matomo (the wordpress plugin) supports to directly call Matomo in PHP and I think this is the code responsible for it:

But I am not entirely sure if loading all Matomo code in your PHP application is going to be that much faster and the overhead is probably minimal in comparison to things like MySQL queries, device detection (lot’s of regex) and geolocation.