Set the Party Identifier

The party identifier is a unique identifier that represents an individual in Marketing Cloud. It can be a customer ID, mobile number, email address, loyalty number, or another value.

Skip this step if you want to send only to anonymous users. For an anonymous user, the party identifier is a random GUID.

Note

To set the party identifier for Android apps, use this code example.

1SFMCSdk.requestSdk { sfmcSdk ->
2  // Set/Update values in identity
3  sfmcSdk.identity.edit {
4    partyIdentificationNumber = "uniquelyIdentifyingNumber"
5    partyIdentificationName = "uniquelyIdentifyingName"
6    partyIdentificationType = "uniquelyIdentifyingType"
7  }
8  // Read values from Identity
9  val partyIdentificationNumber = sfmcSdk.identity.partyIdentificationNumber
10  val partyIdentificationName = sfmcSdk.identity.partyIdentificationName
11  val partyIdentificationType = sfmcSdk.identity.partyIdentificationType
12}

To set the party identifier for iOS apps, use this code example.

1// Set party details for all modules
2SFMCSdk.identity.edit { [self] model in
3  model.partyIdentificationNumber = "uniquelyIdentifyingNumber"
4  model.partyIdentificationName = "uniquelyIdentifyingName"
5  model.partyIdentificationType = "uniquelyIdentifyingType"
6  return model
7}
8// Retrieve the party details
9let partyIdentificationNumber = SFMCSdk.identity.get()?.partyIdentificationNumber
10let partyIdentificationName = SFMCSdk.identity.get()?.partyIdentificationName
11let partyIdentificationType = SFMCSdk.identity.get()?.partyIdentificationType

Optimize API calls to Marketing Cloud Next by updating the locally stored Individual record only when your app is in the foreground. If your app is in the background, the SDK initializes to show a notification or to pre-cache messages, resulting in unnecessary communication with Marketing Cloud Next.

Tip