Fix resource download event tracking js

This commit is contained in:
Sean Hammond 2013-04-15 19:55:31 +02:00
parent b9879ad28d
commit 6d7aa555c3
1 changed files with 2 additions and 3 deletions

View File

@ -6,10 +6,9 @@ this.ckan.module('google-analytics', function(jQuery, _) {
},
initialize: function() {
jQuery('a.resource-url-analytics').on('click', function() {
var resource_prefix = this.options.googleanalytics_resource_prefix;
var resource_url = resource_prefix + encodeURIComponent(jQuery(this).prop('href'));
var resource_url = encodeURIComponent(jQuery(this).prop('href'));
if (resource_url) {
_gaq.push(['_trackPageview', resource_url]);
_gaq.push(['_trackEvent', 'Resource', 'Download', resource_url]);
}
});
}