I have such a problem, I want to get statistics from my sites and I use Matomo for this.
I use Matomo v 3.11.0
I have sites on different servers, some use a web server on Apache + Nginx, others Nginx + PHP-FPM.
But for sites which use only Nginx as web server(Nginx + PHP-FPM) Matomo not tracking any data through the second method(API).
Can you explain how exactly you are using the API? Are you using one of the official libraries/SDKs? Do you send your own HTTP requests?
You could try enabling Tracking HTTP API: API Reference - Matomo Analytics (formerly Piwik Analytics) - Developer Docs - v3 to see why the API request is not saved in Matomo.
Thank you for reply and your advice.
I’ve found the problem, it was my fault.
By mistake I defined constant MATOMO_PROXY_FROM_ENDPOINT twice.
I enabled debugging and have found in console log following notice:
Notice: Constant MATOMO_PROXY_FROM_ENDPOINT already defined in /data/www/site.com/proxy.php on line 3
The notice error was in widget.php
$path = “piwik.php”;
include dirname(FILE) . ‘/proxy.php’;
proxy.php code was taken from here https://raw.githubusercontent.com/matomo-org/tracker-proxy/master/proxy.php with some customizations.
So in proxy.php and widget.php was defined the same constant MATOMO_PROXY_FROM_ENDPOINT.
I commented in widget.php this line of code:
and now it works fine.
Thank you very much.