@adobe/react-native-aepcore
is a wrapper around the iOS and Android Adobe Experience Platform Mobile Core Extension to allow for integration with React Native applications.
See Requirements and Installation instructions on the main page
Install the @adobe/react-native-aepcore
package:
npm install @adobe/react-native-aepcore
Initializing the SDK should be done in native code, documentation on how to initialize the SDK can be found here.
In your React Native application, import the core/lifecycle/signal/identity extension as follows:
import { MobileCore, Lifecycle, Signal, LogLevel, PrivacyStatus, Event } from '@adobe/react-native-aepcore'
The collectPii
function lets the SDK to collect sensitive or personally identifiable information (PII).
Syntax
collectPii(data: Record<string, string>)
Example
MobileCore.collectPii({"myPii": "data"});
Dispatch an event for other extensions or the internal SDK to consume.
Syntax
dispatchEvent(event: Event): Promise<boolean>
Example
import {Event} from '@adobe/react-native-aepcore';
var event = new Event("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
MobileCore.dispatchEvent(event);
Syntax
dispatchEventWithResponseCallback: (event: Event, timeoutMS:Number) => Promise<Event>;
Example
import {Event} from '@adobe/react-native-aepcore';
var event = new Event("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
MobileCore.dispatchEventWithResponseCallback(event, 1500).then(responseEvent => console.log("AdobeExperienceSDK: responseEvent = " + responseEvent));
Returns the version of the Core extension
Syntax
extensionVersion(): Promise<string>
Example
MobileCore.extensionVersion().then(version => console.log("AdobeExperienceSDK: MobileCore version: " + version));
This function gets the current log level being used in the SDK.
Syntax
getLogLevel(): Promise<LogLevel>
Example
MobileCore.getLogLevel().then(level => console.log("AdobeExperienceSDK: Log Level = " + level));
This function gets all of the user's identities known by the SDK.
Syntax
getSdkIdentities(): Promise<string>
Example
MobileCore.getSdkIdentities().then(identities => console.log("AdobeExperienceSDK: Identities = " + identities));
Get the current Adobe Mobile Privacy Status
Syntax
getPrivacyStatus(): Promise<string>
Example
MobileCore.getPrivacyStatus().then(status => console.log("AdobeExperienceSDK: Privacy Status = " + status));
The resetIdentities
method requests that each extension resets the identities it owns and each extension responds to this request uniquely.
Syntax
resetIdentities()
Example
MobileCore.resetIdentities();
Set the Adobe Mobile Privacy status
Syntax
setPrivacyStatus(privacyStatus: string)
Example
import {PrivacyStatus} from '@adobe/react-native-aepcore';
MobileCore.setPrivacyStatus(PrivacyStatus.OPT_IN);
Note: PrivacyStatus
contains the following getters:
const OPT_IN = "OPT_IN";
const OPT_OUT = "OPT_OUT";
const UNKNOWN = "UNKNOWN";
Set the logging level of the SDK
Syntax
setLogLevel(mode: LogLevel)
Example
import {LogLevel} from '@adobe/react-native-aepcore';
MobileCore.setLogLevel(LogLevel.VERBOSE);
Important
trackAction is supported through Edge Bridge and Edge Network extensions.
Track event actions that occur in your application.
Syntax
trackAction(action?: string, contextData?: Record<string, string>)
Example
MobileCore.trackAction("loginClicked", {"customKey": "value"});
Important
trackState is supported through Edge Bridge and Edge Network extensions.
Track states that represent screens or views in your application.
Syntax
trackState(state?: string, contextData?: Record<string, string>)
Example
MobileCore.trackState("homePage", {"customKey": "value"});
Update the configuration programmatically by passing configuration keys and values to override the existing configuration.
Syntax
updateConfiguration(configMap?: Record<string, any>)
Example
MobileCore.updateConfiguration({"yourConfigKey": "yourConfigValue"});
You can clear any programmatic updates made to the configuration via the clearUpdatedConfiguration
API.
Syntax
clearUpdatedConfiguration()
Example
MobileCore.clearUpdatedConfiguration();
This function appends Adobe visitor information to the query component of the specified URL.
Syntax
appendVisitorInfoForURL(baseURL?: String): Promise<string>
Example
Identity.appendVisitorInfoForURL("test.com").then(urlWithVisitorData => console.log("AdobeExperienceSDK: VisitorData = " + urlWithVisitorData));
Returns the version of the Identity extension
Syntax
extensionVersion(): Promise<string>
Example
Identity.extensionVersion().then(version => console.log("AdobeExperienceSDK: Identity version: " + version));
This function returns an appropriately formed string that contains the Experience Cloud Identity Service URL variables.
Syntax
getUrlVariables(): Promise<string>
Example
Identity.getUrlVariables().then(urlVariables => console.log("AdobeExperienceSDK: UrlVariables = " + urlVariables));
This function returns all customer identifiers that were previously synced with the Adobe Experience Cloud Identity Service.
Syntax
getIdentifiers(): Promise<Array<VisitorID>>
Example
Identity.getIdentifiers().then(identifiers => console.log("AdobeExperienceSDK: Identifiers = " + identifiers));
This function retrieves the Adobe Experience Cloud ID (ECID) that was generated when the app was initially launched and is stored in the Adobe Experience Cloud Identity Service.
Syntax
getExperienceCloudId(): Promise<string>
Example
Identity.getExperienceCloudId().then(cloudId => console.log("AdobeExperienceSDK: CloudID = " + cloudId));
The syncIdentifier
, syncIdentifiers
and syncIdentifiersWithAuthState
functions update the specified customer IDs with the Adobe Experience Cloud Identity Service.
Syntax
syncIdentifier(identifierType: String, identifier: String, authenticationState: MobileVisitorAuthenticationState)
Example
Identity.syncIdentifier("identifierType", "identifier", MobileVisitorAuthenticationState.AUTHENTICATED);
Syntax
syncIdentifiers(identifiers?: Record<string, string>)
Example
Identity.syncIdentifiers({"id1": "identifier1"});
Syntax
syncIdentifiersWithAuthState(identifiers: Record<string, string> | null, authenticationState: MobileVisitorAuthenticationState)
Example
import {MobileVisitorAuthenticationState} from '@adobe/react-native-aepcore';
Identity.syncIdentifiersWithAuthState({"id1": "identifier1"}, MobileVisitorAuthenticationState.UNKNOWN);
Note: MobileVisitorAuthenticationState
contains the following getters:
const AUTHENTICATED = "VISITOR_AUTH_STATE_AUTHENTICATED";
const LOGGED_OUT = "VISITOR_AUTH_STATE_LOGGED_OUT";
const UNKNOWN = "VISITOR_AUTH_STATE_UNKNOWN";
Submits a generic event containing the provided IDFA with event type generic.identity
.
Syntax
setAdvertisingIdentifier(advertisingIdentifier?: string)
Example
MobileCore.setAdvertisingIdentifier("adID");
Submits a generic event containing the provided push token with event type generic.identity
.
Syntax
setPushIdentifier(pushIdentifier?: string)
Example
MobileCore.setPushIdentifier("pushIdentifier");
import {VisitorID} from '@adobe/react-native-aepcore';
var visitorId = new VisitorID(idOrigin?: string, idType: string, id?: string, authenticationState?: MobileVisitorAuthenticationState)
Note: Implementing Lifecycle via Javascript may lead to inaccurate Lifecycle metrics, therefore we recommend implementing Lifecycle in native Android and iOS code.
To enable Lifecycle metrics for the Edge workflows, see (Lifecycle for Edge Network) (https://developer.adobe.com/client-sdks/documentation/lifecycle-for-edge-network).
Returns the version of the Lifecycle extension
Syntax
extensionVersion(): Promise<string>
Example
Lifecycle.extensionVersion().then(version => console.log("AdobeExperienceSDK: Lifecycle version: " + version));
Returns the version of the Signal extension
Syntax
extensionVersion(): Promise<string>
Example
Signal.extensionVersion().then(version => console.log("AdobeExperienceSDK: Signal version: " + version));