Merge branch 'master' of github.com:okfn/ckanext-googleanalytics
This commit is contained in:
commit
f2c0763fed
|
@ -5,10 +5,12 @@ this.ckan.module('google-analytics', function(jQuery, _) {
|
||||||
googleanalytics_resource_prefix: ''
|
googleanalytics_resource_prefix: ''
|
||||||
},
|
},
|
||||||
initialize: function() {
|
initialize: function() {
|
||||||
resource_prefix = this.options.googleanalytics_resource_prefix;
|
|
||||||
jQuery('a.resource-url-analytics').on('click', function() {
|
jQuery('a.resource-url-analytics').on('click', function() {
|
||||||
resource_url = resource_prefix + encodeURIComponent(this.href);
|
var resource_prefix = this.options.googleanalytics_resource_prefix;
|
||||||
|
var resource_url = resource_prefix + encodeURIComponent(jQuery(this).prop('href'));
|
||||||
|
if (resource_url) {
|
||||||
_gaq.push(['_trackPageview', resource_url]);
|
_gaq.push(['_trackPageview', resource_url]);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,6 +52,7 @@ class GoogleAnalyticsPlugin(p.SingletonPlugin):
|
||||||
self.track_events = converters.asbool(
|
self.track_events = converters.asbool(
|
||||||
config.get('googleanalytics.track_events', False))
|
config.get('googleanalytics.track_events', False))
|
||||||
|
|
||||||
|
if not converters.asbool(config.get('ckan.legacy_templates', 'false')):
|
||||||
p.toolkit.add_resource('fanstatic_library', 'ckanext-googleanalytics')
|
p.toolkit.add_resource('fanstatic_library', 'ckanext-googleanalytics')
|
||||||
|
|
||||||
def update_config(self, config):
|
def update_config(self, config):
|
||||||
|
|
Loading…
Reference in New Issue