Wait for matomo request to finish (Callback/Event?)

Is there a callback I can use to see if trackPageView has been executed?
Reason: I am changing the url to remove GET-Parameters such as fbclid, but I don’t want to remove them before the page view has been tracked. If I remove them before, then Matomo will track the “clean” url.

Thanks!

The third parameter of trackPageView should be exactly this:

1 Like

Thanks! I found this as well, but how is it possible to use this with

_paq.push(['trackPageView']);

I tried the following, which doesn’t work though

_paq.push(['trackPageView', undefined, function() { console.log("hi"); }]);
_paq.push(['trackPageView', { callback: foobar }]); // also doesnt work

Lukas mentioned the callback as the 3rd argument, but in your 1st example you used it as the 2nd one…

2 Likes

Ahh, of course, ‘trackPageView’ is not the 1st parameter :open_mouth:
Thanks guys!

1 Like