|
VisualFrames,
Sounds good. I appreciate your offer to write the whole thing, I’m just thinking that we can get something working quicker if we all contribute.
Gui,
When you say two sign-up situations, do you mean you want to run an affiliate programme and a loyalty programme at the same time?
I’m just wondering if there is anyone who wants to take on the coding necessary to make the affiliate software work as a loyalty programme. I’m probably not the best person to do it, because I’ve no use for a system like that. All I need is a traditional affiliate programme, so it’s difficult for me to see what is necessary to make the system work the other way.
Lizardo,
At the moment the system sets a cookie with a configurable lifetime. If someone follows an affiliate link, the cookie gets set. If they go away and come back to order before the cookie has expired, the affiliate will get the credit. If they order again before the cookie has expired, the affiliate will get additional credit. On the other hand, once the cookie has expired the affiliate will not get credit, even if he was responsible for introducing the customer, and the first order was placed within the cookie lifetime.
I imagine everyone will want different policies on this! I’ll probably implement at least the model where an affiliate benefits throughout the customer lifetime, as that’s probably what I’ll do on my own store. An affiliate who introduces a loyal customer deserves to be rewarded.
---
Progress report time… I’ve been writing code today, and you can now follow affiliate links to my dummy store. When you follow the link, a cookie will be set. If you place an order in the dummy store, and you have a cookie set, it will be recorded in MySQL.
You can browse the code or download a tarball at http://www.metathinking.com/affiliates/ . Once you’ve installed Bazaar, you can also get a copy with “bzr branch http://www.metathinking.com/affiliates/trunk”. If you want to join in with the coding, I suggest you set up the system as it exists at present, and see if it looks flexible enough to do what you want. If it does, that’s great, if it doesn’t please let me know.
To set up the system, you should first create a user and database in MySQL. Load the table definition from affiliates.sql. You then need to copy config.inc.sample to config.inc and set the appropriate MySQL connection parameters at the bottom. You probably don’t need to change the top three values, but if you are interested they are: (i) the parameter used in affiliate links to give the affiliate’s account number, (ii) the name of the cookie which the system will set, and (iii) the length of time the cookie will persist in the browser.
You’ve now configured the affiliate software, but you also need to configure the demo store. The idea is that integrations for different shopping carts will go in the “carts” directory. At the moment, there is only one thing in there, a subdirectory called “dummy”. This contains the dummy store. Change into that directory and again copy config.inc.sample to config.inc. There is only one value to configure, which is the URL of the affiliate software.
Finally you need to enable web serving for the directory “public” (for the affiliate software) and “carts/dummy” (for the dummy store). Visit the dummy store using a URL like “http://www.example.com/dummystore?ref=123”. You should find that a cookie has been set. You will be asked how many widgets you want. Choose a number and click “Buy Now”. The order will then be recorded in MySQL against affiliate 123.
If you’re confused about the various URL paths, let me explain how it’s set up on my machine. My machine is called yeltsin.metathinking.com (but the firewall blocks access to it from outside, so you can’t actually see it). In the document root directory, I have two symlinks. One is called “affiliates” and points to the “public” directory. The other is called “affiliates-dummy” and points to “carts/dummy”. The $affiliate_base variable is set to “http://yeltsin.metathinking.com/affiliates’”.
If you now look at the code for the dummy cart, it should be fairly apparent what it does. Every time a page is displayed, the dummy cart makes an XMLRPC call to get_cookie. If there is an affiliate code in the URL, the call will return details of the cookie which must be set. When the order is actually placed, an XMLRPC call is made to order_placed. The call’s parameters include the order number and the total price. The affiliate will be determined by looking at the cookie list.
It may seem like an overhead calling get_cookie on every page view, but the cart and the affiliate software will normally run on the same machine, so the delay will be minimal. Later it may be useful to have a call on every page view, to collect analytics information which can be made available to affiliates. (I also know the security needs fixing!)
I used XMLRPC because it allows us to integrate carts which don’t use PHP. At the moment, it might be simpler to make the call directly, by loading the relevant PHP module and calling the right procedure. However, it would make it hard to integrate carts based on other technologies like Java or Ruby on Rails.
If you have any problems getting your test environment set up, please let me know. The more people who work on this, the less work we all have to do, so I don’t want to exclude anyone. I’m also happy to help if you aren’t sure how to set up Bazaar (or aren’t sure what it does).
Finally, I haven’t had any negative comments about the name AffiliatesForAll. If you don’t like that name, please shout within the next day, because I’m likely to register the project hosting soon. (I’m a bit busy tomorrow though, so it’s unlikely that much will happen from my end.)
Pete
|