diff --git a/src/components/CopyToClipboard/CopyToClipboard.vue b/src/components/CopyToClipboard/CopyToClipboard.vue index 9aff115..d36372e 100644 --- a/src/components/CopyToClipboard/CopyToClipboard.vue +++ b/src/components/CopyToClipboard/CopyToClipboard.vue @@ -94,8 +94,10 @@ export default { if (copiedSuccessfully) { this.textLabel = LABEL_AFTER; + this.$emit('copied', {status: 'success'}); } else { this.textLabel = 'Error trying to copy to clipboard!'; + this.$emit('copied', {status: 'error'}); } }, resetSettings: function () { diff --git a/src/components/Tooltip/AnnotationPopup.vue b/src/components/Tooltip/AnnotationPopup.vue index 24e65c0..962d35d 100644 --- a/src/components/Tooltip/AnnotationPopup.vue +++ b/src/components/Tooltip/AnnotationPopup.vue @@ -30,7 +30,7 @@
Feature Annotations
- +
@@ -68,7 +68,7 @@ @show-related-connectivities="showRelatedConnectivities" /> - +
  • @@ -79,7 +79,7 @@ @show-related-connectivities="showRelatedConnectivities" /> - +
  • @@ -154,6 +154,15 @@ export default { methods: { showRelatedConnectivities: function (resource) { this.$emit('show-reference-connectivities', resource); + + const taggingData = { + 'event': 'interaction_event', + 'event_name': `portal_maps_show_related_connectivities`, + 'category': resource, + 'location': 'map_connectivity_references', + }; + + this.$emit('trackEvent', taggingData); }, formatReferences: function (references) { const nonPubMedReferences = this.extractNonPubMedReferences(references); @@ -546,6 +555,42 @@ export default { throw new Error(error); } }, + onCopied: function (event, reference) { + let category = 'Reference List'; + let doi = ''; + let citationType = this.citationType; + + if (reference) { + category = reference.resource; + doi = reference.type === 'doi' ? reference.id : ''; + } else { + const combinedResources = [ + ...this.pubMedReferences, + ...this.openLibReferences, + ...this.isbnDBReferences + ]; + const formattedResources = combinedResources.map((resource) => { + if (resource.type === 'doi') { + return resource.id; + } else { + return resource.resource; + } + }); + + category = formattedResources.join(', '); + } + + const taggingData = { + 'event': 'interaction_event', + 'event_name': `portal_maps_copy_citation`, + 'category': category, + 'doi': doi, + 'citation_type': citationType, + 'location': 'map_connectivity_references', + }; + + this.$emit('trackEvent', taggingData); + }, }, }