let queryItems = URLComponents(url: deepLink, resolvingAgainstBaseURL: true)?.queryItems
6
let referrerUserId = queryItems?.filter({(item) in item.name == "userId"}).first?.value
Copied!
referredBy
Store the referrer userId information and pass it as referredBy property in the device registration call for the new user:
1
{
2
"userId":"<new-user-Id>",
3
"deviceId":"asd",
4
"deviceName":"TestDevice",
5
"deviceType":"android",
6
"writeKey":"write-key",
7
"firebaseToken":"firebase-token",
8
"referredBy":"referrerUserId"
9
}
Copied!
Note: On installation where there is no referrer, you need not send referredBy property in the call
referralCode
Store the referral code information and pass it as referralCode property in the device registration call for the new user:
1
{
2
"userId":"<new-user-Id>",
3
"deviceId":"asd",
4
"deviceName":"TestDevice",
5
"deviceType":"android",
6
"writeKey":"write-key",
7
"firebaseToken":"firebase-token",
8
"referralCode":"ABC-123"
9
}
Copied!
Note: On installation where there is no referrer, you need not send referralCode property in the call
​
Processing referral from registration/app download web page
If your app is not available in the play/app store and you have an app download flow via a webpage, please follow the below steps
Provide download page URL to CustomerGlu, eg: https://testclient.com/register
When a user clicks on the referralLink he will be redirected to the default URL provided to us with referrer's userId appended as a query parameter. eg:
https://testclient.com/register?userId=userA
Extract the referrer's userId from the url and make the deviceRegistration call to our server with
New user's userId
Referred user's userId as referredBy or referral code as referralCode
Once the user installs the app and is registered with the same userId (eg: userB in this case), his referral information will be attached to the new user