From eae43f89749e7ca15664a0f716d7d9f6da0f7c19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bruno=20Ryb=C3=A1rsky?= Date: Sat, 1 Apr 2023 19:53:59 +0200 Subject: [PATCH] enhance tracking --- index.js | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) 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") }); + } }