Collect identity data
Learn how to collect identity data in a mobile app.
ÃÛ¶¹ÊÓƵ Experience Platform Identity Service helps you to gain a better view of your customers and their behaviors by bridging identities across devices and systems, allowing you to deliver impactful, personal digital experiences in real time. Identity fields and namespaces are the glue that joins different data sources together to build the 360-degree real-time customer profile.
Learn more about the and the identity service in the documentation.
Prerequisites
- Successfully built and run app with SDKs installed and configured.
Learning objectives
In this lesson, you will:
- Set up a custom identity namespace.
- Update identities.
- Validate the identity graph.
- Get ECID and other identities.
Set up a custom identity namespace
Identity namespaces are components of Identity Service that serve as indicators of the context to which an identity relates. For example, they distinguish a value of name@email.com
as an email address or 443522
as a numeric CRM ID.
To create a new identity namespace:
-
In the Data Collection interface, select Identities from the left-rail navigation.
-
Select Create identity namespace.
-
Provide a Display name of
Luma CRM ID
and an Identity symbol value oflumaCRMId
. -
Select Cross-device ID.
-
Select Create.
Update identities
You want to update both the standard identity (email) and the custom identity (Luma CRM ID) when the user logs into the app.
-
Navigate to Luma > Luma > Utils > MobileSDK in the Xcode Project navigator and find the
func updateIdentities(emailAddress: String, crmId: String)
function implementation. Add the following code to the function.code language-swift // Set up identity map, add identities to map and update identities let identityMap: IdentityMap = IdentityMap() let emailIdentity = IdentityItem(id: emailAddress, authenticatedState: AuthenticatedState.authenticated) let crmIdentity = IdentityItem(id: crmId, authenticatedState: AuthenticatedState.authenticated) identityMap.add(item:emailIdentity, withNamespace: "Email") identityMap.add(item: crmIdentity, withNamespace: "lumaCRMId") Identity.updateIdentities(with: identityMap)
This code:
-
Creates an empty
IdentityMap
object.code language-swift let identityMap: IdentityMap = IdentityMap()
-
Sets up
IdentityItem
objects for email and CRM ID.code language-swift let emailIdentity = IdentityItem(id: emailAddress, authenticatedState: AuthenticatedState.authenticated) let crmIdentity = IdentityItem(id: crmId, authenticatedState: AuthenticatedState.authenticated)
-
Adds these
IdentityItem
objects to theIdentityMap
object.code language-swift identityMap.add(item:emailIdentity, withNamespace: "Email") identityMap.add(item: crmIdentity, withNamespace: "lumaCRMId")
-
Sends the
IdentityItem
object as part of theIdentity.updateIdentities
API call to the Edge Network.code language-swift Identity.updateIdentities(with: identityMap)
-
-
Navigate to Luma > Luma > Views > General > LoginSheet in the Xcode Project navigator and find the code to execute when selecting the Login button. Add the following code:
code language-swift // Update identities MobileSDK.shared.updateIdentities(emailAddress: currentEmailId, crmId: currentCRMId)
updateIdentities
call. You can also modify previously sent identities.Remove an identity
You can use the API to remove the identity from the stored client-side identity map. The Identity extension stops sending the identifier to the Edge Network. Using this API does not remove the identifier from the server-side identity graph. See View identity graphs for more information on identity graphs.
-
Navigate to Luma > Luma > Utils > MobileSDK in the Xcode Project navigator and add the following code to the
func removeIdentities(emailAddress: String, crmId: String)
function:code language-swift // Remove identities and reset email and CRM Id to their defaults Identity.removeIdentity(item: IdentityItem(id: emailAddress), withNamespace: "Email") Identity.removeIdentity(item: IdentityItem(id: crmId), withNamespace: "lumaCRMId") currentEmailId = "testUser@gmail.com" currentCRMId = "112ca06ed53d3db37e4cea49cc45b71e"
-
Navigate to Luma > Luma > Views > General > LoginSheet in the Xcode Project navigator and find the code to execute when selecting the Logout button. Add the following code:
code language-swift // Remove identities MobileSDK.shared.removeIdentities(emailAddress: currentEmailId, crmId: currentCRMId)
Validate with Assurance
-
Review the setup instructions section to connect your simulator or device to Assurance.
-
In the Luma app
-
Select the Home tab and move the Assurance icon to the left.
-
Select the {width="15/"} icon from the top right.
{width="300"}
-
Provide an email address and a CRM Id, or
-
Select {width="15/"} to randomly generate an Email and CRM ID.
-
Select Login.
{width="300"}
-
-
Look in the Assurance web interface for the Edge Identity Update Identities event from the com.adobe.griffon.mobile vendor.
-
Select the event and review the data in the ACPExtensionEventData object. You should see the identities you updated.
Validate with identity graph
Once you complete the steps in the Experience Platform lesson, you are able to confirm the identity capture in Platforms identity graph viewer:
-
Select Identities in the Data Collection UI.
-
Select Identity Graph from the top bar.
-
Enter
Luma CRM ID
as the Identity namespace and your CRM Id (for example24e620e255734d8489820e74f357b5c8
) as the Identity value. -
You see the Identities listed.
Next: Collect profile data