Skip to content

Commit

Permalink
#4228 Track resource id
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandru-m-g committed Jun 17, 2016
1 parent e454bea commit 5e2e93e
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,15 @@ $(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 + ")");
ga('send', 'event', 'dataset', 'resource-download', dTitle);

mixpanel.track("resource download", {
"resource name": rTitle,
"resource id": rId,
"dataset name": dTitle,
"dataset id": analyticsInfo.datasetId,
"page title": analyticsInfo.pageTitle,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
#}
<img src="/images/homepage/download.svg" alt=" {{ _('Download') }}" style="width: 14px;" />
<span class="ga-download-resource-title" style="display: none">{{ res.name }}</span>
{#<span class="ga-download-dataset-title" style="display: none">{{ c.package.title }}</span>#}
<span class="ga-download-resource-id" style="display: none">{{ res.id }}</span>
</a>
</li>
{% endif %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
<a href="{{ res.url }}" class="btn btn-secondary hdx-btn resource-url-analytics ga-download resource-btn resource-icon-btn" title="{{ _('Download') }}" tracking-type="{{res.url_type}}">
<img src="/images/homepage/download.svg" alt=" {{ _('Download') }}" />
<span class="ga-download-resource-title" style="display: none">{{ res.name }}</span>
{#<span class="ga-download-dataset-title" style="display: none">{{ pkg.title }}</span>#}
<span class="ga-download-resource-id" style="display: none">{{ res.id }}</span>
</a>

{% set button_id = 'social-btn-' + res.id %}
Expand Down

0 comments on commit 5e2e93e

Please sign in to comment.