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

Add support for Matomo Bulk Tracking REST API #36

Closed JohannSchramm closed 1 year ago

JohannSchramm commented 1 year ago

These changes add a sendBatch(List<MatomoEvent>) function to the MatomoDispatcher, which sends the entire queue using only one HTTP POST request, as specified in the Matomo API documentation.

Additionally I have fixed the error mentioned in #33, by saving the currentScreenId in the MatomoEvent itself. Previously only the latests screen id was used in all batched requests, which resulted in Matomo assuming that all batched tracking events were performed on the same screen.

TesteurManiak commented 1 year ago

Thanks for your contribution, the code looks good to me, if @MeixDev and/or @Pierre-Monier can take a look too to ensure I didn't miss something I'll be glad to merge this PR.

Pierre-Monier commented 1 year ago

I think that it might bring some value to the end user to add some logs. But it will be better if we create a separate issue for this and think about the best way of doing it.

JohannSchramm commented 1 year ago

I agree that logging should be something to look at in a separate issue, as currently (before and after this PR) all requests get logged, which might be annoying.

This PR however, does not change the way logging was already handled by this package at all. I originally changed the way how the logger was referenced in the dispatcher in a previous commit, although I have reverted this change now to be as close to the original code as possible.

I have signed my commits and this PR should be ready to merge now.