Closed JohannSchramm closed 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.
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.
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.
These changes add a
sendBatch(List<MatomoEvent>)
function to theMatomoDispatcher
, 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 theMatomoEvent
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.