diff --git a/ckanext/googleanalytics/plugin.py b/ckanext/googleanalytics/plugin.py index 32e912a..6339ae1 100644 --- a/ckanext/googleanalytics/plugin.py +++ b/ckanext/googleanalytics/plugin.py @@ -1,3 +1,4 @@ +import ast import logging import urllib import commands @@ -66,8 +67,8 @@ class GoogleAnalyticsPlugin(p.SingletonPlugin): self.googleanalytics_id = config['googleanalytics.id'] self.googleanalytics_domain = config.get( 'googleanalytics.domain', 'auto') - self.googleanalytics_fields = config.get( - 'googleanalytics.fields', '{}') + self.googleanalytics_fields = ast.literal_eval(config.get( + 'googleanalytics.fields', '{}')) self.googleanalytics_javascript_url = h.url_for_static( '/scripts/ckanext-googleanalytics.js') @@ -273,6 +274,6 @@ class GoogleAnalyticsPlugin(p.SingletonPlugin): ''' data = {'googleanalytics_id': self.googleanalytics_id, 'googleanalytics_domain': self.googleanalytics_domain, - 'googleanalytics_fields': self.googleanalytics_fields} + 'googleanalytics_fields': str(self.googleanalytics_fields)} return p.toolkit.render_snippet( 'googleanalytics/snippets/googleanalytics_header.html', data)