Send analytics data to Matomo using celery
Project description
Let your Django app perform server side analytics with Matomo>. Server side analytics is a great way to get some analytics while respecting user privacy (only you see the data, no internet wide tracking) and performance (no js tracker needed!)
Quickstart
You'll need to have celery set up because making the Matomo request in your Django request would be really slow. This project will collect some data from a request using middleware, serialize it, and send it to celery. Works fine with the default celery json serializer. Running celery will not be described here.
- Install via pip
django-server-side-matomo
- Add to INSTALLED_APPS
'server_side_matomo',
- Add to MIDDLEWARE
'server_side_matomo.middleware.MatomoMiddleware'
- Set the following in settings.py
- MATOMO_SITE_ID = '1' # Your site's Matomo ID
- MATOMO_API_URL = 'https://your.site.com/piwik.php'
- MATOMO_TOKEN_AUTH = 'your auth token'
- MATOMO_TRACK_USER_ID = False # Set to True to track user ID. See https://matomo.org/docs/user-id/
Testing and Development
Only merge requests with unit tests will be accepted. Please open an issue first if you'd like to propose a feature. I don't plan to add many features to this project myself. Unless other people are interested in doing the work - I have no plans to support things like Google Analytics.
Testing
A Docker Compose file is provided to quickly try out the project. Just run in a web container:
./manage.py test
Tested with Django 3.0 and Python 3.7.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for django-server-side-matomo-2.0.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 14e3c4969073a10f66ed7bab66d60c28abe0abebe587bea8d9fc189035ec7b79 |
|
MD5 | e7ce1dac872de9126cf55007c07b4583 |
|
BLAKE2b-256 | 70b167e4ff71124fafcc9004b81060f046b4b5fb12ffb9d667d7386704410b2b |
Hashes for django_server_side_matomo-2.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b89c577581fbdf54b16e914889a29d76c31385f416f51f243bb7132fcce6ebc4 |
|
MD5 | 9a799e54c0d43aaa4d6ad68cb3bd5cad |
|
BLAKE2b-256 | 837a2b4f79c1981bd0b7d568ccdbfb3189a3f0c4bca17cb26b7cc0fa7775e511 |