CustomerGlu Developer Documentation
  • 🔧Getting started
  • 🔧Quickstart Guide for React Web Apps
  • 📱Quickstart Guide for React Native Apps
  • 📱Quickstart Guide for Flutter Apps
  • Integrating with SDKs
    • Web SDK
    • Mobile SDKs
      • How to Test Integration?
    • Cordova SDK
    • Shopify
  • Integrating with APIs
    • Register User/Device
    • Load Campaigns
    • Binding Webview to Native App Functions
    • 🔍Using __GLU_NUDGE_CLICK for Widget Visibility
    • 🎯API-based Segmentation Quickstart Guide
  • 🔌Third-Party Integrations
    • Source
      • Sending Events directly from Server
      • Segment
      • Moengage
      • Amplitude
      • Clevertap
      • Webengage
    • Destination
      • Analytics Webhook
      • Customer.io
      • Talon.One
      • Segment
      • MoEngage
      • Amplitude
      • Clevertap
      • WebEngage
      • Google Sheets
    • Cohort
      • Mixpanel
  • Miscellaneous Topics
    • Direct Campaign/Wallet URLs
    • Configuring Webhooks
      • Rewards Webhook
      • Nudge Webhook
    • Notifications
      • FCM
      • APNs
      • CustomerGlu Notification
      • Testing Nudges
    • Referral Campaigns
      • Firebase
      • Branch
    • Handling Non Logged-in Users
    • Testing Campaigns with User Logs
    • Using the Editor
      • How to edit Buttons in Campaigns
    • How to Create and Manage Segments in CustomerGlu
  • SCHEMA REPOSITORY
    • Webhook Schema
      • Reward Webhook Schema
      • Nudge Webhook Schema
      • Raw Event Webhook Schema
    • Webview Callback Schema
      • Analytics Event Schema
    • Analytics schema V4
      • Page Events
      • Track Events (UI)
      • Track Events (SDK)
      • State-Change Events
      • System Events
    • 🗝️FAQ
      • API Key
      • How to find and add Screen Names for Entrypoints
  • Demo Apps
    • Demo Apps
Powered by GitBook
On this page
  • Setting up deep link in Firebase
  • Processing referral link from devices
  • referredBy
  • referralCode
  • Processing referral from registration/app download web page

Was this helpful?

  1. Miscellaneous Topics
  2. Referral Campaigns

Firebase

Setting up Firebase Deeplinks and integrating the same with CustomerGlu

PreviousReferral CampaignsNextBranch

Last updated 3 years ago

Was this helpful?

Setting up deep link in Firebase

  • 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

    • iosAppStoreId for ios apps

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

    • Web API Key see above

    • URL Prefix see above eg: <domain-you-entered>.page.link

Processing referral link from devices

// 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

referredBy

Store the referrer userId 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"
}

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:

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

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

    • New user's userId

    • Referred user's userId as referredBy or referral code as referralCode

    • other details that are available

{
    "userId": "userB",
    "userName": "New User",
    "referredBy":  "userA",
    "phone": "932339089012489",
    "email": "userb@testclient.com"
    "customAttributes": {
        "custom_attr_1": "asdas"
    },
    "writeKey": "<writeKey>"
}
  • 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

Please refer to the following documentation for receiving and processing the referral links Android: iOS: The referlink that you extract will be of the format <referrer'sUserId>&referralCode=<code> You can extract this userId by parsing the query parameter of the deepLink like so,

Extract the referrer's userId from the url and make the call to our server with

https://firebase.google.com/docs/dynamic-links/android/receive
https://firebase.google.com/docs/dynamic-links/ios/receive
https://<default-url>/?userId=
deviceRegistration