What profile system are you using to save this information? We have built-in integration with JomSocial, Community Builder, Kunena and a few others. What you're doing isn't something we do natively, but wouldn't be overly difficult to add.
However, it's also something you may want a separate plugin altogether for since our solution would only work for Facebook registrations, not normal Joomla registrations. A User plugin that hooks into "onUserSave" would likely let you save the referrer id for both types of registrations.
Hope that helps, but if you have any questions, let us know. If you subscribe, and need help implementing the referrer id stuff for Facebook registrations, we can gladly help with that as well.
Thanks,
Alex