Skip to main content

Reusable Django app for API request/event analytics, crash logging, and PII-safe masking, viewable in Django admin.

Project description

django-uxlite

Reusable Django app that adds UXCam-style request/event analytics, crash logging, and PII masking to API services (Django REST Framework friendly), all viewable in Django admin. No client-side JS or session replay — built for API-only backends.

Install

pip install -e /path/to/django-uxlite

Setup

  1. Add to INSTALLED_APPS:
INSTALLED_APPS = [
    ...,
    "uxlite",
]
  1. Add the middleware (near the top, after auth middleware so request.user is set):
MIDDLEWARE = [
    ...,
    "uxlite.middleware.UXLiteTrackingMiddleware",
]
  1. Migrate:
python manage.py migrate uxlite
  1. Optional settings (all have defaults, see uxlite/settings_defaults.py):
UXLITE_SENSITIVE_FIELDS = ["password", "token", "email", "card_number", "ssn"]
UXLITE_RETENTION_DAYS = 90
UXLITE_MASK_VALUE = "***"
UXLITE_TRACK_PATHS_EXCLUDE = ["/admin/", "/static/", "/media/", "/health/"]

Usage

Custom events

from uxlite.tracking import track_event

def checkout_view(request):
    ...
    track_event("checkout_completed", request=request, meta={"order_id": order.id, "email": user.email})

Sensitive keys in meta are masked automatically before being stored, based on UXLITE_SENSITIVE_FIELDS.

Crash logging

Wired up automatically via the got_request_exception signal — no extra code needed for exceptions that reach Django as unhandled (including plain Django views and any exception type DRF doesn't recognize).

If you're using Django REST Framework, DRF's own exception handler catches APIException/Http404/PermissionDenied before they become unhandled, which would otherwise hide 5xx-worthy failures from CrashLog. Opt in with:

REST_FRAMEWORK = {
    "EXCEPTION_HANDLER": "uxlite.exceptions.drf_exception_handler",
}

This still returns DRF's normal error response — it only additionally logs a CrashLog row when the resolved response status is 5xx.

Purge old data

python manage.py uxlite_purge

Deletes RequestLog, Event, and CrashLog rows older than UXLITE_RETENTION_DAYS. Session rows with no remaining RequestLog/Event rows are cleaned up too.

Admin

Everything (RequestLog, Session, Event, CrashLog) is registered in Django admin with search/filter support — no extra dashboard UI needed.

Out of scope (v1)

  • Pixel-accurate session replay (DOM/gesture recording)
  • AI-analyst / auto-insight generation
  • Client-side JS heatmaps

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

django_uxlite-0.2.0.tar.gz (12.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_uxlite-0.2.0-py3-none-any.whl (17.2 kB view details)

Uploaded Python 3

File details

Details for the file django_uxlite-0.2.0.tar.gz.

File metadata

  • Download URL: django_uxlite-0.2.0.tar.gz
  • Upload date:
  • Size: 12.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for django_uxlite-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d3a48729c30fa809c947bfce8e8dc1f376f4d541102d32e22507651765c48aab
MD5 b7e743b6419f6914f5ae5ed8d1423c3a
BLAKE2b-256 ab0b48148e093db6f83c05373781ae59753b7319ed4b5d78a7fe383302b54bbf

See more details on using hashes here.

File details

Details for the file django_uxlite-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: django_uxlite-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 17.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.9.6

File hashes

Hashes for django_uxlite-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 032114424ee5f031223555f428551f88687ef16a63424efdd278c40776e3a542
MD5 4a8ea1bdcd7951acb373d886f9a99733
BLAKE2b-256 9659c780e3cd045f95648ffc4dea9c2b60de3e746bd74716b0c1443c53c265fa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page