A Python client for Matomo based on a port of the PHP tracker with an almost 100% compatibility.
The current version should be almost fully compatible with Matomo 5, but it has not been extensively tested yet. 100% compatibility is not possible because of differences between PHP running environment and Python's.
Check /tests and /examples folders for examples on how to use it or /docs
to read its API documentation.
API Reference and User Guide available on Read the Docs.
- added
_set_cookiemethod that returns cookie as string - added
set_cookie_responsemethod called with all cookie values that is called byset_cookieand needs to be implemented for your framework (checkdjango.pyfor an example) - added
set_responsefor adding a response object that methods for cookies can use - changed
set_first_party_cookiesto also do nothing if response object does not exist - added
proxy_type optiontoset_proxyandget_proxyreturns full string becauserequestslibrary requires proxy to include proxy type) - added
PATH_TO_CERTIFICATES_FILEtoMatomoclass for using certificates (instead of checking if a constant with that name exists) - missing support for
doTrackPhpThrowableanddoTrackCrashuntil I figure out how to use and test them.
Cookie handling is not yet settled and may change in the future.
matomo.django module contains support for Django. It contains two classes:
-
Matomo- a Django compatible subclass of theMatomotracker class that correctly reads configuration values from Django's request object. -
MatomoMixin- a mixin for class based views that creates and storesmatomotracker object on the view's instance.
To use either of them you need to configure two variables in your Django's
settings.py:
MATOMO_SITE_ID- ID of the sie you want to trackMATOMO_TRACKING_API_URL- your tracking URL
WARNING: All calls to Matomo servers are synchronous and will thus impact the response time of views that make them.