|
1 | | -# ckanext-matomo-js |
2 | | -CKAN Matomo Plugin using JS File |
| 1 | +[](https://github.com/JiscSD/ckanext-matomo-js/actions) |
| 2 | + |
| 3 | +# CKAN Matomo Plugin using JS File |
| 4 | + |
| 5 | +This is the matomo tag manager plugin for CKAN. |
| 6 | +It includes the necessary JavaScript file to apply matomo tracking via the tag manager. |
| 7 | + |
| 8 | +## Features included |
| 9 | +1. Matomo tracking with the flexibility from the tag manager. |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +## Requirements |
| 14 | + |
| 15 | +This plugin is developed and tested on CKAN version 2.11 |
| 16 | + |
| 17 | +Compatibility with core CKAN versions: |
| 18 | + |
| 19 | +| CKAN version | Compatible? | |
| 20 | +|-----------------|-------------| |
| 21 | +| 2.11 | yes | |
| 22 | + |
| 23 | + |
| 24 | +## Installation |
| 25 | + |
| 26 | +To install ckanext-matomo_js: |
| 27 | + |
| 28 | +1. Activate your CKAN virtual environment, for example: |
| 29 | +``` |
| 30 | + . /usr/lib/ckan/default/bin/activate |
| 31 | +``` |
| 32 | +2. Clone the source and install it on the virtualenv |
| 33 | +``` |
| 34 | + cd /usr/lib/ckan/default/src |
| 35 | + python3 -m pip install -e git+https://github.com/JiscSD/ckanext-matomo-js.git#egg=ckanext-matomo-js |
| 36 | + |
| 37 | + then reset the permissions for the new ckanext-matomo-js directory to 'ckan' |
| 38 | +``` |
| 39 | +3. Add `matomo_js` to the `ckan.plugins` setting in your CKAN |
| 40 | + config file (by default the config file is located at |
| 41 | + `/etc/ckan/default/ckan.ini`). |
| 42 | + |
| 43 | +4. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu: |
| 44 | +``` |
| 45 | + sudo service apache2 reload |
| 46 | +``` |
| 47 | +or if the server is on AWS, called |
| 48 | +``` |
| 49 | + sudo systemctl restart nginx |
| 50 | +``` |
| 51 | + |
| 52 | +## Updating to a new version |
| 53 | + |
| 54 | +To update ckanext-matomo_js to a new version: |
| 55 | + |
| 56 | +1. Activate your CKAN virtual environment, for example: |
| 57 | +``` |
| 58 | + . /usr/lib/ckan/default/bin/activate |
| 59 | +``` |
| 60 | +2. pull the latest version then install it on the virtualenv |
| 61 | +``` |
| 62 | + cd /usr/lib/ckan/default/src/ckanext-matomo-js |
| 63 | + git pull |
| 64 | + pip install -e . |
| 65 | + |
| 66 | + then reset the permissions for the ckanext-matomo-js directory to 'ckan' |
| 67 | +``` |
| 68 | + |
| 69 | +3. Restart CKAN. For example if you've deployed CKAN with Apache on Ubuntu: |
| 70 | +``` |
| 71 | + sudo service apache2 reload |
| 72 | +``` |
| 73 | +or if the server is on AWS, called |
| 74 | +``` |
| 75 | + sudo reboot now |
| 76 | +``` |
| 77 | + |
| 78 | +## Config settings |
| 79 | + |
| 80 | +In order for the plugin to work, you need to set the url to the tag manager container in the javascript file. |
| 81 | +Once the plugin has been installed, go to the matomo.js file and replace the url tag ```.src='<src url>'``` with the url of the tag manager container. |
| 82 | + |
| 83 | + |
| 84 | +## Developer installation |
| 85 | + |
| 86 | +To install ckanext-matomo_js for development, activate your CKAN virtualenv and |
| 87 | +do: |
| 88 | + |
| 89 | + python3 -m pip install -e git+https://github.com/JiscSD/ckanext-matomo-js.git#egg=ckanext-matomo-js |
| 90 | + cd ckanext-matomo-js |
| 91 | + python3 setup.py develop |
| 92 | + python3 -m pip install -r dev-requirements.txt |
| 93 | + |
| 94 | + |
| 95 | +## Tests |
| 96 | + |
| 97 | +To run the tests, do: |
| 98 | + |
| 99 | + pytest --ckan-ini=test.ini |
| 100 | + |
| 101 | + |
| 102 | +## Releasing a new version of ckanext-matomo_js |
| 103 | + |
| 104 | +If ckanext-matomo_js should be available on PyPI you can follow these steps to publish a new version: |
| 105 | + |
| 106 | +1. Update the version number in the `setup.py` file. See [PEP 440](http://legacy.python.org/dev/peps/pep-0440/#public-version-identifiers) for how to choose version numbers. |
| 107 | + |
| 108 | +2. Make sure you have the latest version of necessary packages: |
| 109 | + |
| 110 | + pip install --upgrade setuptools wheel twine |
| 111 | + |
| 112 | +3. Create a source and binary distributions of the new version: |
| 113 | + |
| 114 | + python setup.py sdist bdist_wheel && twine check dist/* |
| 115 | + |
| 116 | + Fix any errors you get. |
| 117 | + |
| 118 | +4. Upload the source distribution to PyPI: |
| 119 | + |
| 120 | + twine upload dist/* |
| 121 | + |
| 122 | +5. Commit any outstanding changes: |
| 123 | + |
| 124 | + git commit -a |
| 125 | + git push |
| 126 | + |
| 127 | +6. Tag the new release of the project on GitHub with the version number from |
| 128 | + the `setup.py` file. For example if the version number in `setup.py` is |
| 129 | + 0.0.1 then do: |
| 130 | + |
| 131 | + git tag 0.0.1 |
| 132 | + git push --tags |
| 133 | + |
| 134 | +## License |
| 135 | + |
| 136 | +[Unlicense](https://unlicense.org/) |
| 137 | + |
0 commit comments