/django-ackee-middleware

Django middleware reporting requests to Ackee

Primary LanguagePythonMIT LicenseMIT

django-ackee-middleware

CI codecov License PyPI

Django middleware reporting requests to Ackee, self-hosted analytics tool for those who care about privacy. Alternative to using the client-side JS tracker.

Installation

$ pip install django-ackee-middleware

If you don't have the Ackee instance yet, you can quickly deploy it on Heroku.

Configuration

Add the middleware as the first one in your Django settings.py:

MIDDLEWARE = [
    "ackee.middleware.TrackerMiddleware",
    "django.middleware.security.SecurityMiddleware",
    ...
]

Then add the following properties:

ACKEE_SERVER = "https://myackeeserver.com"
ACKEE_DOMAIN_ID = "YOUR DOMAIN ID"
ACKEE_IGNORED_PATHS = [
    "^/admin/.*"
]

Remember to change the server and domain ID to your values.

Development

This project is using pipenv to manage the development dependencies. To install them run:

$ pipenv install

Publishing

There are two pipenv scripts that make building and publishing the package easier:

  • pipenv run build - builds the distribution package
  • pipenv run upload - uploads the package to PyPI