Floating-Dartists / matomo-tracker

A fully cross-platform wrap of the Matomo tracking client for Flutter, using the Matomo API.
https://pub.dev/packages/matomo_tracker
MIT License
26 stars 28 forks source link

Posting a lot of duplicate actions #178

Closed quadbyte closed 4 weeks ago

quadbyte commented 4 weeks ago

Describe the bug Package is posting a bunch of duplicates events.

To Reproduce

Expected behavior The package should post a event for every call to trackEvent()

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context This is not a server issue, as we use the same Matomo instance with other languages (C#) and have zero issues. matomo_repro.zip 2024-10-17-102837_hyprshot

TesteurManiak commented 4 weeks ago

Can you provide some of the logs you get with:

MatomoTracker.instance.initialize(verbosityLevel: Level.all);

When events are dequeued to be sent in a batch, there should be some logs with the length of the queue (e.g: "Processing queue 1"). This will help us to understand if it is because the event queue is not emptied properly.

quadbyte commented 4 weeks ago

Thanks for the reply.

Entries are never dequeued, due to ClientException (ClientException: XMLHttpRequest error Which is super odd, as there is no trace of error in the server's log (Running Matomo via nginx)

I'm suspecting some CORS sheenanigans.

[Matomo] Processing queue 1 [Matomo] -> {requests: [?idsite=46&rec=1&new_visit=1&ca=1&url=http%3A%2F%2Flocalhost%3A36953%2F&_id=4395e9a355184393&rand=23236901&apiv=1&res=1266x1290&h=16&m=7&s=13&cookie=1&ua=Mozilla%2F5.0+%28X11%3B+Linux+x86_64%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F130.0.0.0+Safari%2F537.36&lang=en_GB&e_c=Main&e_a=Launched&cdt=2024-10-17T16%3A07%3A13.175Z]} [Matomo] <- ClientException: XMLHttpRequest error., uri=https://REDACTED.com/matomo.php [Matomo] ClientException (ClientException: XMLHttpRequest error., uri=https://REDACTED.com/matomo.php) [Matomo] Processing queue 1

TesteurManiak commented 4 weeks ago

If there's an error with the http request then it's normal that the queue is not emptied. The problem might be on your side if the request doesn't succeed. I'll close this issue for now, feel free to reopen it or open a new one if you're able to confirm that the problem comes from the package.