This is part one of a series on building a referral marketing system for your Phoenix server.
One advantage of handling referrals on the back-end instead of with a JS-snippet that calls a third party's service is that you'll have full control of how the system works. Another is that your site won't be slowed down with extra 3rd party scripts that have to be sent to each user or additional XHR requests when your pages load.
This builds on the
auth_plug used in both the StatWatch project and the CMS for Alchemist Camp.
(Source code available for premium members)