Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm implementing a referral program on a site and was wondering if there was a best practice in terms of what the referral codes should look like. I assume since we don't want overly long referral codes, we can't just use GUID or anything like that, so I'll have to do checks on the referral codes generated to ensure uniqueness?

share|improve this question

1 Answer 1

I am not sure what exactly you are doing so I will give more than one solution.

1) If you are just worried about length, you could use something called ShortGUID. developed for C#.

2) if you are looking for a more readable format which I assume you might you could use todays date/time and number count that recycles everyday. (or anything using the datetime)

3) If these are referals via web you can use unique URLs like a PURL.

share|improve this answer
    
Yes, looking for referrals via web and email, so something more readable. I was imagining something like a PURL, but what would the PURL look like? Is there a best practice to generate them? –  Wil Dec 8 '10 at 15:54
    
we used GUIDs on the end of our URL. they were sent in an email which the user just clicked. We associated the GUID to a user in our data had a PURL class that represente dit, including the purlID and the userID. We would have an expiration date since it was for account related activity. –  Jonathan Kaufman Dec 8 '10 at 17:42

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.