Referrals

Setup guide to tracking user's invites and shares with Glu Programs
  • Log into your firebase account

  • Go to Dynamic Link section

  • Click on Add URL Prefix

  • Enter the domain name you want to create. From the drop-down select a Google-Provided domains Eg: <domain-you-entered>.page.link

  • Share the WebAPI key with CustomerGlu from your firebase console. It can be found Settings > General> Web API Key

  • Share following with CustomerGlu

    • androidPackageName for android apps

    • iosBundleId for ios apps

    • Default URL to redirect to if opened from outside ios or android ecosystem

Please refer to the following documentation for receiving and processing the referral links Android: https://firebase.google.com/docs/dynamic-links/android/receive IOS: https://firebase.google.com/docs/dynamic-links/ios/receive The referlink that you extract will be of the format https://<default-url>/?userId=<referrer'sUserId> You can extract this userId by parsing the query parameter of the deepLink like so,

// Android
String referrerUserId = deepLink.getQueryParameter("userId");
//iOS
let queryItems = URLComponents(url: deepLink, resolvingAgainstBaseURL: true)?.queryItems
let referrerUserId = queryItems?.filter({(item) in item.name == "userId"}).first?.value

Store this referrerUserId information and pass it as referredBy property in the device registration call for the new user

{
"userId": "<new-user-Id>",
"deviceId": "asd",
"deviceName": "TestDevice",
"deviceType": "android",
"writeKey": "write-key",
"firebaseToken": "firebase-token",
"referredBy": "referrerUserId"
}

On installation where there is no referrer, you need not send referredBy property in the call