To track who or what referred your Members to your community, create a custom profile question for Referred By: and tell your members to fill out that field.