diff --git a/ckanext-hdx_package/ckanext/hdx_package/helpers/analytics.py b/ckanext-hdx_package/ckanext/hdx_package/helpers/analytics.py index 99027a8c21..e3cf349905 100644 --- a/ckanext-hdx_package/ckanext/hdx_package/helpers/analytics.py +++ b/ckanext-hdx_package/ckanext/hdx_package/helpers/analytics.py @@ -73,6 +73,7 @@ def new_resource_download(self, id, resource_id, filename=None): mp = mixpanel.Mixpanel(config.get('hdx.mixpanel.token')) event_dict = { "resource name": resource_dict.get('name'), + "resource id": resource_dict.get('id'), "dataset name": dataset_dict.get('title'), "dataset id": dataset_dict.get('id'), "org name": dataset_dict.get('organization', {}).get('name'), diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/google-analytics.js b/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/google-analytics.js index ebef8ae318..89cb24188e 100644 --- a/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/google-analytics.js +++ b/ckanext-hdx_theme/ckanext/hdx_theme/fanstatic/google-analytics.js @@ -101,6 +101,7 @@ $(function setUpSearchTracking() { function setUpResourcesTracking() { $('.ga-download').on('click', function () { var rTitle = $(this).find(".ga-download-resource-title").text().trim(); + var rId = $(this).find(".ga-download-resource-id").text().trim(); // var dTitle = $(this).find(".ga-download-dataset-title").text().trim(); var dTitle = analyticsInfo.datasetName; ga('send', 'event', 'resource', 'download', rTitle + " (" + dTitle + ")"); @@ -108,6 +109,7 @@ $(function setUpSearchTracking() { mixpanel.track("resource download", { "resource name": rTitle, + "resource id": rId, "dataset name": dTitle, "dataset id": analyticsInfo.datasetId, "page title": analyticsInfo.pageTitle, diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/resource_read.html b/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/resource_read.html index be06791b88..f2fcd036df 100644 --- a/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/resource_read.html +++ b/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/resource_read.html @@ -62,7 +62,7 @@ #}  {{ _('Download') }} - {##} + {% endif %} diff --git a/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/snippets/resource_item.html b/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/snippets/resource_item.html index 52934f01b8..439fc7f21f 100644 --- a/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/snippets/resource_item.html +++ b/ckanext-hdx_theme/ckanext/hdx_theme/templates/package/snippets/resource_item.html @@ -73,7 +73,7 @@  {{ _('Download') }} - {##} + {% set button_id = 'social-btn-' + res.id %}