Skip to main content

User actions tracking and analytics for Django sites.

Project description

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/development/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:

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-tracking-analyzer-0.2.tar.gz (108.2 kB view details)

Uploaded Source

Built Distribution

django_tracking_analyzer-0.2-py2.py3-none-any.whl (115.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file django-tracking-analyzer-0.2.tar.gz.

File metadata

File hashes

Hashes for django-tracking-analyzer-0.2.tar.gz
Algorithm Hash digest
SHA256 0acc0199ef0b5e26fae44c62d6d62c1b431f546b34cad9b685444452d229a6ae
MD5 64c28b233e5ae1ad5d2fb194384c2ae8
BLAKE2b-256 4f7396ca3e9c4e24fa026cebfa8191e318e96ba276ea9168b85dcecfdf2859e1

See more details on using hashes here.

File details

Details for the file django_tracking_analyzer-0.2-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_tracking_analyzer-0.2-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4f9784c28b244be57400b07ae98d89c63e11ba137271df255a68944de25ddb8a
MD5 918703845b8a8e00de3ff3aa8748310e
BLAKE2b-256 729daec4cde8bd5e0ad4d5720879013effaf17161ffd0e8189a23cadbd2898b8

See more details on using hashes here.

Supported by

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