The CUID enables you to group events of the same user across different devices, media sources, or channels.
What is CUID?
The Customer User ID (CUID) is a unique user identifier. The app owner usually generates and sets it at the time of user registration. The CUID lets app owners follow user journeys across different devices.
Example
A user with two or more devices has the same CUID across apps. Each time the user performs an event on a mobile or desktop device, the SDK captures the event along with the CUID. This enables the advertiser to combine the devices' data into a holistic user view.
A few use cases:
- In-app purchases made by the same user in the same app across multiple devices (phone, tablet, TV, desktop) can be combined into a single view.
- You can share user performance data across multiple platforms (desktop, mobile, TV) to achieve a holistic user experience.
Setting the CUID
It's recommended to set the CUID as early as possible in the SDK initialization flow so that as many events as possible can be associated with a CUID.
Android native
Once the CUID is available, you can set it by calling setCustomerUserID. You can only associate the CUID with in-app events occurring after you set it. Therefore, the install event will not carry the CUID when you call start before setCustomerUserID.
Associate the CUID with the install event
If you need to associate the install event to the CUID, we recommend setting it before calling start.
Important: Remember that setting the CUID before start may block the SDK from sending the install event and thus prevent the attribution from happening. This can occur, for example, when the user launches the application for the first time and then exits before the SDK can set the CUID.
In Android, you can run the start method and CUID setup from either the global Application class or an Activity class, depending on the app implementation. For more information, see Select in what class to start the SDK.
If the SDK starts in the Application class
If you want to associate the CUID with the install event when starting from the global Application class, make sure to delay sending out the install event using the waitForCustomerUserId method. This method puts the SDK in waiting mode until the CUID is set.
Note: If, for some reason, setting the CUID fails, the SDK will remain in waiting mode and will not send any events.
If the SDK starts in an Activity class
If you want to associate the CUID with the install event when starting from an Activity class, you don't have to delay sending the install event. Simply call setCustomerUserId before calling start.
Developer instructions
Tell the developer the following:
- Use
waitForCustomerUserIdif the SDK starts in the globalApplicationclass - Developer links:
- If you want to associate the CUID with the install event, see here.
iOS native
Use the customerUserId method to set the CUID. The location of customerUserId in relation to the start method determines which events you can associate with the CUID.
- If you call
customerUserIdbefore callingstart, the SDK associates the CUID with the install and the following in-app events - If you call it after
start, the SDK only associates the CUID with events recorded after you set it.
Developer instructions
Refer your developer to Setting the Customer User ID in the Dev Hub.
Unity
Developer instructions
Refer your developer to Setting the Customer User ID in the Dev Hub.
React Native
Developer instructions
Refer your developer to setCustomerUserId API reference in the Dev Hub.
Web
For the full implementation walkthrough, see Set customer user ID in Integrate AppsFlyer Web SDK.
CUID and privacy
AppsFlyer values and respects the privacy of your users and doesn't permit the collection or transfer of sensitive personal data to the AppsFlyer platform.
To protect your users' privacy, you must not design the CUID to contain information that directly identifies the user. This includes social security or national identification numbers.
If the CUID contains a user's email address or phone number, you must hash it before sending it to AppsFlyer. Never send unhashed CUIDs containing personal data to AppsFlyer.
See also
- User journey reports (for more about the CUID in raw data reports)
- Google best practices to avoid sending PII