收集身份数据
了解如何在移动应用程序中收集身份数据。
Adobe Experience Platform Identity Service通过跨设备和系统桥接身份,允许您实时提供有影响力的个人数字体验,从而帮助您更好地了解客户及其行为。 身份字段和命名空间是将不同数据源连接在一起的粘合剂,可构建360度实时客户档案。
先决条件
- 在安装和配置SDK的情况下成功构建和运行应用程序。
学习目标
在本课程中,您将执行以下操作:
- 设置自定义身份命名空间。
- 更新身份。
- 验证身份图。
- 获取ECID和其他身份。
设置自定义身份命名空间
身份命名空间是的组件 Identity Service 作为与身份相关的上下文指示器。 例如,它们区分值 name@email.com
作为电子邮件地址或 443522
作为数字CRM ID。
要创建新的身份命名空间,请执行以下操作:
-
在数据收集界面中,选择 身份 从左边栏导航中。
-
选择 创建身份命名空间。
-
提供 显示名称 之
Luma CRM ID
和 身份符号 值lumaCRMId
. -
选择 跨设备ID.
-
选择 创建。
更新身份
当用户登录应用程序时,您希望同时更新标准身份(电子邮件)和自定义身份(Luma CRM ID)。
-
导航到 Luma > Luma > Utils > MobileSDK 在Xcode项目导航器中查找
func updateIdentities(emailAddress: String, crmId: String)
函数实现。 将以下代码添加到函数中。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)
此代码:
-
创建空的
IdentityMap
对象。code language-swift let identityMap: IdentityMap = IdentityMap()
-
设置
IdentityItem
电子邮件和CRM ID的对象。code language-swift let emailIdentity = IdentityItem(id: emailAddress, authenticatedState: AuthenticatedState.authenticated) let crmIdentity = IdentityItem(id: crmId, authenticatedState: AuthenticatedState.authenticated)
-
添加这些
IdentityItem
对象到IdentityMap
对象。code language-swift identityMap.add(item:emailIdentity, withNamespace: "Email") identityMap.add(item: crmIdentity, withNamespace: "lumaCRMId")
-
发送
IdentityItem
对象,作为Identity.updateIdentities
对Edge Network的API调用。code language-swift Identity.updateIdentities(with: identityMap)
-
-
导航到 Luma > Luma > Views > General > 登录表 在Xcode项目导航器中,找到要在选择 登录 按钮。 添加以下代码:
code language-swift // Update identities MobileSDK.shared.updateIdentities(emailAddress: currentEmailId, crmId: currentCRMId)
updateIdentities
呼叫。 您还可以修改以前发送的身份。删除身份
您可以使用 Identity.removeIdentity
用于从存储的客户端身份映射中删除身份的API。 Identity扩展停止向Edge Network发送标识符。 使用此API不会从服务器端标识图中删除标识符。 请参阅 查看身份图 以了解有关身份图的详细信息。
-
导航到 Luma > Luma > Utils > MobileSDK 在Xcode项目导航器中,将以下代码添加到
func removeIdentities(emailAddress: String, crmId: String)
函数: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"
-
导航到 Luma > Luma > Views > General > 登录表 在Xcode项目导航器中,找到要在选择 注销 按钮。 添加以下代码:
code language-swift // Remove identities MobileSDK.shared.removeIdentities(emailAddress: currentEmailId, crmId: currentCRMId)
使用保障进行验证
-
查看 设置说明 部分以将模拟器或设备连接到Assurance。
-
在Luma应用程序中
-
选择 主页 选项卡,并将“保证”图标向左移动。
-
选择+-------------+ | img-md | +=============+ | w-15 | +-------------+ | | +-------------+图标。
img-md w-300 -
提供电子邮件地址和CRM ID,或者
-
选择+-------------+ | img-md | +=============+ | w-15 | +-------------+ | | +-------------+随机生成 电子邮件 和 CRM ID.
-
选择 登录.
img-md w-300
-
-
在Assurance Web界面中查看 Edge Identity更新身份 来自的事件 com.adobe.griffon.mobile 供应商。
-
选择事件并查看 ACPExtensionEventData 对象。 您应该会看到已更新的身份。
使用身份图进行验证
一旦您完成 Experience Platform课程,您便能够在Platforms身份图查看器中确认身份捕获:
-
选择 身份 在数据收集UI中。
-
选择 身份图 从顶部栏中。
-
输入
Luma CRM ID
作为 身份命名空间 和您的CRM ID(例如,24e620e255734d8489820e74f357b5c8
)作为 标识值. -
您会看到 身份 已列出。
Identity.resetIdentities
和 MobileCore.resetIdentities
API调用。 但是,在使用推送通知标识符时,请注意(请参阅 发送推送通知),则该标识符将成为设备上的另一个“粘性”配置文件标识符。下一步: 收集配置文件数据