Version 3.x
Version 2.x
Capture Behavior Data
Post Data from an Authenticated Server-to-Server Connection
Post Data from an Unauthenticated Server-to-Server Connection
The Data 360 Module for the Engagement Mobile SDK enables collection of profile data through the SDK’s Identity APIs.
Before engagement data can be sent to Data 360:
All iOS code examples on this page require the following imports:
1import Cdp
2import SFMCSDKProfile attributes are set through the SFMCSDK identity module using the identity.edit API. The Data 360 Module subscribes to identity events via the SFMCSDK EventBus and automatically converts them into profile events.
Maps to the identity schema.
1import Cdp
2import SFMCSDK
3
4...
5
6SFMCSdk.identity.edit { identity in
7 identity.addAttributes(attributes: [
8 "firstName": "Guy",
9 "lastName": "Smiley"
10 ])
11 return identity
12}1import com.salesforce.marketingcloud.sfmcsdk.SFMCSdk
2
3...
4
5SFMCSdk.requestSdk { sdk ->
6 sdk.identity.edit {
7 attributes.putAll(mapOf(
8 "firstName" to "First",
9 "lastName" to "Last"
10 ))
11 }
12}Maps to the contactPointEmail schema.
1SFMCSdk.identity.edit { identity in
2 identity.addAttributes(attributes: [
3 "email": "guy.smiley@example.com"
4 ])
5 return identity
6}1SFMCSdk.requestSdk { sdk ->
2 sdk.identity.edit {
3 attributes.put("email", "user@example.com")
4 }
5}Maps to the contactPointPhone schema.
1SFMCSdk.identity.edit { identity in
2 identity.addAttributes(attributes: [
3 "phoneNumber": "555-9999"
4 ])
5 return identity
6}1SFMCSdk.requestSdk { sdk ->
2 sdk.identity.edit {
3 attributes.put("phoneNumber", "5551234567")
4 }
5}Maps to the contactPointAddress schema.
1SFMCSdk.identity.edit { identity in
2 identity.addAttributes(attributes: [
3 "addressLine1": "123 Main Street",
4 "addressLine2": "Apt 3",
5 "city": "Saint John",
6 "stateProvince": "New Brunswick",
7 "country": "Canada",
8 "postalCode": "E2K2K2"
9 ])
10 return identity
11}1SFMCSdk.requestSdk { sdk ->
2 sdk.identity.edit {
3 attributes.putAll(mapOf(
4 "addressLine1" to "123 Main St",
5 "city" to "Springfield",
6 "stateProvince" to "IL",
7 "postalCode" to "62701",
8 "country" to "US"
9 ))
10 }
11}The Data 360 Module only emits a contact point event if the required fields for that type are present in the accumulated attributes and have changed since the last emission (diff-based). The identity modifier closure for iOS must return the modifier object.
Note
When a profile attribute changes, the Data 360 Module triggers an identity profile event containing all set attributes. You can set any name-value pair for profile attributes.
The Identity Schema provided by the recommended Mobile Connector schema for Data 360 contains profile attributes that support identity resolution features when mapped to the appropriate Customer 360 Data Model.
Each identity event contains mappable fields.
firstNamelastNameregistrationIdsoftwareApplicationNameadvertiserIddeviceTypeosNameregistrationIdStarting with Android 13 (API level 33), permission is required to request the device’s advertiserId. In Data 360 2.0.2, this permission is included by default. To prevent this permission from getting merged into your app, add this element to your AndroidManifest.xml:
1<uses-permission android:name="com.google.android.gms.permission.AD_ID" tools:node="remove"/>Each supported contact point has required attributes that must be provided to the SDK’s Identity API. After all attributes are provided, the Data 360 Module triggers a profile event with contact points and an identity event.
The contact points and required attributes that trigger them are:
emailphoneNumberaddressLine1citystateProvincecountryIn the Data 360 Module, all customers are considered known by default. To mark a customer as anonymous, set the isAnonymous profile attribute to "1". Setting isAnonymous to "0" ensures customers are considered known.
1// Mark profile as anonymous
2CdpModule.shared.setProfileToAnonymous()
3// Mark profile as known
4CdpModule.shared.setProfileToKnown()
5
6// Read the current anonymous state
7let isAnonymousValue = SFMCSdk.cdp.getIdentity()?.customProperties?["isAnonymous"] as? String
8let isAnonymous = isAnonymousValue == "1"SFMCSdk.cdp is the accessor for the CDP module on the unified SDK object. CdpModule.shared and SFMCSdk.cdp refer to the same module instance.
1SFMCSdk.requestSdk { sdk ->
2 sdk.identity.edit {
3 attributes.putAll(mapOf(
4 "firstName" to "First",
5 "lastName" to "Last",
6 "isAnonymous" to "1" // "0" for known customer
7 ))
8 }
9}The Engagement Mobile SDK supports sharing identifiers between modules for integration with other Salesforce systems. For example, match an individual using a mobile application with both Data 360 and MobilePush modules to send push notifications to specific anonymous mobile users.
The identity event contains fields that can be mapped to the Party Identification model.
registrationId: Identification NumberWhen the MobilePush module obtains a resolved identity for a mobile customer, it sets a profileId using the SDK’s Identity API. The Data 360 Module is notified and sends a partyIdentification event with these fields:
userId: Identification NumberIDName: Party Identification NameIDType: Party Identification TypeOn Android, you can set the profileId directly to link the device to a known subscriber or profile:
1SFMCSdk.requestSdk { sdk ->
2 sdk.identity.edit {
3 profileId = "subscriber-key-123"
4 }
5}