I have an app where each user can invite his friends to join the app.
I have done this via the JS FB SDK.
I also use PHP SDK for server sessions and other things.
Now the questions is how can I determine the id of the inviter when an user joins my app based on the invitation sent?
EG: Let's say USER-X invites USER-Z to join my app. Then USER-Y invites USER-Z to join my app too. But USER-Z joins through the link of USER-X. I want to reward USER-X because he brought a new user to my app, so I need his fbid or something. How can I do determine the referer?
I have used this code to implement the Facebook friends invite on my website:
<script src="https://connect.facebook.net/en_US/all.js"></script>
<script type="text/javascript">
FB.init({
appId:'<?=APPID?>',
cookie:true,
status:true,
xfbml:true
});
function FBInvite(){
FB.ui({
method: 'apprequests',
message: 'Invite your Facebook Friends'
},function(response) {
if (response) {
alert('Successfully Invited');
} else {
alert('Failed To Invite');
}
});
}
</script>
<a href="#" onclick="FBInvite();">OPEN INVITE POPUP</a>