Skip to main content

User actions tracking and analytics for Django sites

https://travis-ci.org/jose-lpa/django-tracking-analyzer.svg?branch=master https://codecov.io/gh/jose-lpa/django-tracking-analyzer/branch/master/graph/badge.svg https://badge.fury.io/py/django-tracking-analyzer.svg https://readthedocs.org/projects/django-tracking-analyzer/badge/?version=latest

Requirements

Installation

  1. Install Django Tracking Analyzer from PyPI by using pip:

    pip install django-tracking-analyzer
  2. Add 'django_user_agents' and 'tracking_analyzer' entries to Django INSTALLED_APPS setting.

  3. Run the migrations to load the Tracker model in your database:

    python manage.py migrate tracking_analyzer
  4. 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:

Metadata

Release files for django-tracking-analyzer 1.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-tracking-analyzer 1.1.1
File Size Uploaded
django-tracking-analyzer-1.1.1.tar.gz 122.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-tracking-analyzer 1.1.1
File Interpreter ABI Platform
django_tracking_analyzer-1.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 250.8 kB

Release files / django-tracking-analyzer-1.1.1.tar.gz

Download URL django-tracking-analyzer-1.1.1.tar.gz
Size 122.6 kB
Tags Source
SHA-256 checksum
How to use checksums
ad3465369d399b88d70e6b2181b8b41d7b6cbee5302025220c779f050e407e6a
BLAKE2b-256 checksum
How to use checksums
be04e25e6fa9b4cf048a75517c5887ee0fa38f018e0fa6ff2e57017d8d78178a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3

Release files / django_tracking_analyzer-1.1.1-py3-none-any.whl

Download URL django_tracking_analyzer-1.1.1-py3-none-any.whl
Size 128.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
6133c10b5fc153101334394b9aa1bcf7d1d0e3dfb1d667aa6a94c21915210a20
BLAKE2b-256 checksum
How to use checksums
d18a5adb245836dd7a05400800fac2bcf093449e8df06902c8ef802f20d36f6a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.3.1 requests-toolbelt/0.9.1 tqdm/4.47.0 CPython/3.8.3
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page