Sign up ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free.

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

closed as unclear what you're asking by MichaelT, Snowman, durron597, Ixrec, Bart van Ingen Schenau Sep 22 at 17:22

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question.If this question can be reworded to fit the rules in the help center, please edit the 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

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