AppsFlyerSDK / appsflyer-react-native-plugin

AppsFlyer plugin for React Native
MIT License
273 stars 196 forks source link

How to update customer user id ? #427

Closed dinhphi2205 closed 1 year ago

dinhphi2205 commented 1 year ago

Currently i have use case that need to update customer user id ( after login )

In the document i was noticed that the function setCustomerUserId(userId, callback) Setting your own Custom ID enables you to cross-reference your own unique ID with AppsFlyer’s user ID and the other devices’ IDs. This ID is available in AppsFlyer CSV reports along with postbacks APIs for cross-referencing with you internal IDs. NOTE: This must be set before initSdk is called.

So how can I update customer user id?

github-actions[bot] commented 1 year ago

👋 Hi @dinhphi2205 and Thank you for reaching out to us. In order for us to provide optimal support, please submit a ticket to our support team at support@appsflyer.com. When submitting the ticket, please specify:

Norfeldt commented 1 year ago

@amit-kremer93 @dinhphi2205 It would be helpful if you posted an answer to how to approach it.

Like I wish to collect app installs AND after the user has signed it I want to enrich my data collection.

  1. Landing screen
  2. appsFlyer.initSdk(...)
  3. AppsFlyer records install
  4. User goes to sign in screen
  5. User completes sign in and gets user id '123'
  6. appsFlyer.setCustomerUserId(123)

According to the docs step 6 should not happen before step 2. So do I have to something like this for step 6:

appsFlyer.stop(true, res => {
        appsFlyer.setCustomerUserId('123', () => appsFlyer.initSdk(options))
        // OR ?? since docs says "In any event, the SDK can be reactivated by calling the same API, by passing false.":
        //  appsFlyer.setCustomerUserId('123', () => appsFlyer.stop(false)) 
      })
Norfeldt commented 1 year ago

Reply from customer support:

I saw your comment on the Github issue you opened and I would like to clarify that the note that we have under the setCustomerUserId method is not entirely correct nor mandatory. You can call setCustomerUserId at any point of your application's flow.

The note simply (and after we will fix it) should mention that if you wish to see the CUID (Customer User ID) under your installs raw data reports, it should be called before starting the SDK. There also some other dependencies, partners or integrations that require this to appear on the install event in order to match IDs to their BI system.

If the above is not the case and you simply would like to add additional user id to the events raw data reports, then you can freely call it anytime you need.