@adobe/react-native-aepedgeidentity

中文文档
7.0.0发布于 2025/03/29Apache-2.0TypeScriptCommonJS零依赖近 30 天下载 7.2万

Adobe Experience Platform Identity for Edge Network extension for Adobe Experience Platform Mobile SDK. Written and maintained by Adobe.

原始使用文档
文档目录19 节
  1. Prerequisites
  2. Installation
  3. Usage
  4. Initializing with SDK:
  5. Importing the extension:
  6. API reference
  7. extensionVersion:
  8. getExperienceCloudId:
  9. getIdentities:
  10. getUrlVariables:
  11. removeIdentity:
  12. resetIdentity:
  13. setAdvertisingIdentifier:
  14. updateIdentities:
  15. Public Classes
  16. IdentityMap
  17. IdentityItem
  18. AuthenticatedState
  19. Frequently Asked Questions (FAQ)

React Native Adobe Experience Platform Identity for Edge Network Extension

npm version npm downloads

@adobe/react-native-aepedgeidentity is a wrapper around the iOS and Android Adobe Experience Platform Identity for Edge Network Extension to allow for integration with React Native applications.

Prerequisites

The Adobe Experience Platform Identity for Edge Network extension has the following peer dependency, which must be installed prior to installing the identity extension:

Installation

See Requirements and Installation instructions on the main page

Install the @adobe/react-native-aepedgeidentity package:

NPM:

npm install @adobe/react-native-aepedgeidentity

Yarn:

yarn add @adobe/react-native-aepedgeidentity

Usage

Initializing with SDK:

To initialize the SDK, use the following methods:

Refer to the root Readme for more information about the SDK setup.

Importing the extension:

In your React Native application, import the Identity extension as follows:

import {Identity} from '@adobe/react-native-aepedgeidentity';

API reference

extensionVersion:

Returns the version of the Identity for Edge Network extension

Syntax

extensionVersion(): Promise<string>

Example

Identity.extensionVersion().then(version => console.log("AdobeExperienceSDK: EdgeIdentity version: " + version));

getExperienceCloudId:

This API retrieves the ECID that was generated when the app was initially launched. This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall. A promise method which will be invoked once the Experience Cloud ID is available or rejected if an unexpected error occurred or the request timed out.

Syntax

getExperienceCloudId(): Promise<string>

Example

Identity.getExperienceCloudId().then(experienceCloudId => console.log("AdobeExperienceSDK: Experience Cloud Id = " + experienceCloudId));

getIdentities:

Get all the identities in the Identity for Edge Network extension, including customer identifiers which were previously added. A promise method which will be invoked once the identities are available or rejected if an unexpected error occurred or the request timed out.

Syntax

getIdentities(): Promise<IdentityMap>

Example

Identity.getIdentities().then(identities => console.log("AdobeExperienceSDK: Get Identities = " + JSON.stringify(identities)));

getUrlVariables:

Returns the identifiers in a URL's query parameters for consumption in hybrid mobile applications. The response will not return any leading & or ?, since the caller is responsible for placing the variables in the resulting URL in the correct locations. If an error occurs while retrieving the URL variables, the callback handler will return a null value. Otherwise, the encoded string is returned. An example of an encoded string is as follows: "adobe_mc=TS%3DTIMESTAMP_VALUE%7CMCMID%3DYOUR_ECID%7CMCORGID%3D9YOUR_EXPERIENCE_CLOUD_ID"

  • MCID: This is also known as the Experience Cloud ID (ECID).
  • MCORGID: This is also known as the Experience Cloud Organization ID.
  • TS: The timestamp that is taken when the request was made.

Syntax

getUrlVariables(): Promise<string>

Example

Identity.getUrlVariables().then(urlVariables => console.log("AdobeExperienceSDK: URL Variables = " + urlVariables));

removeIdentity:

Remove the identity from the stored client-side IdentityMap. The Identity extension will stop sending the identifier to the Edge Network. Using this API does not remove the identifier from the server-side User Profile Graph or Identity Graph.

Identities with an empty id or namespace are not allowed and are ignored.

Removing identities using a reserved namespace is not allowed using this API. The reserved namespaces are:

  • ECID
  • IDFA
  • GAID

Syntax

removeIdentity(item: IdentityItem, namespace: string)

Example

let identityItem  = new IdentityItem("[email protected]");
Identity.removeIdentity(identityItem, "Email");

resetIdentity:

Clears all identities stored in the Identity extension and generates a new Experience Cloud ID (ECID) . Using this API does not remove the identifiers from the server-side User Profile Graph or Identity Graph.

:information_source: The Identity for Edge Network extension does not read the Mobile SDK's privacy status and therefor setting the SDK's privacy status to opt-out will not clear the identities from the Identity for Edge Network extension.

For more details, see theMobileCore.resetIdentities API.

setAdvertisingIdentifier:

When this API is called with a valid advertising identifier, the Identity for Edge Network extension includes the advertising identifier in the XDM Identity Map using the namespace GAID (Google Advertising ID) in Android and IDFA (Identifier for Advertisers) in iOS. If the API is called with the empty string (""), null/nil, or the all-zeros UUID string values, the advertising identifier is removed from the XDM Identity Map (if previously set). The advertising identifier is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall.

Syntax

setAdvertisingIdentifier(advertisingIdentifier?: string)

Example

MobileCore.setAdvertisingIdentifier("adID");

updateIdentities:

Update the currently known identities within the SDK. The Identity extension will merge the received identifiers with the previously saved ones in an additive manner, no identities are removed from this API.

Identities with an empty id or namespace are not allowed and are ignored.

Updating identities using a reserved namespace is not allowed using this API. The reserved namespaces are:

  • ECID
  • IDFA
  • GAID

Syntax

updateIdentities(identityMap: IdentityMap)

Example

let identityItem  = new IdentityItem("[email protected]");
let map = new IdentityMap();
map.addItem(identityItem, "Email");
Identity.updateIdentities(map);

Public Classes

IdentityMap

Defines a map containing a set of end user identities, keyed on either namespace integration code or the namespace ID of the identity. The values of the map are an array, meaning that more than one identity of each namespace may be carried. The format of the IdentityMap class is defined by the XDM Identity Map Schema.

For more information, please read an overview of the AEP Identity Service.

"identityMap" : {
    "Email" : [
      {
        "id" : "[email protected]",
        "authenticatedState" : "authenticated",
        "primary" : false
      }
    ],
    "Phone" : [
      {
        "id" : "1234567890",
        "authenticatedState" : "ambiguous",
        "primary" : false
      },
      {
        "id" : "5557891234",
        "authenticatedState" : "ambiguous",
        "primary" : false
      }
    ],
    "ECID" : [
      {
        "id" : "44809014977647551167356491107014304096",
        "authenticatedState" : "ambiguous",
        "primary" : true
      }
    ]
  }

Example

let map = new IdentityMap();

// Add an item
let identityItem  = new IdentityItem("[email protected]");
map.addItem(identityItem, "Email");

// Remove an item
let identityItem  = new IdentityItem("[email protected]");
map.removeItem(identityItem, "Email");

//Get a list of items for a given namespace
let namespacecheck = map.getIdentityItemsForNamespace("Email");

//Get a list of all namespaces used in current IdentityMap
let namespaces = map.getNamespaces();

//Check if IdentityMap has no identities
let hasNoIdentities = map.isEmpty();

IdentityItem

Defines an identity to be included in an IdentityMap.

The format of the IdentityItem class is defined by the XDM Identity Item Schema.

Example

// Initialize
let item  = new IdentityItem("identifier");

let item  = new IdentityItem("identifier", AuthenticatedState.AUTHENTICATED, false);

//Getters
let id = item.id;
let state = item.authenticatedState;
let primary = item.primary

AuthenticatedState

Defines the state an Identity Item is authenticated for.

The possible authenticated states are:

  • Ambiguous - the state is ambiguous or not defined
  • Authenticated - the user is identified by a login or similar action
  • LoggedOut - the user was identified by a login action at a previous time, but is not logged in now

Syntax

 export enum AuthenticatedState {
   AUTHENTICATED = 'authenticated',
   LOGGED_OUT = 'loggedOut',
   AMBIGUOUS = 'ambiguous'
 }

Frequently Asked Questions (FAQ)

For more details, refer to the frequently asked questions page

版本与发布记录

@adobe/react-native-aepedgeidentity 共发布 12 个版本,首次发布于 2021/09/08;过去 12 个月发布了 0 个版本。

版本发布日期距今
7.0.0latest2025/03/291.6 年前
6.0.22024/06/072 年前
6.0.12024/04/242 年前
6.0.02024/04/132 年前
5.0.02023/06/213 年前
2.0.02023/03/103 年前

关于 @adobe/react-native-aepedgeidentity 的常见问题

@adobe/react-native-aepedgeidentity 是什么?

Adobe Experience Platform Identity for Edge Network extension for Adobe Experience Platform Mobile SDK. Written and maintained by Adobe.

如何安装 @adobe/react-native-aepedgeidentity?

在项目目录运行 npm install @adobe/react-native-aepedgeidentity,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:react-native(>=0.60.0)、@adobe/react-native-aepcore(^7.0.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@adobe/react-native-aepedgeidentity 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adobe/react-native-aepedgeidentity 支持 ESM 还是 CommonJS?

以 CommonJS 形式发布,可以直接 require();在 ES Module 项目中也可以用 import 引入(Node.js 会把 module.exports 作为默认导出)。

@adobe/react-native-aepedgeidentity 可以商用吗?

@adobe/react-native-aepedgeidentity 使用 Apache-2.0 许可。宽松许可:允许商业使用、修改和再分发,并附带明确的专利授权;分发时需保留许可与 NOTICE 文件,修改过的文件要注明改动。以上为概括,不构成法律意见,请以许可原文为准。

@adobe/react-native-aepedgeidentity 的下载量有多少?

根据 npm 官方下载统计,@adobe/react-native-aepedgeidentity 在 2026/10/05 – 2026/11/03 这 30 天内被下载 71,605 次,日均约 2,387 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adobe/react-native-aepedgeidentity 还在维护吗?

最新版本 7.0.0 发布于 2025/03/29(1.6 年前);至今共发布 12 个版本,其中过去 12 个月发布了 0 个;首次发布于 2021/09/08。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。