User actions tracking and analytics for Django sites.
Project description
User actions tracking and analytics for Django sites
Requirements
Django 2.1 or later.
Django Countries 5.5 or later.
Django IPWare 2.1.0 or later.
Django User Agents 0.4.0 or later.
GeoIP2 2.9.0 or later.
Installation
Install Django Tracking Analyzer from PyPI by using pip:
pip install django-tracking-analyzer
Add 'django_user_agents' and 'tracking_analyzer' entries to Django INSTALLED_APPS setting.
Run the migrations to load the Tracker model in your database:
python manage.py migrate tracking_analyzer
Install the MaxMind® GeoIP2 datasets. You can do this in two ways:
4.1. By running the provided management command for this:
python manage.py install_geoip_dataset
4.2. Or manually, by following the instructions in GeoIP2 Django documentation.
After following those steps, you should be ready to go.
Explanation - Quickstart
Django Tracking Analyzer is a Django pluggable application which helps you providing usage statistics and visitors data for your Django sites.
DTA does this by recording requests data in those places you want to by saving Tracker’s. A Tracker is a Django database model which holds all the data related to a request, including geolocation via IP address and device or browser specifications.
When some data is collected, the Django admin interface for Tracker model implements some interactive widgets to help you visualize better the data.
Now let’s see how can you start collecting users data. Imagine the most basic example: you have a web blog and you want to check the visits to your posts, having a resume of who accessed the posts, when and from where. In such a Django site, you might have a view PostDetailView, where a blog post will be served by passing its slug in the URL. Something like this:
class PostDetailView(DetailView):
model = Post
Okay, so you can track the users who access blog posts by their instances with DTA, just like this:
class PostDetailView(DetailView):
model = Post
def get_object(self, queryset=None):
# Retrieve the blog post just using `get_object` functionality.
obj = super(PostDetailView, self).get_object(queryset)
# Track the users access to the blog by post!
Tracker.objects.create_from_request(self.request, obj)
return obj
And you are now on your way to collect users data! Now give it a time (or better access the resource yourself several times) and go check your Django admin in the “Django Tracking Analyzer” - “Trackers” section. Enjoy!
Documentation
For extensive documentation and usage explanations, you can check Read the Docs.
Acknowledgements
Django Tracking Analyzer makes use of this technologies and apps, without which it wouldn’t be possible:
Django Countries, by Chris Beaven.
Django IPWare, by Val Neekman.
Django User Agents, by Selwin Ong.
Datamaps, by Marc DiMarco.
TopoJSON, by Mike Bostock.
D3 bar chart w/tooltips, original code by Justin Palmer.
D3 area chart, by Mike Bostock.
Of course, the D3.js library.
And MaxMind, the company behind all the geographical datasets that made them publicly available.
Project details
Release history Release notifications | RSS feed
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
File details
Details for the file django-tracking-analyzer-1.0.1.tar.gz
.
File metadata
- Download URL: django-tracking-analyzer-1.0.1.tar.gz
- Upload date:
- Size: 122.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e84f47cb34c62f66508a60566246148163d42ccfcbe31b067fa2a08680bc56bf |
|
MD5 | af88eebf34977a556ccce2edad41bb89 |
|
BLAKE2b-256 | 20ecc01ae3e48b90cff0b5e818436ce35e8cd1f829805e34928e3a0520193656 |
File details
Details for the file django_tracking_analyzer-1.0.1-py3-none-any.whl
.
File metadata
- Download URL: django_tracking_analyzer-1.0.1-py3-none-any.whl
- Upload date:
- Size: 128.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/2.0.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.4.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.8.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 090c19b89b858c9d9358aca3e78bc50f1ef85f5060ac24a48abf658154c76a6b |
|
MD5 | cf9d4f0027b5f16dd040b183c5916201 |
|
BLAKE2b-256 | 64b1a92ff52e6e1637c53889dd271ac1b82a658dbc16ce485f2ad082b46efa18 |