Skip to content
This repository has been archived by the owner on Oct 25, 2019. It is now read-only.

dangayle/Pixel-Tracker

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

13 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Django Pixel Tracker

Django Pixel Tracker uses Django signals to publish usage data about single object views. You can use this data for internal and external use, such as:

  • In-house analytics tracking (Maybe add a dashboard or track content in the Django admin?)
  • "Most active" stories/blogposts/etc (This is the SR's use case).

Installation

Add pixel_tracker to your installed apps:

INSTALLED_APPS = (
    ...,
    'pixel_tracker',
    ...
)

Add tracking_pixel to your site urls:

urlpatterns = patterns('',
    ...,
    (r'^pixel/', include('pixel_tracker.urls')),
    ...,
)

Add pixel to your templates:

{% load pixel %}
<html>
    <head></head>
    <body>
        {% pixel %}
    </body>

</html>

Usage

To use Django Pixel Tracker, you need create a receiver to subscribe to the pixel_data signal within your app. Example:

from pixel_tracker.models import pixel_data

def simple_receiver(**kwargs):
    pixel_data = kwargs['pixel_data']
    pprint(pixel_data)

pixel_data.connect(simple_receiver)

In this example, it will simply print out the pixel data as a Python Dict, but you could store this data in your database, load it into Redis or send off a Celery task. What you do with it is up to you.

The default data that it collects is:

  • Name of object model
  • PK of object item
  • Full url path of the request
  • Timestamp

You could extend that with any data that is available in the context.

TODO

  • Make available on PyPI
  • Tests

About

Django tracking pixel for content analytics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages