We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Implement GA tracking of downloads
From Luis: 

_I've done some research about how to track the number of downloads in the website. We can track those events using Google Analytics as you suggested. There is a slight change of code that has to be implemented following Google Analytic's developer manual [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/events). It is a bit more refined than copying and pasting code, although at a glance it doesn't seem to be extremely complicated._


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `ckanext-metadata_fields/ckanext/metadata_fields/plugin.py`
Content:
```
1 '''
2 Created on Apr 10, 2014
3 
4 @author:alexandru-m-g
5 '''
6 import logging
7 
8 import ckan.plugins as plugins
9 import ckan.plugins.toolkit as tk
10 from routes.mapper import SubMapper
11 
12 import ckanext.metadata_fields.custom_validator as vd
13 import ckanext.metadata_fields.update as update
14 
15 def list_of_all_groups():
16     groups  = tk.get_action('group_list')(data_dict={'all_fields': True})
17     return groups
18 
19 
20 class HdxMetadataFieldsPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):
21     plugins.implements(plugins.IConfigurer, inherit=False)
22     plugins.implements(plugins.IRoutes, inherit=True)
23     plugins.implements(plugins.IDatasetForm, inherit=False)
24     plugins.implements(plugins.ITemplateHelpers)
25     plugins.implements(plugins.IActions)
26 
27     def update_config(self, config):
28         tk.add_template_directory(config, 'templates')
29 
30     def before_map(self, map):
31         with SubMapper(map, controller='ckanext.metadata_fields.dataset_controller:DatasetController') as m:
32             m.connect('add dataset', '/dataset/new', action='new')
33             m.connect('/dataset/{action}/{id}',
34                   requirements=dict(action='|'.join([
35                       'new_metadata',
36                       'new_resource',
37                       ])))
38         return map
39         
40     def is_fallback(self):
41         return True
42 
43     def package_types(self):
44         # default - no specific package type
45         return []
46 
47     def _modify_package_schema(self, schema):
48         
49         schema.update({
50                 'package_creator': [tk.get_validator('not_empty'),
51                     tk.get_converter('convert_to_extras')],
52                 'groups_list': [vd.groups_not_empty],
53             'caveats' : [tk.get_validator('ignore_missing'),
54                     tk.get_converter('convert_to_extras')],
55             'dataset_source' : [tk.get_validator('not_empty'),
56                     tk.get_converter('convert_to_extras')],
57             'dataset_date' : [tk.get_validator('ignore_missing'),
58                     tk.get_converter('convert_to_extras')],
59             'methodology' : [tk.get_validator('ignore_missing'),
60                     tk.get_converter('convert_to_extras')],
61             })
62 
63         return schema
64 
65 
66     def create_package_schema(self):
67         schema = super(HdxMetadataFieldsPlugin, self).create_package_schema()
68         schema = self._modify_package_schema(schema)
69         return schema
70 
71     def update_package_schema(self):
72         schema = super(HdxMetadataFieldsPlugin, self).update_package_schema()
73         schema = self._modify_package_schema(schema)
74         return schema
75 
76     def show_package_schema(self):
77         schema = super(HdxMetadataFieldsPlugin, self).show_package_schema()
78 
79         schema.update({
80             'package_creator': [tk.get_converter('convert_from_extras'),
81                 tk.get_validator('ignore_missing')],
82             'caveats' : [tk.get_converter('convert_from_extras'),
83                 tk.get_validator('ignore_missing')],
84             'dataset_source' : [tk.get_converter('convert_from_extras'),
85                 tk.get_validator('ignore_missing')],
86             'dataset_date' : [tk.get_converter('convert_from_extras'),
87                 tk.get_validator('ignore_missing')],
88             'methodology' : [tk.get_converter('convert_from_extras'),
89                 tk.get_validator('ignore_missing')],
90             })
91         return schema
92         
93     
94     def get_helpers(self):
95         return {'list_of_all_groups': list_of_all_groups}
96     
97     def get_actions(self):
98         return {'package_update': update.package_update}
99 
100 
101
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/ckanext-metadata_fields/ckanext/metadata_fields/plugin.py b/ckanext-metadata_fields/ckanext/metadata_fields/plugin.py
--- a/ckanext-metadata_fields/ckanext/metadata_fields/plugin.py
+++ b/ckanext-metadata_fields/ckanext/metadata_fields/plugin.py
@@ -47,6 +47,7 @@
     def _modify_package_schema(self, schema):
         
         schema.update({
+                'notes': [tk.get_validator('not_empty')], #Notes == description. Makes description required
                 'package_creator': [tk.get_validator('not_empty'),
                     tk.get_converter('convert_to_extras')],
                 'groups_list': [vd.groups_not_empty],
@@ -75,8 +76,8 @@
 
     def show_package_schema(self):
         schema = super(HdxMetadataFieldsPlugin, self).show_package_schema()
-
         schema.update({
+            'notes': [tk.get_validator('not_empty')], #Notes == description. Makes description required
             'package_creator': [tk.get_converter('convert_from_extras'),
                 tk.get_validator('ignore_missing')],
             'caveats' : [tk.get_converter('convert_from_extras'),

{"golden_diff": "diff --git a/ckanext-metadata_fields/ckanext/metadata_fields/plugin.py b/ckanext-metadata_fields/ckanext/metadata_fields/plugin.py\n--- a/ckanext-metadata_fields/ckanext/metadata_fields/plugin.py\n+++ b/ckanext-metadata_fields/ckanext/metadata_fields/plugin.py\n@@ -47,6 +47,7 @@\n     def _modify_package_schema(self, schema):\n         \n         schema.update({\n+                'notes': [tk.get_validator('not_empty')], #Notes == description. Makes description required\n                 'package_creator': [tk.get_validator('not_empty'),\n                     tk.get_converter('convert_to_extras')],\n                 'groups_list': [vd.groups_not_empty],\n@@ -75,8 +76,8 @@\n \n     def show_package_schema(self):\n         schema = super(HdxMetadataFieldsPlugin, self).show_package_schema()\n-\n         schema.update({\n+            'notes': [tk.get_validator('not_empty')], #Notes == description. Makes description required\n             'package_creator': [tk.get_converter('convert_from_extras'),\n                 tk.get_validator('ignore_missing')],\n             'caveats' : [tk.get_converter('convert_from_extras'),\n", "issue": "Implement GA tracking of downloads\nFrom Luis: \n\n_I've done some research about how to track the number of downloads in the website. We can track those events using Google Analytics as you suggested. There is a slight change of code that has to be implemented following Google Analytic's developer manual [here](https://developers.google.com/analytics/devguides/collection/analyticsjs/events). It is a bit more refined than copying and pasting code, although at a glance it doesn't seem to be extremely complicated._\n\n", "before_files": [{"content": "'''\nCreated on Apr 10, 2014\n\n@author:alexandru-m-g\n'''\nimport logging\n\nimport ckan.plugins as plugins\nimport ckan.plugins.toolkit as tk\nfrom routes.mapper import SubMapper\n\nimport ckanext.metadata_fields.custom_validator as vd\nimport ckanext.metadata_fields.update as update\n\ndef list_of_all_groups():\n    groups  = tk.get_action('group_list')(data_dict={'all_fields': True})\n    return groups\n\n\nclass HdxMetadataFieldsPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):\n    plugins.implements(plugins.IConfigurer, inherit=False)\n    plugins.implements(plugins.IRoutes, inherit=True)\n    plugins.implements(plugins.IDatasetForm, inherit=False)\n    plugins.implements(plugins.ITemplateHelpers)\n    plugins.implements(plugins.IActions)\n\n    def update_config(self, config):\n        tk.add_template_directory(config, 'templates')\n\n    def before_map(self, map):\n        with SubMapper(map, controller='ckanext.metadata_fields.dataset_controller:DatasetController') as m:\n            m.connect('add dataset', '/dataset/new', action='new')\n            m.connect('/dataset/{action}/{id}',\n                  requirements=dict(action='|'.join([\n                      'new_metadata',\n                      'new_resource',\n                      ])))\n        return map\n        \n    def is_fallback(self):\n        return True\n\n    def package_types(self):\n        # default - no specific package type\n        return []\n\n    def _modify_package_schema(self, schema):\n        \n        schema.update({\n                'package_creator': [tk.get_validator('not_empty'),\n                    tk.get_converter('convert_to_extras')],\n                'groups_list': [vd.groups_not_empty],\n            'caveats' : [tk.get_validator('ignore_missing'),\n                    tk.get_converter('convert_to_extras')],\n            'dataset_source' : [tk.get_validator('not_empty'),\n                    tk.get_converter('convert_to_extras')],\n            'dataset_date' : [tk.get_validator('ignore_missing'),\n                    tk.get_converter('convert_to_extras')],\n            'methodology' : [tk.get_validator('ignore_missing'),\n                    tk.get_converter('convert_to_extras')],\n            })\n\n        return schema\n\n\n    def create_package_schema(self):\n        schema = super(HdxMetadataFieldsPlugin, self).create_package_schema()\n        schema = self._modify_package_schema(schema)\n        return schema\n\n    def update_package_schema(self):\n        schema = super(HdxMetadataFieldsPlugin, self).update_package_schema()\n        schema = self._modify_package_schema(schema)\n        return schema\n\n    def show_package_schema(self):\n        schema = super(HdxMetadataFieldsPlugin, self).show_package_schema()\n\n        schema.update({\n            'package_creator': [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            'caveats' : [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            'dataset_source' : [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            'dataset_date' : [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            'methodology' : [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            })\n        return schema\n        \n    \n    def get_helpers(self):\n        return {'list_of_all_groups': list_of_all_groups}\n    \n    def get_actions(self):\n        return {'package_update': update.package_update}\n\n\n", "path": "ckanext-metadata_fields/ckanext/metadata_fields/plugin.py"}], "after_files": [{"content": "'''\nCreated on Apr 10, 2014\n\n@author:alexandru-m-g\n'''\nimport logging\n\nimport ckan.plugins as plugins\nimport ckan.plugins.toolkit as tk\nfrom routes.mapper import SubMapper\n\nimport ckanext.metadata_fields.custom_validator as vd\nimport ckanext.metadata_fields.update as update\n\ndef list_of_all_groups():\n    groups  = tk.get_action('group_list')(data_dict={'all_fields': True})\n    return groups\n\n\nclass HdxMetadataFieldsPlugin(plugins.SingletonPlugin, tk.DefaultDatasetForm):\n    plugins.implements(plugins.IConfigurer, inherit=False)\n    plugins.implements(plugins.IRoutes, inherit=True)\n    plugins.implements(plugins.IDatasetForm, inherit=False)\n    plugins.implements(plugins.ITemplateHelpers)\n    plugins.implements(plugins.IActions)\n\n    def update_config(self, config):\n        tk.add_template_directory(config, 'templates')\n\n    def before_map(self, map):\n        with SubMapper(map, controller='ckanext.metadata_fields.dataset_controller:DatasetController') as m:\n            m.connect('add dataset', '/dataset/new', action='new')\n            m.connect('/dataset/{action}/{id}',\n                  requirements=dict(action='|'.join([\n                      'new_metadata',\n                      'new_resource',\n                      ])))\n        return map\n        \n    def is_fallback(self):\n        return True\n\n    def package_types(self):\n        # default - no specific package type\n        return []\n\n    def _modify_package_schema(self, schema):\n        \n        schema.update({\n                'notes': [tk.get_validator('not_empty')], #Notes == description. Makes description required\n                'package_creator': [tk.get_validator('not_empty'),\n                    tk.get_converter('convert_to_extras')],\n                'groups_list': [vd.groups_not_empty],\n            'caveats' : [tk.get_validator('ignore_missing'),\n                    tk.get_converter('convert_to_extras')],\n            'dataset_source' : [tk.get_validator('not_empty'),\n                    tk.get_converter('convert_to_extras')],\n            'dataset_date' : [tk.get_validator('ignore_missing'),\n                    tk.get_converter('convert_to_extras')],\n            'methodology' : [tk.get_validator('ignore_missing'),\n                    tk.get_converter('convert_to_extras')],\n            })\n\n        return schema\n\n\n    def create_package_schema(self):\n        schema = super(HdxMetadataFieldsPlugin, self).create_package_schema()\n        schema = self._modify_package_schema(schema)\n        return schema\n\n    def update_package_schema(self):\n        schema = super(HdxMetadataFieldsPlugin, self).update_package_schema()\n        schema = self._modify_package_schema(schema)\n        return schema\n\n    def show_package_schema(self):\n        schema = super(HdxMetadataFieldsPlugin, self).show_package_schema()\n        schema.update({\n            'notes': [tk.get_validator('not_empty')], #Notes == description. Makes description required\n            'package_creator': [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            'caveats' : [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            'dataset_source' : [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            'dataset_date' : [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            'methodology' : [tk.get_converter('convert_from_extras'),\n                tk.get_validator('ignore_missing')],\n            })\n        return schema\n        \n    \n    def get_helpers(self):\n        return {'list_of_all_groups': list_of_all_groups}\n    \n    def get_actions(self):\n        return {'package_update': update.package_update}\n\n\n", "path": "ckanext-metadata_fields/ckanext/metadata_fields/plugin.py"}]}