Skip to main content

A Django app to help manage and track affiliate programmes

Project description

diddemo-track-affiliate

Django track affiliate is a Django app that allows you to manage affiliate programmes

Quick start:

  1. Ensure you have the following packages installed

pip install pyyaml ua-parser user-agent django-user-agent geoip2

  1. Add "affiliate" and "django_user_agent" to your INSTALLED_APPS setting like this.

    INSTALLED_APPS = [ ... 'django_user_agent', 'django_sus', ]

  2. Add 'django_user_agents.middleware.UserAgentMiddleware', to middleware

    MIDDLEWARE = [

    ... 'django_user_agents.middleware.UserAgentMiddleware', ...

]

  1. Run "python manage.py makemigrations" to create the models.

  2. Run "python manage.py migrate" to migrate your new models

  3. Add the following decorator to your main url i.e. home. This will create the necessary AffiliateTracker object against a session key

from affiliate.decorators import affiliate_tracker

@method_decorator(affiliate_tracker, name='dispatch') class HomeView(TemplateView):

template_name = "main/index.html"
  1. call the AFCreate class in your sign up view

from affiliate.manager import AFCreate def sign_up(request):

...
   
#add this before calling login()
session_key = self.request.session.session_key
            
login(self.request, user)

#add after calling login()
AFCreate(request, session_key = session_key, user = user)

...

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-track-affiliate-0.0.2.tar.gz (7.4 kB view hashes)

Uploaded Source

Built Distribution

django_track_affiliate-0.0.2-py3-none-any.whl (9.8 kB view hashes)

Uploaded 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