Handling referrals

I’m working on an invite/referral part of an app and am trying to
figure the best approach to link the user who invited the person with
that person when he/she signs up. Is there a method to generate a url
that includes the inviter’s id? Or is there a better way to do this?