My name is Bojan, the maintainer of Ubercart Affiliate 2, currently working with Ryan Szrama on a new generation Affiliate module for Drupal 7, with integration for Drupal Commerce.
This is a Google Summer of Code project.
Ryan and me talked about the basic design details, and decided to put it up here for discussion.
My GSoC proposal is here.
My drupal.org project page is here.
The project has two large phases:
1) Building the basic affiliate functionality, in the affiliate_ng module.
2) Building the commerce_affiliate module which will integrate with affiliate_ng and offer Drupal Commerce integration (commissions, payments, etc).
I will be committing the first code to CVS in the next 24h.
The planned layout is similar to the one drupal commerce uses, and the module is split into affiliate_ng.module and affiliate_ng_ui.module. We use views for all listing pages.
The module provides two main permissions, "act as an affiliate" and "use custom affiliate codes".
The first role gives each user access to his affiliate center, where he can generate links, view reports (about people he brought to the site), etc. His uid is his default affiliate code (so mysite.com/affiliate/4 registers a click for affiliate who has the uid: 4). The "affiliate/" part of the url needs to be customizable at a basic level (uc_affiliate2 has a drupal variable that specifies it, for advanced usage scenarios...)
However, the user can have more than one affiliate code. If he has the "use custom affiliate codes" permission, he is able to access a page in his Affiliate Center where he can specify different affiliate codes which can be used to bring users to the site. That way he can track different campaigns and see the effectiveness of his referrals through the statistics in the Affiliate Center.
These custom codes need to be alphanumeric so that we don't mix them up with uids.
The affiliate code is an entity (affiliate_code), containing a serial id, the uid, the code itself, and the created timestamp.
Since we have the uid -> code mapping, we can check if the user still has the "act as an affiliate" permission, and if not, deny the click. That way the admin can disable certain users/groups of users. This requires a user_load each time an affiliate link is invoked, but that is unavoidable.
The clicks db table has a row for each click, with the affiliate uid, the code used, the timestamp, referrer and destination.
This provides us the desired granularity. This is not an entity since we don't need fields/revisions in this case. This data will be integrated into views through a custom handler.
The basic affiliate code (the uid) is inserted into affiliate_code the first time the user visits his Affiliate Center. This is because we have no way to react to a permission change (no API hook in Drupal...)
This is the first part of the story. After this is done, I will post more details up for discussion.
So, tell me, what do you think? If you disagree with anything I've written above, now's the right time to say it.
Also, What are you looking for in a affiliate solution?
I'm interested to hear your thoughts.
I wasn't specific enough about the module structure. We have:
- help/ -> advanced_help files
- includes/views/ -> Views used in affiliate_ng_ui.module
- tests/ -> SimpleTests
- theme/ -> theme tpl files
- translations/ -> generated translation files
As I said, the commerce integration will be in another module called "commerce_affiliate"/
I was about to comment on how
I was about to comment on how I have a hate the NG label as it sounds too much like a marketing gimmick to me. But I have just seen and commented on the issue (http://drupal.org/node/787732) about you not being able to use the affiliate name instead.
Can't see any issues with what you have proposed so far.
I have just put up a proposal for how I see payment processing functionality working in commerce and any other module that wants to be able to process payments: http://www.drupalcommerce.org/node/152
This might be something that the affiliate system might be want to consider when handle paying affiliates. The affiliate module is actually a good example of a case where you may want to process payments to affiliates, but you may not have a need to use all the other commerce module(s) and therefore the reason why I think the payment processing functionality should be a separate project to commerce.
I'm not really a fan of the
I'm not really a fan of the _ng suffix either, but there's not a lot of choice in the suffix-land :)
If you have any ideas for a name, I'm open for suggestion.
In any case, the project has a home now, and we might even go with "affiliate" someday (too bad I couldn't get access...)
Read your proposal on the payment processing. Sounds good (especially if it's independent of Drupal Commerce).
Hey Bojan, What about using
What about using the plural form, affilateS
bojanz, Thanks for developing
Thanks for developing a D7 affiliate module. I'm sure it will be appreciated by the community. I use your Affiliate 2 module on a few of my sites. I love the idea of allowing an affiliate to have several codes.
May I just make one suggestion: The UI for adding and maintaining affiliate banners and links is not completely user friendly in Affiliate 2. I haven't looked at the work you've done as of yet, but it would be nice to have at least a way to upload banners in the interface.
Again, thank you!
Nice way of saying it
Nice way of saying it "completely sucks". I totally agree, and plan to devote more time to the UI in commerce_affiliate.
I'm currently a bit busy helping get Views ready for D7 (with what little free time I have), my next plan is to find a new maintainer for uc_affiliate2 (a member already volunteered, we'll see if it works out) and to devote some time to commerce_affiliate.
Social aspect of Affiliates
Would it be possible to link an affiliate to each new user who joins using their code automatically, similar to Tom on MySpace.
Basically, after a new user joins. Based on the affiliate code they use, that affiliate will be linked to in the user's profile page as in a block like "Ask if you need help" kind of thing, thus establishing a direct link to the affiliate so that they receive assistance and guidance.
It could be used with a variety of current Drupal modules such as User Relationships or something.
Is Drupal good?
As an affilate, I'm interested if Drupal is as easy as the wordpress for creating affiliate based sites? I heard a lot about Drupal platform, however looks like not may marketers stick to using Drupal. Is is hard to install and maintain?
Drupal is excellent for
Drupal is excellent for long-term strategies that look toward growth and expansion. Hence why The White House, The House of Representatives, The Grammies and ... Martha Stewart have launched their sites on it.
I wouldn't characterize it as easy, but nothing good ever is. I'm not familiar with any affiliate plugins for Wordpress, but I'd imagine they are okay for getting the basics of the job done. I'm not convinced WP is a strong enough solution for user management, so I know I wouldn't choose it for keeping track of high-value data... like people's money.
Drupal Commerce is (as of today) still in the development stage and a solid affiliate add-on to it is in an even earlier stage, so if you need something now, I'd recommend looking into Drupal 6 + Ubercart 2 + Affiliate 2.
If you're really new to Drupal, I'd recommend taking some time to watch this video.
I used the affiliate 2 module in 6 but had to make some code changes. Here are some of my thoughts/experiences.
We have two levels of affiliates: shopkeepers and account managers.
Each shopkeeper gets their own subdomain site. Basically the system sets a logo and banner at the top of the page to reflect their shop name. Some shopkeepers have different roles to sell different product.
One of the bigger problems I had was commission calculation for 2 deep. The formula was to take off 20% at level 1, then for level 2 take off 5% from the remainder.
Also had to customize affiliate banners based on shopkeeper roles.
Overall I couldn't do this system without this module.
I pretty much hacked apart
I pretty much hacked apart the original Ubercart affiliate module... and screwed myself for the Affiliate 2 upgrade. I felt bad for forking it, but the module was really lacking.
I'm attaching what I changed (if you care to weed through it), but to summarize, it was missing:
Also, I feel like banners are totally pointless to do here. Do it with CCK & Views!