Skip to content

Commit

Permalink
[i1020] - correct ga4 typo that prevents download tracking
Browse files Browse the repository at this point in the history
In Google Analytics we were missing the tracking for download events. This is because there was a typo in content_id.

Issue:
- scientist-softserv/palni-palci#1020
  • Loading branch information
ShanaLMoore committed Sep 3, 2024
1 parent b02cd98 commit 4cdb9de
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions app/assets/javascripts/hyrax/analytics_events.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,11 @@ $(document).on('click', '#file_download', function(e) {
window.trackingTags.analytics().push([trackingTags.trackEvent(), 'work-in-collection', 'work-in-collection-download', collection]);
});
} else {
gtag('event', 'file-set-download', { 'content-type': 'file-set', 'content-id': $(this).data('label')})
gtag('event', 'file-set-in-work-download', { 'content-type': 'file-set-in-work', 'content-id': $(this).data('work-id')})
gtag('event', 'file-set-download', { 'content-type': 'file-set', 'content_id': $(this).data('label')})
gtag('event', 'file-set-in-work-download', { 'content-type': 'file-set-in-work', 'content_id': $(this).data('work-id')})
$(this).data('collection-ids').forEach(function (collection) {
gtag('event', 'file-set-in-collection-download', { 'content-type': 'file-set-in-collection', 'content-id': collection })
gtag('event', 'work-in-collection-download', { 'content-type': 'work-in-collection', 'content-id': collection })
gtag('event', 'file-set-in-collection-download', { 'content-type': 'file-set-in-collection', 'content_id': collection })
gtag('event', 'work-in-collection-download', { 'content-type': 'work-in-collection', 'content_id': collection })
});
}
});

0 comments on commit 4cdb9de

Please sign in to comment.