Identify known customers

How to link a users device to their user profile

If you have a unique ID for your customers and it is available in your mobile or web app then you can send it to Xtremepush to link the app to that customer.

This can enable user related capabilities for device based channels like push notifications or in-app messages.

If you are importing user data into Xtremepush in this way you will be able to:

  • Use customer attributes like first_name to personalise messages
  • Use customer attributes in segmentation to target a specific audience

You will also be able to enable integrations that sync based on user ID. The setUser function is used to identify a known customer at the point your customer ID is available in the app. Review our dedicated guide for details about this function.

You should call this method with your customer ID at the point where that is first available. It is recommended to set the ID every time it is available on app open or when a user logs in to make sure the identity is set.

When integrating you can check that the user ID is setting correctly in the logs if you have enabled debug logs. You can also see if the user ID is set on the platform in Xtremepush, Data > Devices. Your device will have a user ID set in the user ID column if successful.

🚧

Avoid unsetting the user ID

Sending a null or blank value via the setUser method will result in the device being unset from the user profile. This is not something you will want to do. To avoid this add a check for blank or null values when using the setUser method to set the ID.

// Checking that the customer ID is not blank/null before setting it 
if !user_id.isEmpty {
  XPush.setUser(user_id)
}
// Checking that the customer ID is not blank/null before setting it 
if ([user_id length] >0) {
  [XPush setUser:user_id];
}
// Checking that the customer ID is not blank/null before setting it 
public void setUser (String user_id){
  if (user_id != null && !user_id.equals("")) {
    mPushConnector.setUser(user_id);
  }
}
// Checking that the customer ID is not blank/null before setting it
function set_user(title) {
  if (title) {
    xtremepush('set', 'user_id', title);
  }
}

What’s Next