Re:Ask HN: Affiliate Programs
by jarin on Monday May 17, 2010 @04:45AM
(#1353881)
I built something exactly like this in Rails for a client, and it was cake. As long as your affiliate commissions aren't excessive (like the 70% commissions in the porn industry), you really don't have to worry too much about click fraud either.
It only took about a day in rails.
- make a migration to add "referrer_id" to users table
- put a before filter in application_controller to watch for a special param used in affiliate codes, if it exists store in session
- when new users sign up set their referrer_id out of the session if it exists
- whenever the "action" is taken by the user that triggers a referral commission, put this is pending transactions
- use a monthly cron job and paypal gem to send affiliate commission each month
That was the gist anyway.