Skip to content

Commit

Permalink
feat: Track download and contact links
Browse files Browse the repository at this point in the history
  • Loading branch information
jpmckinney committed Nov 7, 2024
1 parent 353273a commit ac23184
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
8 changes: 7 additions & 1 deletion data_registry/templates/detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
})
})
</script>
{% endblock %}

Expand Down Expand Up @@ -354,7 +360,7 @@ <h3>CSV</h3>
</div>
</div>
<div class="col-md-auto">
<a href="mailto:[email protected]?{% feedback_query_string_parameters %}" target="_blank" class="hstack link-white">
<a href="mailto:[email protected]?{% feedback_query_string_parameters %}" onclick="fathom.trackEvent('contact')" target="_blank" class="hstack link-white">
{% include "includes/chevron_icon.html" with direction="right" classes="me-2" size="24" only %}{% translate "Contact Data Support Team" %}
</a>
</div>
Expand Down
4 changes: 2 additions & 2 deletions data_registry/templates/includes/files.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
<ul>
{% if files.full %}
<li>
<a href="{% url 'download' collection.id %}?name=full.{{ suffix }}" rel="nofollow" download>{% translate "All time" %}</a>
<a href="{% url 'download' collection.id %}?name=full.{{ suffix }}" rel="nofollow" data-event="{{ suffix }} full" download>{% translate "All time" %}</a>
<span class="text-muted small">{{ files.full|humanfilesize }}</span>
</li>
{% endif %}
{% for file in files.by_year|dictsortreversed:"year" %}
<li>
<a href="{% url 'download' collection.id %}?name={{ file.year }}.{{ suffix }}" rel="nofollow" download>{{ file.year }}</a>
<a href="{% url 'download' collection.id %}?name={{ file.year }}.{{ suffix }}" rel="nofollow" data-event="{{ suffix }} year" download>{{ file.year }}</a>
<span class="text-muted small">{{ file.size|humanfilesize }}</span>
</li>
{% empty %}
Expand Down

0 comments on commit ac23184

Please sign in to comment.