Merge branch 'master' of github.com:okfn/ckanext-googleanalytics

This commit is contained in:
Sean Hammond 2012-12-20 21:33:40 +00:00
commit f2c0763fed
2 changed files with 8 additions and 5 deletions

View File

@ -5,10 +5,12 @@ this.ckan.module('google-analytics', function(jQuery, _) {
googleanalytics_resource_prefix: ''
},
initialize: function() {
resource_prefix = this.options.googleanalytics_resource_prefix;
jQuery('a.resource-url-analytics').on('click', function(){
resource_url = resource_prefix + encodeURIComponent(this.href);
_gaq.push(['_trackPageview', resource_url]);
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'));
if (resource_url) {
_gaq.push(['_trackPageview', resource_url]);
}
});
}
}

View File

@ -52,7 +52,8 @@ class GoogleAnalyticsPlugin(p.SingletonPlugin):
self.track_events = converters.asbool(
config.get('googleanalytics.track_events', False))
p.toolkit.add_resource('fanstatic_library', 'ckanext-googleanalytics')
if not converters.asbool(config.get('ckan.legacy_templates', 'false')):
p.toolkit.add_resource('fanstatic_library', 'ckanext-googleanalytics')
def update_config(self, config):
'''Change the CKAN (Pylons) environment configuration.