diff --git a/index.js b/index.js index 4d20b09..c028cf0 100644 --- a/index.js +++ b/index.js @@ -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") }); + } }