enhance tracking

This commit is contained in:
Bruno Rybársky 2023-04-01 19:53:59 +02:00
parent c997e6581e
commit eae43f8974
No known key found for this signature in database
GPG Key ID: DFE2C061EF985CD4

@ -305,7 +305,12 @@ function drag(ev) {
ev.dataTransfer.setData("classy", ev.target.classList);
let datacode = $(ev.target).attr("datacode");
document.getElementById("audplay"+ datacode).play();
umami.trackEvent('Dragged object', { type: 'dragged' });
if (ev.target.classList.contains("imagevec")){
umami.trackEvent('Dragged sign', { type: 'draggedsign', datacode: ev.target.getAttribute("datacode") });
}
else if (ev.target.classList.contains("lettervec")){
umami.trackEvent('Dragged letter', { type: 'draggedletter', datacode: ev.target.getAttribute("datacode") });
}
}
function drop(ev) {
@ -334,7 +339,12 @@ function drop(ev) {
let returnto = ev.dataTransfer.getData("returnto");
//$('[returntarget="' + returnto + '"]').html(htmldata);
}
umami.trackEvent('Dropped object', { type: 'dropped' });
if (classy.includes("imagevec")){
umami.trackEvent('Dropped sign', { type: 'droppedsign', datacode: ev.target.getAttribute("datacode") });
}
else if (classy.includes("lettervec")){
umami.trackEvent('Dropped letter', { type: 'droppedletter', datacode: ev.target.getAttribute("datacode") });
}
}
function droptrash(ev) {
@ -343,7 +353,13 @@ function droptrash(ev) {
$('[cntdrag="' + cntdragx + '"]').remove();
let htmldata = ev.dataTransfer.getData("text");
let returnto = ev.dataTransfer.getData("returnto");
let classy = ev.dataTransfer.getData("classy");
$('[returntarget="' + returnto + '"]').html(htmldata);
umami.trackEvent('Dragged object into trashcan', { type: 'droptrash' });
if (classy.includes("imagevec")){
umami.trackEvent('Dragged sign into trashcan', { type: 'dropsigntrash', datacode: ev.target.getAttribute("datacode") });
}
else if (classy.includes("lettervec")){
umami.trackEvent('Dragged letter into trashcan', { type: 'droplettertrash', datacode: ev.target.getAttribute("datacode") });
}
}