Django-membergetmember is a project mainly written in Python, it's free.
Member-Get-Member using Convertble Credits
h1. Django Member-Get-Member
django-membergetmember (MGM) is an application to deal with MGM campaigns to get new users using "convertible credits" to incentivate them.
h2. What's a Member-Get-Member campaign?
You can find these MGM campaigns in multiple e-commerce sites, like groupon or livingsocial. There is a current member, the invitator user, that is offered to get new members for the site and get some money for every one of them. So the user invitator gets 5$ when a friend joins the site or when this new member buys something. This new member usually gets some credits, too.
h2. MGM concepts:
h2. Setup
h2. Integrate it in your code
You can read the tests.py's tests. They test the different alternatives:
h2. Track the invitation key
Once the app creates the invitation (MemberInvitation class) the user will propagate the key via email or social media.
There are different mechanisms in order to track this key:
h3. Middleware to track the invitation key using cookies
django-membergetmember provides a middleware to track the code using cookies. To activate it just add this middleware to your settings.py's MIDDLEWARE_CLASSES: @'mgm.middleware.MemberGetMemberMiddleware',@
It will capture any request with a GET argument (that you can setup in settings.MGM_COOKIE_NAME) and it will create a cookie with this invitation code.
Then, when a users signs up you have to read the content of the cookie. You may use this code:
import pickle
if request.COOKIES.get(settings.MGM_COOKIE_NAME, False):
invitation_key = pickle.loads(request.COOKIES.get(settings.MGM_COOKIE_NAME))