{"id":18041564,"url":"https://github.com/bashu/django-tracking","last_synced_at":"2025-04-09T12:09:22.880Z","repository":{"id":764597,"uuid":"440182","full_name":"bashu/django-tracking","owner":"bashu","description":"Simple attempt at keeping track of visitors to django-powered web sites","archived":false,"fork":false,"pushed_at":"2021-01-26T09:23:30.000Z","size":2086,"stargazers_count":229,"open_issues_count":12,"forks_count":91,"subscribers_count":16,"default_branch":"develop","last_synced_at":"2025-04-01T15:04:06.956Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"spree/spree","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bashu.png","metadata":{"files":{"readme":"README.rst","changelog":"CHANGES","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-12-17T06:04:22.000Z","updated_at":"2025-02-15T04:24:50.000Z","dependencies_parsed_at":"2022-08-16T10:50:10.240Z","dependency_job_id":null,"html_url":"https://github.com/bashu/django-tracking","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashu%2Fdjango-tracking","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashu%2Fdjango-tracking/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashu%2Fdjango-tracking/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bashu%2Fdjango-tracking/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bashu","download_url":"https://codeload.github.com/bashu/django-tracking/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248036067,"owners_count":21037092,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-30T16:10:41.466Z","updated_at":"2025-04-09T12:09:22.861Z","avatar_url":"https://github.com/bashu.png","language":"Python","readme":"``django-tracking`` is a simple attempt at keeping track of visitors to\nDjango-powered Web sites.  It also offers basic blacklisting capabilities.\n\nThe offial repository for ``django-tracking`` is at\nhttp://bitbucket.org/codekoala/django-tracking.  Please file any tickets there.\n\nFeatures\n========\n\n* Tracks the following information about your visitors:\n\n    * Session key\n    * IP address\n    * User agent\n    * Whether or not they are a registered user and logged in\n    * Where they came from (http-referer)\n    * What page on your site they last visited\n    * How many pages on your site they have visited\n\n* Allows user-agent filtering for visitor tracking\n* Automatic clean-up of old visitor records\n* Can ban certain IP addresses, rendering the site useless to visitors from\n  those IP's (great for stopping spam)\n* The ability to have a live feed of active users on your website\n* Template tags to:\n\n    * display how many active users there are on your site\n    * determine how many active users are on the same page within your site\n\n* Optional \"Active Visitors Map\" to see where visitors are in the world\n\nRequirements\n============\n\nAs far as I am aware, the only requirement for django-tracking to work is a\nmodern version of Django.  I developed the project on Django 1.0 alpha 2 and\nbeta 1.  It is designed to work with the newforms-admin functionality.\n\nIf you wish to use a Google Map to display where your visitors are probably at,\nyou must have a `Google Maps API key\n\u003chttp://code.google.com/intl/ro/apis/maps/signup.html\u003e`_, which is free.  You\nare required to have the `GeoIP C API library\n\u003chttp://geolite.maxmind.com/download/geoip/api/c/GeoIP.tar.gz\u003e`_ installed.\nYou might want to grab the `GeoLite City binary\n\u003chttp://www.maxmind.com/app/geolitecity\u003e`_ unless you are a paying MaxMind\ncustomer.  This is the data file that ``django-tracking`` uses to translate an\nIP into a location on the planet.  Configuring this feature is discussed later.\n\nInstallation\n============\n\nDownload ``django-tracking`` using *one* of the following methods:\n\npip\n---\n\nYou can download the package from the `CheeseShop\n\u003chttp://pypi.python.org/pypi/django-tracking/\u003e`_ or use::\n\n    pip install django-tracking\n\nto download and install ``django-tracking``.\n\neasy_install\n------------\n\nYou can download the package from the `CheeseShop \u003chttp://pypi.python.org/pypi/django-tracking/\u003e`_ or use::\n\n    easy_install django-tracking\n\nto download and install ``django-tracking``.\n\nCheckout from BitBucket/GitHub/Google Code\n------------------------------------------\n\nUse one of the following commands::\n\n    hg clone http://bitbucket.org/codekoala/django-tracking\n    git clone http://github.com/codekoala/django-tracking.git\n    hg clone http://django-tracking.googlecode.com/hg/ django-tracking\n\nPackage Download\n================\n\nDownload the latest ``.tar.gz`` file from the downloads section and extract it\nsomewhere you'll remember.\n\nConfiguration\n=============\n\nFirst of all, you must add this project to your list of ``INSTALLED_APPS`` in\n``settings.py``::\n\n    INSTALLED_APPS = (\n        'django.contrib.admin',\n        'django.contrib.auth',\n        'django.contrib.contenttypes',\n        'django.contrib.sessions',\n        'django.contrib.sites',\n        ...\n        'tracking',\n        ...\n    )\n\nRun ``manage.py syncdb``.  This creates a few tables in your database that are\nnecessary for operation.\n\nDepending on how you wish to use this application, you have a few options:\n\nVisitor Tracking\n----------------\n\nAdd ``tracking.middleware.VisitorTrackingMiddleware`` to your\n``MIDDLEWARE_CLASSES`` in ``settings.py``.  It must be underneath the\n``AuthenticationMiddleware``, so that ``request.user`` exists.\n\nAutomatic Visitor Clean-Up\n++++++++++++++++++++++++++\n\nIf you want to have Django automatically clean past visitor information out\nyour database, put ``tracking.middleware.VisitorCleanUpMiddleware`` in your\n``MIDDLEWARE_CLASSES``.\n\nIP Banning\n----------\n\nAdd ``tracking.middleware.BannedIPMiddleware`` to your ``MIDDLEWARE_CLASSES``\nin ``settings.py``.  I would recommend making this the very first item in\n``MIDDLEWARE_CLASSES`` so your banned users do not have to drill through any\nother middleware before Django realizes they don't belong on your site.\n\nVisitors on Page (template tag)\n-------------------------------\n\nMake sure that ``django.core.context_processors.request`` is somewhere in your\n``TEMPLATE_CONTEXT_PROCESSORS`` tuple.  This context processor makes the\n``request`` object accessible to your templates.  This application uses the\n``request`` object to determine what page the user is looking at in a template\ntag.\n\nActive Visitors Map\n===================\n\nIf you're interested in seeing where your visitors are at a given point in\ntime, you might enjoy the active visitor map feature.  Be sure you have added a\nline to your main URLconf, as follows::\n\n    from django.conf.urls.defaults import *\n\n    urlpatterns = patterns('',\n        ....\n        (r'^tracking/', include('tracking.urls')),\n        ....\n    )\n\nNext, set a couple of settings in your ``settings.py``:\n\n* ``GOOGLE_MAPS_KEY``: Your very own Google Maps API key\n* ``TRACKING_USE_GEOIP``: set this to ``True`` if you want to see markers on\n  the map\n* ``GEOIP_PATH``: set this to the absolute path on the filesystem of your\n  ``GeoIP.dat`` or ``GeoIPCity.dat`` or whatever file.  It's usually something\n  like ``/usr/local/share/GeoIP.dat`` or ``/usr/share/GeoIP/GeoIP.dat``.\n* ``GEOIP_CACHE_TYPE``: The type of caching to use when dealing with GeoIP data:\n\n    * ``0``: read database from filesystem, uses least memory.\n    * ``1``: load database into memory, faster performance but uses more\n      memory.\n    * ``2``: check for updated database.  If database has been updated, reload\n      filehandle and/or memory cache.\n    * ``4``: just cache the most frequently accessed index portion of the\n      database, resulting in faster lookups than ``GEOIP_STANDARD``, but less\n      memory usage than ``GEOIP_MEMORY_CACHE`` - useful for larger databases\n      such as GeoIP Organization and GeoIP City.  Note, for GeoIP Country,\n      Region and Netspeed databases, ``GEOIP_INDEX_CACHE`` is equivalent to\n      ``GEOIP_MEMORY_CACHE``. *default*\n\n* ``DEFAULT_TRACKING_TEMPLATE``: The template to use when generating the\n  visitor map.  Defaults to ``tracking/visitor_map.html``.\n\nWhen that's done, you should be able to go to ``/tracking/map/`` on your site\n(replacing ``tracking`` with whatever prefix you chose to use in your URLconf,\nobviously).  The default template relies upon jQuery for its awesomeness, but\nyou're free to use whatever you would like.\n\nUsage\n=====\n\nTo display the number of active users there are in one of your templates, make\nsure you have ``{% load tracking_tags %}`` somewhere in your template and do\nsomething like this::\n\n    {% visitors_on_site as visitors %}\n    \u003cp\u003e\n        {{ visitors }} active user{{ visitors|pluralize }}\n    \u003c/p\u003e\n\nIf you also want to show how many people are looking at the same page::\n\n    {% visitors_on_page as same_page %}\n    \u003cp\u003e\n        {{ same_page }} of {{ visitors }} active user{{ visitors|pluralize }}\n        {{ same_page|pluralize:\"is,are\" }} reading this page\n    \u003c/p\u003e\n\nIf you don't want particular areas of your site to be tracked, you may define a\nlist of prefixes in your ``settings.py`` using the ``NO_TRACKING_PREFIXES``.  For\nexample, if you didn't want visits to the ``/family/`` section of your website,\nset ``NO_TRACKING_PREFIXES`` to ``['/family/']``.\n\nIf you don't want to count certain user-agents, such as Yahoo!'s Slurp and\nGoogle's Googlebot, you may add keywords to your visitor tracking in your\nDjango administration interface.  Look for \"Untracked User-Agents\" and add a\nkeyword that distinguishes a particular user-agent.  Any visitors with the\nkeyword in their user-agent string will not be tracked.\n\nBy default, active users include any visitors within the last 10 minutes.  If\nyou would like to override that setting, just set ``TRACKING_TIMEOUT`` to however\nmany minutes you want in your ``settings.py``.\n\nFor automatic visitor clean-up, any records older than 24 hours are removed by\ndefault.  If you would like to override that setting, set\n``TRACKING_CLEANUP_TIMEOUT`` to however many hours you want in your\n``settings.py``.\n\nGood luck!  Please contact me with any questions or concerns you have with the\nproject!\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbashu%2Fdjango-tracking","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbashu%2Fdjango-tracking","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbashu%2Fdjango-tracking/lists"}