From ac23184baa1e70339f1a49945d27f2b654c828ea Mon Sep 17 00:00:00 2001 From: James McKinney <26463+jpmckinney@users.noreply.github.com> Date: Wed, 6 Nov 2024 22:43:15 -0500 Subject: [PATCH] feat: Track download and contact links --- data_registry/templates/detail.html | 8 +++++++- data_registry/templates/includes/files.html | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/data_registry/templates/detail.html b/data_registry/templates/detail.html index 175e78cf..51b5e774 100644 --- a/data_registry/templates/detail.html +++ b/data_registry/templates/detail.html @@ -58,6 +58,12 @@ toggleable.insertAdjacentElement('beforebegin', insert) toggleable.setAttribute('hidden', '') }) + +document.querySelectorAll('a[download]').forEach(trackable => { + trackable.addEventListener('click', event => { + fathom.trackEvent(`download ${trackable.dataset.event}`) + }) +}) {% endblock %} @@ -354,7 +360,7 @@