django-referer is a Django app for displaying different referer details based on a customizable query parameter and keeping this query parameter while user navigates in the site.
It provides sales, partners and affiliates custom links to send out in order to get private traffic.
It gives sales, partners and affiliates their opportunity to convert every contact detail on the website to their own.
It thus encourages sales, partners and affiliates to promote the website and the business.
In addition, with the help of analytics scripts, traffic data can be easily distinguished and analyzed.
- URL with referer parameter e.g. https://zhujia.com.au/?refer=14
(The chosen query parameter is kept by django-referer's middleware while user navigates between links)
- URL without referer parameter (falls back to the default referer) e.g. https://zhujia.com.au
Use the package manager pip to install django-referer.
pip install django-referer
MIDDLEWARE = [
'referer.middleware.referer.RefererMiddleware', # here
'django.middleware.security.SecurityMiddleware',
'...'
]
TEMPLATES = [
{
'OPTIONS': {
'context_processors': [
'...',
'django.contrib.messages.context_processors.messages',
'referer.context_processors.referer', # here
],
},
},
]
The defaults are:
REFERER_LINK_PARAMETER = 'referer'
REFERER_DEFAULT_ID = 1
# -> ?referer=1
REFERER_MODEL_FROM = 'django.contrib.auth.models'
REFERER_MODEL_IMPORT = 'User'
# -> from REFERER_MODEL_FROM import REFERER_MODEL_IMPORT
REFERER_IGNORED_LINKS = []
<a href="mailto:{{ referer.email }}">Email</a>
<p>{{ referer.first_name }} {{ referer.last_name }}</p>
Issues and pull requests are welcomed.