A small django application for marketing using referral links
Imagine you got a nice website running and you want to make some marketing in order to gain more users. This can be achieved by spreading links/banners over the internet pointing to your website. Now in order to find out how your banners performed you need to know how many users registered after clicking on one of your banners. To tell them apart you add some unique GET parameter to each link. This app will detect those referral parameters and store for each user what referrer lead him to your website.
pip install django-referral
INSTALLED_APPS = ( ... 'referral', ... )
Since django-referral uses django's session middleware make sure you add it after SessionMiddleware
MIDDLEWARE_CLASSES = ( ... 'django.contrib.sessions.middleware.SessionMiddleware', 'referral.middleware.ReferrerMiddleware', ... )
from referral.models import UserReferrer ... def my_user_creation_view(request): ... UserReferrer.objects.apply_referrer(user, request)
The name of the GET parameter used.
The name of the session key that will hold the detected referrer
Defines whether unknown referrers shall be autocreated
Defines whether referrers should be associated to campaigns automatically using patterns
Defines whether or referrer names are case-sensitive or not.
Just run the makefile to set up a virtual environment for testing
For simple test
For coverage report
For full test in all supported environment (requires tox)