{"id":18737430,"url":"https://github.com/yifaneye/django-referer","last_synced_at":"2025-04-12T19:32:23.142Z","repository":{"id":57421526,"uuid":"309090177","full_name":"yifaneye/django-referer","owner":"yifaneye","description":"Django app for providing different contexts 💁‍♀️ based on a well-kept query parameter using Python and Django (middleware and context processor). 👉 pip install django-referer","archived":false,"fork":false,"pushed_at":"2021-04-12T13:59:35.000Z","size":311,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-26T14:04:43.367Z","etag":null,"topics":["context-processor","django","django-referer","django-sales","middleware","python"],"latest_commit_sha":null,"homepage":"https://yifanai.com/dr","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/yifaneye.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-11-01T12:24:20.000Z","updated_at":"2022-01-14T22:27:07.000Z","dependencies_parsed_at":"2022-09-10T14:10:46.737Z","dependency_job_id":null,"html_url":"https://github.com/yifaneye/django-referer","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yifaneye%2Fdjango-referer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yifaneye%2Fdjango-referer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yifaneye%2Fdjango-referer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yifaneye%2Fdjango-referer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yifaneye","download_url":"https://codeload.github.com/yifaneye/django-referer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248621285,"owners_count":21134794,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["context-processor","django","django-referer","django-sales","middleware","python"],"created_at":"2024-11-07T15:25:08.624Z","updated_at":"2025-04-12T19:32:22.840Z","avatar_url":"https://github.com/yifaneye.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-referer\n\n**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**. \\\nIt provides sales, partners and affiliates custom links to send out in order to get private traffic.\nIt gives sales, partners and affiliates their opportunity to convert every contact detail on the website to their own.\nIt thus encourages sales, partners and affiliates to promote the website and the business.\nIn addition, with the help of analytics scripts, traffic data can be easily distinguished and analyzed.\n\n## Demo\n\n1. URL with referer parameter\ne.g. [https://zhujia.com.au/?refer=14](https://zhujia.com.au/?refer=14)\n\n![django-referer Demo - Link with referer](https://yifanai.s3-ap-southeast-2.amazonaws.com/dr/dr14p.jpg)\n(The chosen query parameter is kept by django-referer's middleware while user navigates between links)\n![django-referer Demo 2 - Link with referer](https://yifanai.s3-ap-southeast-2.amazonaws.com/dr/dr14a.jpg)\n\n2. URL without referer parameter (falls back to the default referer)\ne.g. [https://zhujia.com.au](https://zhujia.com.au)\n\n![django-referer Demo - Link without referer](https://yifanai.s3-ap-southeast-2.amazonaws.com/dr/drp.jpg)\n![django-referer Demo 2 - Link without referer](https://yifanai.s3-ap-southeast-2.amazonaws.com/dr/dra.jpg)\n\n## Installation\n\nUse the package manager [pip](https://pip.pypa.io/en/stable/) to install django-referer.\n```bash\npip install django-referer\n```\n\n## Usage\n\n### Step 1. Add referer middleware (in settings.py file)\n```python\nMIDDLEWARE = [\n    'referer.middleware.referer.RefererMiddleware',  # here \n    'django.middleware.security.SecurityMiddleware',\n    '...'\n]\n```\n\n### Step 2. Add referer context processor (in settings.py file)\n```python\nTEMPLATES = [\n    {\n        'OPTIONS': {\n            'context_processors': [\n                '...',\n                'django.contrib.messages.context_processors.messages',\n                'referer.context_processors.referer',  # here\n            ],\n        },\n    },\n]\n```\n\n### Step 3. Customize referer settings (in settings.py file) (optional)\nThe defaults are:\n```python\nREFERER_LINK_PARAMETER = 'referer'\nREFERER_DEFAULT_ID = 1\n# -\u003e ?referer=1\n\nREFERER_MODEL_FROM = 'django.contrib.auth.models'\nREFERER_MODEL_IMPORT = 'User'\n# -\u003e from REFERER_MODEL_FROM import REFERER_MODEL_IMPORT\n\nREFERER_IGNORED_LINKS = []\n```\n\n### Step 4. Display referer information (in .html file)\n```html\n\u003ca href=\"mailto:{{ referer.email }}\"\u003eEmail\u003c/a\u003e\n\u003cp\u003e{{ referer.first_name }} {{ referer.last_name }}\u003c/p\u003e\n```\n\n## Contributing\nIssues and pull requests are welcomed.\n\n## License\n[MIT](https://choosealicense.com/licenses/mit/) © [Yifan Ai](https://yifanai.com)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyifaneye%2Fdjango-referer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyifaneye%2Fdjango-referer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyifaneye%2Fdjango-referer/lists"}