Git Product home page Git Product logo

ro9ueadmin / django-tracking2 Goto Github PK

View Code? Open in Web Editor NEW

This project forked from bruth/django-tracking2

0.0 1.0 0.0 174 KB

django-tracking2 tracks the length of time visitors and registered users spend on your site. Although this will work for websites, this is more applicable to web _applications_ with registered users. This does not replace (nor intend) to replace client-side analytics which is great for understanding aggregate flow of page views.

License: BSD 2-Clause "Simplified" License

Python 92.24% HTML 7.76%

django-tracking2's Introduction

Overview

Build Status PyPI

django-tracking2 tracks the length of time visitors and registered users spend on your site. Although this will work for websites, this is more applicable to web applications with registered users. This does not replace (nor intend) to replace client-side analytics which is great for understanding aggregate flow of page views.

Note: This is not a new version of django-tracking. These apps have very different approaches and, ultimately, goals of tracking users. This app is about keeping a history of visitor sessions, rather than the current state of the visitor.

Requirements

Download

pip install django-tracking2

Setup

Add tracking to your project's INSTALLED_APPS setting:

INSTALLED_APPS = (
    ...
    'tracking',
    ...
)

If you use Django 1.8+ tracking app should follow the app with your user model

Add tracking.middleware.VisitorTrackingMiddleware to your project's MIDDLEWARE_CLASSES before the SessionMiddleware:

MIDDLEWARE_CLASSES = (
    ...
    'tracking.middleware.VisitorTrackingMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    ...
)

Django 1.7 - 2.0

Django 1.7 brings changes to the way database migrations are handled. If you do not use database migrations you should not be worried. If you use south and have not upgraded to django 1.7, you'll have to upgrade to south==1.0 and django-tracking2==0.3.3. Currently, Django 2.1 isn't supported, but Django 2.0 is.

Releases of djagno-tracking2 after 0.3.3 will not support south.

Settings

TRACK_AJAX_REQUESTS - If True, AJAX requests will be tracked. Default is False

TRACK_ANONYMOUS_USERS - If False, anonymous users will not be tracked. Default is True

TRACK_SUPERUSERS - If False, users with the superuser flag set to True will not be tracked. Default is True.

TRACK_PAGEVIEWS - If True, individual pageviews will be tracked.

TRACK_IGNORE_URLS - A list of regular expressions that will be matched against the request.path_info (request.path is stored, but not matched against). If they are matched, the visitor (and pageview) record will not be saved. Default includes 'favicon.ico' and 'robots.txt'. Note, static and media are not included since they should be served up statically Django's static serve view or via a lightweight server in production. Read more here

TRACK_IGNORE_STATUS_CODES - A list of HttpResponse status codes that will be ignored. If the HttpResponse object has a status_code in this blacklist, the pageview record will not be saved. For example,

TRACK_IGNORE_STATUS_CODES = [400, 404, 403, 405, 410, 500]

TRACK_REFERER - If True, referring site for all pageviews will be tracked. Default is False

TRACK_QUERY_STRING - If True, query string for all pageviews will be tracked. Default is False

Views

To view aggregate data about all visitors and per-registered user stats, do the following:

Include tracking.urls in your urls.py:

urlpatterns = patterns('',
    ...
    url(r'^tracking/', include('tracking.urls')),
    ...
)

These urls are protected by a custom Django permission tracking.view_visitor. Thus only superusers and users granted this permission can view these pages.

Available URLs

  • / - overview of all visitor activity, includes a time picker for filtering.

Templates

  • tracking/dashboard.html - for the dashboard page
  • tracking/snippets/stats.html - standalone content for the dashboard page (simplifies overriding templates)

django-tracking2's People

Contributors

bentleycook avatar brandonkane avatar bruth avatar chrisfranklin avatar dacox avatar djedi avatar eastdark avatar fpruitt avatar frankvdp avatar hwkns avatar mjschultz avatar tpeaton avatar v-alexeev avatar vganshin avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.