Hello!
In our website we have an upload documents page where the user can upload documents one by one or multiple documents at the same time.
What I would like to do is to send two custom events. The first event should be “First Document Uploaded” and the second event should be “All required documents uploaded”.
The problem starts by the time user decides to upload all the documents together, because I should send two events at the same time. Matomo confuses the event details.
Here is my code:
function mtm_event(args){
var _mtm = window._mtm = window._mtm || [];
_mtm.push({'mtm.startTime': (new Date().getTime()), 'event': 'mtm.Start'});
var _mtmData = {'event': 'UniSIS.'+args.action, 'mtm.category':args.category, 'mtm.action': args.action, 'mtm.name':args.name};
_mtm.push(_mtmData);
console.log(_mtm);
}
On the Data Layer tab of the Matomo debugger, on the “Content after this event” section, both events on Category, Name and Action have the data of the second event that is pushed. That means that the first event gets the event details of the second one.
As you can see in the code above, I have used a console.log to print the _mtm . On the console it looks perfect! I get the event details correct.
If I add a setTimeOut before pushing the second event, the problem does not occur.
Is this a bug of Matomo? Could you please advice me how to fix this?
Thank you in advance!
2 posts - 2 participants