This was asked a while ago, yet I feel this is very relevant not just to me but to anyone who adds click events to buttons that are links or form buttons (a task that’s very common). I believe that without an appropriate callback function there’s a lot of lost data.
So I’d like to re-ask this question:
- Is there a callback function in Piwik for events? (Assuming there isn’t, can we add that to the next release please!)
- If not, could someone give me an idea how I could write it either for my front-end or as a plugin for Piwik? As I understand Piwik tracks using a pixel so this should be as simple (or as complex) as firing an event once that pixel is loaded by the browser.
Please check this Pull request which maybe implements what you need: Add callback ability to trackEvent by er314 · Pull Request #10337 · matomo-org/piwik · GitHub
if it does not, can you leave a comment on this pull request, so we can improve it ?
This is it! I’ll test it and let you know tonight. Thank you.
OK this wasn’t “tonight” at all, not even close. Sorry about that.
function logEvent(category, action, name, value, customData, callback)
Callback is where you add your function.
It would be a nice thing to read about this feature in the official documentation. Here it has only an experimental character.