From fbf30d3fa6757825ef9d8ae89491d96e4c9cf3dd Mon Sep 17 00:00:00 2001 From: alan-wu Date: Thu, 16 May 2024 15:11:16 +1200 Subject: [PATCH] Fix a small issue with tagging on gallery click --- src/components/SplitFlow.vue | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/components/SplitFlow.vue b/src/components/SplitFlow.vue index 4d0473ff..5a395b9a 100644 --- a/src/components/SplitFlow.vue +++ b/src/components/SplitFlow.vue @@ -191,13 +191,14 @@ export default { }, trackGalleryClick: function (action) { const categoryValues = []; - const { label, type, datasetId, resource } = action; + const { label, type, datasetId, discoverId, resource } = action; let filePath = ''; + let id = datasetId ? datasetId : discoverId; if (label) categoryValues.push(label); if (type) categoryValues.push(type); - if (datasetId) categoryValues.push('(' + datasetId + ')'); + if (datasetId) categoryValues.push('(' + id + ')'); if (resource) { - filePath = resource.share_link; + filePath = typeof resource === 'string' ? resource : resource.share_link; } // GA Tagging @@ -207,7 +208,7 @@ export default { 'event_name': 'portal_maps_gallery_click', 'category': categoryValues.join(' '), 'location': 'map_sidebar_gallery', - 'dataset_id': datasetId ? datasetId + '' : '', // change to string format + 'dataset_id': id ? id + '' : '', // change to string format 'file_path': filePath, }); },