Skip to main content

Tracking pixels made easy

Project description

=============================
django-pixels
=============================

Tracking pixels made easy

Features
----------
* Built-in view to serve a pixel response
* Compose pixel tracking urls with different type IDs
* Route tracking requests to functions using type IDs

Implementation Notes with Short Examples
----------

Install django-pixels::

pip install django-pixels


Mount pixel tracking URL patterns:

.. code-block:: python

import django_pixels

urlpatterns = [
...
url(r'^tracker/', include(django_pixels.urls, namespace="pixels")),
...
]


Get the general pixel tracking url:

.. code-block:: python

from django.core.urlresolvers import reverse
tracking_url = reverse('pixels:pixel') # given you have mounted django_pixels urls with namespace='pixels'


Generate a pixel tracking url with type 1:

.. code-block:: python

from django_pixels import utils

utils.compose_pixel_url(tracking_url, 1)


Write a function to handle tracking calls with type 1:

.. code-block:: python

def track_emails(request):
# handle tracking with the passed HttpRequest instance


Register the function to handle tracking calls with type 1:

.. code-block:: python

from django_pixels import handlers

handlers.register(1, track_emails)


Or mark a function to handle tracking calls with type 2:

.. code-block:: python

from django_pixels import handlers

@handlers.track(type_id=2)
def track_emails(request):
# handle tracking with the passed HttpRequest instance



Credits
-------

Tools used in rendering this package:

* Cookiecutter_
* `cookiecutter-djangopackage`_

.. _Cookiecutter: https://github.com/audreyr/cookiecutter
.. _`cookiecutter-djangopackage`: https://github.com/pydanny/cookiecutter-djangopackage




History
-------

0.1 (2016-12-10)
++++++++++++++++++

* First release on PyPI.

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-pixels-0.1.tar.gz (4.6 kB view hashes)

Uploaded Source

Built Distribution

django_pixels-0.1-py2.py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 2 Python 3

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