The more I use matomo, the more missing features I find in this integration (sorry for that π )
Since I must track some events before redirecting the use to another website, it's crucial to wait for matomo to be done with the tracking request. Matomo supports a callback param for this case
https://github.com/matomo-org/matomo/blob/fa66bc580852c2b098ba5ea7f7ba57048f258714/js/piwik.js#L6507
Unfortunately your integration doesn't care about this and doesn't provide a way to pass a callback.
That should be changed, precisely ALL additional data should be supported meaning
- customTitle (trackPageView)
- customData (trackPageView & trackEvent)
- callback (trackPageView & trackEvent)