Skip to main content

Keep HTTP referer information on query parameter and display referer information

Project description

django-referer is a Django app for displaying different referer details based on query parameter. It provides sales, partners and affiliates custom links to send out to the public. 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. Also, with the help of analytics scripts, there will be information about which sales gets most clicks.

Installation

Use the package manager pip to install django-referer.

pip install django-referer

Usage

Step 1. Add referer middleware (in settings.py file)

MIDDLEWARE = [
    'referer.middleware.referer.RefererMiddleware',  # here
    'django.middleware.security.SecurityMiddleware',
    '...'
]

Step 2. Add referer context processors (in settings.py file)

TEMPLATES = [
    {
        'OPTIONS': {
            'context_processors': [
                '...',
                'django.contrib.messages.context_processors.messages',
                'referer.context_processors.referer',  # here
            ],
        },
    },
]

Step 3. Customize referer settings (in settings.py file) (optional)

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 = []

Step 4. Display referer information (in .html file)

<a href="mailto:{{ referer.email }}">Email</a>
<p>{{ referer.first_name }} {{ referer.last_name }}</p>

Contributing

Pull requests are welcome.

License

MIT

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-referer-0.0.3.tar.gz (3.2 kB view details)

Uploaded Source

Built Distribution

django_referer-0.0.3-py3-none-any.whl (4.7 kB view details)

Uploaded Python 3

File details

Details for the file django-referer-0.0.3.tar.gz.

File metadata

  • Download URL: django-referer-0.0.3.tar.gz
  • Upload date:
  • Size: 3.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for django-referer-0.0.3.tar.gz
Algorithm Hash digest
SHA256 ccbb72f92fa3c35a31405b3de51a1777e0e18b60674659366ffbc4da4e224698
MD5 2e59b79267a34529c5f8122f0805f889
BLAKE2b-256 3d5d7c703eb9ed22424a4dbcf45614682571b671d2f9a37358add9002609e612

See more details on using hashes here.

File details

Details for the file django_referer-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: django_referer-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.6.0 requests/2.24.0 setuptools/50.3.2 requests-toolbelt/0.9.1 tqdm/4.50.2 CPython/3.8.5

File hashes

Hashes for django_referer-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 bef987420f23b582287caa244b8e231b6221f4bbf20ff56ed9819ed77e72ea86
MD5 36d14e9630c6fe9d67cfb00f2bf808a5
BLAKE2b-256 7be55d0fa80b4108e97ae682565ddca61aecd46f4c97b6c67a2a0b7c0a5632d0

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page