React Native AEP Core Extension
Usage
Initializing and registering the extension
Initializing the SDK should be done in native code, documentation on how to initialize the SDK can be found here.
Updating the SDK configuration:
MobileCore.updateConfiguration({"yourConfigKey": "yourConfigValue"});
Getting the SDK version:
MobileCore.extensionVersion().then(version => console.log("AdobeExperienceSDK: MobileCore version: " + version));
Getting the log level:
MobileCore.getLogLevel().then(level => console.log("AdobeExperienceSDK: Log Level = " + level));
Controlling the log level of the SDK:
import {LogLevel} from '@adobe/react-native-aepcore';
MobileCore.setLogLevel(LogLevel.VERBOSE);
Using the AEP Logging API:
import {LogLevel} from '@adobe/react-native-aepcore';
MobileCore.log(LogLevel.ERROR, "React Native Tag", "React Native Message");
Note: LogLevel
contains the following getters:
const ERROR = "ERROR";
const WARNING = "WARNING";
const DEBUG = "DEBUG";
const VERBOSE = "VERBOSE";
Getting the current privacy status:
MobileCore.getPrivacyStatus().then(status => console.log("AdobeExperienceSDK: Privacy Status = " + status));
Setting the privacy status:
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";
Getting the SDK identities:
MobileCore.getSdkIdentities().then(identities => console.log("AdobeExperienceSDK: Identities = " + identities));
Dispatching an Event Hub event:
import {Event} from '@adobe/react-native-aepcore';
var event = new Event("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
MobileCore.dispatchEvent(event);
Dispatching an Event Hub event with callback:
import {Event} from '@adobe/react-native-aepcore';
var event = new Event("eventName", "eventType", "eventSource", {"testDataKey": "testDataValue"});
MobileCore.dispatchEventWithResponseCallback(event).then(responseEvent => console.log("AdobeExperienceSDK: responseEvent = " + responseEvent));
Collecting PII:
MobileCore.collectPii({"myPii": "data"});
Reset Identities:
MobileCore.resetIdentities();
Getting the extension version:
Identity.extensionVersion().then(version => console.log("AdobeExperienceSDK: Identity version: " + version));
Sync Identifier:
Identity.syncIdentifier("identifierType", "identifier", MobileVisitorAuthenticationState.AUTHENTICATED);
Sync Identifiers:
Identity.syncIdentifiers({"id1": "identifier1"});
Sync Identifiers with Authentication State:
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";
Setting the advertising identifier:
MobileCore.setAdvertisingIdentifier("adID");
Append visitor data to a URL:
Identity.appendVisitorInfoForURL("test.com").then(urlWithVisitorData => console.log("AdobeExperienceSDK: VisitorData = " + urlWithVisitorData));
Get visitor data as URL query parameter string:
Identity.getUrlVariables().then(urlVariables => console.log("AdobeExperienceSDK: UrlVariables = " + urlVariables));
Get Identifiers:
Identity.getIdentifiers().then(identifiers => console.log("AdobeExperienceSDK: Identifiers = " + identifiers));
Get Experience Cloud IDs:
Identity.getExperienceCloudId().then(cloudId => console.log("AdobeExperienceSDK: CloudID = " + cloudId));
Setting the push identifier:
MobileCore.setPushIdentifier("pushIdentifier");
VisitorID Class:
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.
Getting the extension version:
Lifecycle.extensionVersion().then(version => console.log("AdobeExperienceSDK: Lifecycle version: " + version));
Getting the extension version:
Signal.extensionVersion().then(version => console.log("AdobeExperienceSDK: Signal version: " + version));