Identity API reference

appendVisitorInfoForURL

Android
iOS
React Native
Flutter
Android

This API appends Adobe visitor information to the query component of the specified URL.

If the provided URL is null or empty, it is returned as is. Otherwise, the following information is added to the query component of the specified URL and is returned in the AdobeCallback instance:

  • The adobe_mc attribute is a URL encoded list that contains:

    • MCMID - Experience Cloud ID (ECID)

    • MCORGID - Experience Cloud Org ID

    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension

    • TS - A timestamp taken when this request was made

  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

When AdobeCallbackWithError is provided, and you are fetching the attributes from the Mobile SDK, the timeout value is 500ms. If the operation times out or an unexpected error occurs, the fail method is called with the appropriate [AdobeError]https://aep-sdks.gitbook.io/docs/using-mobile-extensions/mobile-core/mobile-core-api-reference#adobeerror).

Java

appendVisitorInfoForURL

Syntax

public static void appendVisitorInfoForURL(final String baseURL, final AdobeCallback<String> callback);
  • baseUrl is the URL to which the visitor information needs to be appended. If the visitor information is nil or empty, the URL is returned as is.

  • callback is invoked after the updated URL is available.

Example

Identity.appendVisitorInfoForURL("https://example.com", new AdobeCallback<String>() {
@Override
public void call(String urlWithAdobeVisitorInfo) {
//handle the new URL here
//For example, open the URL on the device browser
//
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse(urlWithAdobeVisitorInfo));
startActivity(i);
}
});

This API is designed to handle the following URL formats:

scheme://authority/path?query=param#fragment

In this example, the Adobe visitor data is appended as:

scheme://authority/path?query=param&TS=timestamp&MCMID=ecid&MCORGID=ecorgid@AdobeOrg#fragment

Similarly, URLs without a query component:

scheme://authority/path#fragment

The Adobe visitor data is appended as:

scheme://authority/path?TS=timestamp&MCMID=ecid&MCORGID=ecorgid@AdobeOrg#fragment

If your application uses more complicated URLs, such as Angular URLs, we recommend that you use getUrlVariables.

iOS

appendToURL

Method appendToUrl:withCompletionHandler was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0.

This API appends Adobe visitor information to the query component of the specified URL.

If the provided URL is nil or empty, it is returned as is. Otherwise, the following information is added to the query component of the specified URL string and is returned via the callback:

  • The adobe_mc attribute is a URL encoded list that contains:

    • MCMID - Experience Cloud ID (ECID)

    • MCORGID - Experience Cloud Org ID

    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension

    • TS - A timestamp taken when this request was made

  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

iOS

Syntax

+ (void) appendToUrl: (nullable NSURL*) baseUrl withCallback: (nullable void (^) (NSURL* __nullable urlWithVisitorData)) callback;
+ (void) appendToUrl: (nullable NSURL*) baseUrl withCompletionHandler: (nullable void (^) (NSURL* __nullable urlWithVersionData, NSError* __nullable error)) completionHandler;
  • baseUrl is the URL to which the visitor information needs to be appended. If the visitor information is nil or empty, the URL is returned as is.

  • callback is invoked after the updated URL is available.

  • completionHandler is invoked with urlWithVersionData after the updated URL is available or error if an unexpected exception occurs or the request times out. The returned NSError contains the ACPError code of the specific error. The default timeout is 500ms.

Examples

Objective-C

NSURL* url = [[NSURL alloc] initWithString:@"https://example.com"];
[ACPIdentity appendToUrl:url withCallback:^(NSURL * _Nullable urlWithVisitorData) {
// handle the appended url here
if (urlWithVisitorData) {
// APIs which update the UI must be called from main thread
dispatch_async(dispatch_get_main_queue(), ^{
[[self webView] loadRequest:[NSURLRequest requestWithURL:urlWithVisitorData]];
}
} else {
// handle error, nil urlWithVisitorData
}
}];
[ACPIdentity appendToUrl:url withCompletionHandler:^(NSURL * _Nullable urlWithVersionData, NSError * _Nullable error) {
if (error) {
// handle error here
} else {
// handle the appended url here
if (urlWithVisitorData) {
// APIs which update the UI must be called from main thread
dispatch_async(dispatch_get_main_queue(), ^{
[[self webView] loadRequest:[NSURLRequest requestWithURL:urlWithVisitorData]];
}
} else {
// handle error, nil urlWithVisitorData
}
}
}];

Swift

ACPIdentity.append(to:URL(string: "https://example.com"), withCallback: {(appendedURL) in
// handle the appended url here
if let appendedURL = appendedURL {
// APIs which update the UI must be called from main thread
DispatchQueue.main.async {
self.webView.load(URLRequest(url: appendedURL!))
}
} else {
// handle error, nil appendedURL
}
});
ACPIdentity.append(to: URL(string: "https://example.com"), withCompletionHandler: { (appendedURL, error) in
if let error = error {
// handle error
} else {
// handle the appended url here
if let appendedURL = appendedURL {
// APIs which update the UI must be called from main thread
DispatchQueue.main.async {
self.webView.load(URLRequest(url: appendedURL!))
}
} else {
// handle error, nil appendedURL
}
}
})

This API is designed to handle the following URL formats:

scheme://authority/path?query=param#fragment

In this example, the Adobe visitor data is appended as:

scheme://authority/path?query=param&TS=timestamp&MCMID=ecid&MCORGID=ecorgid@AdobeOrg#fragment

Similarly, URLs without a query component:

scheme://authority/path#fragment

The Adobe visitor data is appended as:

scheme://authority/path?TS=timestamp&MCMID=ecid&MCORGID=ecorgid@AdobeOrg#fragment

If your application uses more complicated URLs, such as Angular URLs, we recommend that you use getUrlVariables.

React Native

appendVisitorInfoForURL

This API appends Adobe visitor information to the query component of the specified URL.

If the specified URL is nil or empty, it is returned as is. Otherwise, the following information is added to the query component of the specified URL.

  • The adobe_mc attribute is a URL encoded list that contains:

    • MCMID - Experience Cloud ID (ECID)

    • MCORGID - Experience Cloud Org ID

    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension

    • TS - A timestamp taken when this request was made

  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

JavaScript

Syntax

appendVisitorInfoForURL(baseURL?: String): Promise<?string>;
  • baseUrl is the URL to which the visitor information needs to be appended. If the visitor information is nil or empty, the URL is returned as is.

Example

ACPIdentity.appendVisitorInfoForURL("https://example.com").then(urlWithVistorData => console.log("AdobeExperenceSDK: Url with Visitor Data = " + urlWithVisitorData));

This API is designed to handle the following URL formats:

scheme://authority/path?query=param#fragment

In this example, the Adobe visitor data is appended as:

scheme://authority/path?query=param&TS=timestamp&MCMID=ecid&MCORGID=ecorgid@AdobeOrg#fragment

Similarly, URLs without a query component:

scheme://authority/path#fragment

The Adobe visitor data is appended as:

scheme://authority/path?TS=timestamp&MCMID=ecid&MCORGID=ecorgid@AdobeOrg#fragment

If your application uses more complicated URLs, such as Angular URLs, we recommend that you use getUrlVariables.

Flutter

appendVisitorInfoForURL

This API appends Adobe visitor information to the query component of the specified URL.

If the specified URL is nil or empty, it is returned as is. Otherwise, the following information is added to the query component of the specified URL.

  • The adobe_mc attribute is a URL encoded list that contains:

    • MCMID - Experience Cloud ID (ECID)

    • MCORGID - Experience Cloud Org ID

    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension

    • TS - A timestamp taken when this request was made

  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

Dart

Syntax

Future<String> appendToUrl (String url);
  • url is the URL to which the visitor information needs to be appended. If the visitor information is nil or empty, the URL is returned as is.

Example

String result = "";
try {
result = await FlutterACPIdentity.appendToUrl("https://example.com");
} on PlatformException {
log("Failed to append URL");
}

This API is designed to handle the following URL formats:

scheme://authority/path?query=param#fragment

In this example, the Adobe visitor data is appended as:

scheme://authority/path?query=param&TS=timestamp&MCMID=ecid&MCORGID=ecorgid@AdobeOrg#fragment

Similarly, URLs without a query component:

scheme://authority/path#fragment

The Adobe visitor data is appended as:

scheme://authority/path?TS=timestamp&MCMID=ecid&MCORGID=ecorgid@AdobeOrg#fragment

If your application uses more complicated URLs, such as Angular URLs, we recommend that you use getUrlVariables.

extensionVersion

The extensionVersion() API returns the version of the Identity extension that is registered with the Mobile Core extension.

To get the version of the Identity extension, use the following code sample:

Android
iOS
React Native
Flutter
Android

Java

String identityExtensionVersion = Identity.extensionVersion();
iOS

iOS

Objective-C

NSString *identityExtensionVersion = [ACPIdentity extensionVersion];

Swift

var identityExtensionVersion = ACPIdentity.extensionVersion()
React Native

JavaScript

ACPIdentity.extensionVersion().then(identityExtensionVersion => console.log("AdobeExperienceSDK: ACPIdentity version: " + identityExtensionVersion));
Flutter

Dart

String identityExtensionVersion = FlutterACPIdentity.extensionVersion;

getExperienceCloudId

Android
iOS
React Native
Flutter
Android

getExperienceCloudId

This API retrieves the ECID that was generated when the app was initially launched and is stored in the ECID Service.

This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall. The values are returned via the [AdobeCallback]https://aep-sdks.gitbook.io/docs/using-mobile-extensions/mobile-core/mobile-core-api-reference#adobecallback).

When AdobeCallbackWithError is provided, and you are fetching the ECID from the Mobile SDK, the timeout value is 500ms. If the operation times out or an unexpected error occurs, the fail method is called with the appropriate AdobeError.

Java

Syntax

public static void getExperienceCloudId(final AdobeCallback<String> callback);
  • callback is invoked after the ECID is available.

Example

Identity.getExperienceCloudId(new AdobeCallback<String>() {
@Override
public void call(String id) {
//Handle the ID returned here
}
});
iOS

getExperienceCloudId

Method getExperienceCloudIdWithCompletionHandler was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0.

This API retrieves the ECID that was generated when the app was initially launched and is stored in the ECID Service.

This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall. The values are returned via the callback.

Syntax

+ (void) getExperienceCloudId: (nonnull void (^) (NSString* __nullable experienceCloudId)) callback;
+ (void) getExperienceCloudIdWithCompletionHandler: (nonnull void (^) (NSString* __nullable experienceCloudId, NSError* __nullable error)) completionHandler;
  • callback is invoked after the ECID is available.

  • completionHandler is invoked with experienceCloudId after the ECID is available, or error if an unexpected error occurs or the request times out. The returned NSError contains the ACPError code of the specific error. The default timeout is 500ms.

Examples

Objective-C

[ACPIdentity getExperienceCloudId:^(NSString * _Nullable retrievedCloudId) {
// handle the retrieved ID here
}];
[ACPIdentity getExperienceCloudIdWithCompletionHandler:^(NSString * _Nullable experienceCloudId, NSError * _Nullable error) {
if (error) {
// handle error here
} else {
// handle the retrieved ID here
}
}];

Swift

ACPIdentity.getExperienceCloudId { (retrievedCloudId) in
// handle the retrieved ID here
}
ACPIdentity.getExperienceCloudId { (retrievedCloudId, error) in
if let error = error {
// handle error here
} else {
// handle the retrieved ID here
}
}
React Native

getExperienceCloudId

This API retrieves the ECID that was generated when the app was initially launched and is stored in the ECID Service.

This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall.

JavaScript

Syntax

getExperienceCloudId(): Promise<?string>;

Example

ACPIdentity.getExperienceCloudId().then(cloudId => console.log("AdobeExperienceSDK: CloudID = " + cloudId));
Flutter

getExperienceCloudId

This API retrieves the ECID that was generated when the app was initially launched and is stored in the ECID Service.

This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall.

Dart

Syntax

Future<String> experienceCloudId;

Example

String result = "";
try {
result = await FlutterACPIdentity.experienceCloudId;
} on PlatformException {
log("Failed to get experienceCloudId");
}

getIdentifiers

Android
iOS
React Native
Flutter
Android

getIdentifiers

This API returns all customer identifiers that were previously synced with the Adobe Experience Cloud through the AdobeCallback.

When AdobeCallbackWithError is provided, and you are fetching the custom identifiers from the Mobile SDK, the timeout value is 500ms. If the operation times out or an unexpected error occurs, the fail method is called with the appropriate AdobeError.

Java

Syntax

public static void getIdentifiers(final AdobeCallback<List<VisitorID>> callback);
  • callback is invoked after the customer identifiers are available.

Example

Identity.getIdentifiers(new AdobeCallback<List<VisitorID>>() {
@Override
public void call(List<VisitorID> idList) {
//Process the IDs here
}
});
iOS

getIdentifiers

Method getIdentifiersWithCompletionHandler was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0.

This getIdentifiers API returns all customer identifiers that were previously synced with the Adobe Experience Cloud.

iOS

Syntax

+ (void) getIdentifiers: (nonnull void (^) (NSArray<ADBMobileVisitorId*>* __nullable visitorIDs)) callback;
+ (void) getIdentifiersWithCompletionHandler: (nonnull void (^) (NSArray<ACPMobileVisitorId*>* __nullable visitorIDs, NSError* __nullable error)) completionHandler;
  • callback is invoked after the customer identifiers are available.

  • completionHandler is invoked with visitorIDs after the customer identifiers are available, or error if an unexpected error occurs or the request times out. The returned NSError contains the ACPError code of the specific error. The default timeout is 500ms.

Examples

Objective-C

[ACPIdentity getIdentifiers:^(NSArray<ACPMobileVisitorId *> * _Nullable retrievedVisitorIds) {
// handle the retrieved identifiers here
}];
[ACPIdentity getIdentifiersWithCompletionHandler:^(NSArray<ACPMobileVisitorId *> * _Nullable visitorIDs, NSError * _Nullable error) {
if (error) {
// handle error here
} else {
// handle the retrieved identifiers here
}
}];

Swift

ACPIdentity.getIdentifiers { (retrievedVisitorIds) in
// handle the retrieved identifiers here
}
ACPIdentity.getIdentifiersWithCompletionHandler { (retrievedVisitorIds, error) in
if let error = error {
// handle error here
} else {
// handle the retrieved identifiers here
}
}
React Native

getIdentifiers

This API returns all customer identifiers that were previously synced with the Adobe Experience Cloud.

JavaScript

Syntax

getIdentifiers(): Promise<Array<?ACPVisitorID>>;

Example

ACPIdentity.getIdentifiers().then(identifiers => console.log("AdobeExperienceSDK: Identifiers = " + identifiers));
Flutter

getIdentifiers

This API returns all customer identifiers that were previously synced with the Adobe Experience Cloud.

Dart

Syntax

Future<List<ACPMobileVisitorId>> identifiers;

Example

List<ACPMobileVisitorId> result;
try {
result = await FlutterACPIdentity.identifiers;
} on PlatformException {
log("Failed to get identifiers");
}

getUrlVariables

Android
iOS
React Native
Flutter
Android

getUrlVariables

This method was added in Core version 1.4.0 and Identity version 1.1.0.

This API gets the Visitor ID Service variables in URL query parameter form, and these variables will be consumed by the hybrid app. This method returns an appropriately formed string that contains the Visitor ID Service URL variables. There will be no leading (&) or (?) punctuation because the caller is responsible for placing the variables in their resulting java.net.URI in the correct location.

If an error occurs while retrieving the URL string, callback will be called with a null value. Otherwise, the following information is added to the string that is returned in the callback as an AdobeCallback instance:

  • The adobe_mc attribute is an URL encoded list that contains:

    • MCMID - Experience Cloud ID (ECID)

    • MCORGID - Experience Cloud Org ID

    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension

    • TS - A timestamp taken when this request was made

  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

When AdobeCallbackWithError is provided, and you are fetching the attributes from the Mobile SDK, the timeout value is 500ms. If the operation times out or an unexpected error occurs, the fail method is called with the appropriate AdobeError.

Java

Syntax

public static void getUrlVariables(final AdobeCallback<String> callback);
  • callback has an NSString value that contains the visitor identifiers as a querystring after the service request is complete.

Example

Identity.getUrlVariables(new AdobeCallback<String>() {
@Override
public void call(String stringWithAdobeVisitorInfo) {
//handle the URL query parameter string here
//For example, open the URL on the device browser
//
Intent i = new Intent(Intent.ACTION_VIEW);
i.setData(Uri.parse("https://example.com?" + urlWithAdobeVisitorInfo));
startActivity(i);
}
});
iOS

getUrlVariables

Method getUrlVariables was added in ACPCore version 2.3.0 and ACPIdentity version 2.1.0. Method getUrlVariablesWithCompletionHandler was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0.

This API gets the Visitor ID Service variables in URL query parameter form, and these variables will be consumed by the hybrid app. This method returns an appropriately formed string that contains the Visitor ID Service URL variables. There will be no leading (&) or (?) punctuation because the caller is responsible for placing the variables in their resulting java.net.URI in the correct location.

If an error occurs while retrieving the URL string, callback will be called with a null value. Otherwise, the following information is added to the string that is returned in the callback:

  • The adobe_mc attribute is an URL encoded list that contains:

    • MCMID - Experience Cloud ID (ECID)

    • MCORGID - Experience Cloud Org ID

    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension

    • TS - A timestamp taken when this request was made

  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

iOS

Syntax

+ (void) getUrlVariables: (nonnull void (^) (NSString* __nullable urlVariables)) callback;
+ (void) getUrlVariablesWithCompletionHandler: (nonnull void (^) (NSString* __nullable urlVariables, NSError* __nullable error)) completionHandler;
  • callback has an NSString value that contains the visitor identifiers as a querystring after the service request is complete.

  • completionHandler is invoked with urlVariables containing the visitor identifiers as a query string, or error if an unexpected error occurs or the request times out. The returned NSError contains the ACPError code of the specific error. The default timeout is 500ms.

Examples

Objective-C

[ACPIdentity getUrlVariables:^(NSString * _Nullable urlVariables) {
// handle the URL query parameter string here
NSString* urlString = @"https://example.com";
NSString* urlStringWithVisitorData = [NSString stringWithFormat:@"%@?%@", urlString, urlVariables];
NSURL* urlWithVisitorData = [NSURL URLWithString:urlStringWithVisitorData];
// APIs which update the UI must be called from main thread
dispatch_async(dispatch_get_main_queue(), ^{
[[self webView] loadRequest:[NSURLRequest requestWithURL:urlWithVisitorData]];
}
}];
[ACPIdentity getUrlVariablesWithCompletionHandler:^(NSString * _Nullable urlVariables, NSError * _Nullable error) {
if (error) {
// handle error here
} else {
// handle the URL query parameter string here
NSString* urlString = @"https://example.com";
NSString* urlStringWithVisitorData = [NSString stringWithFormat:@"%@?%@", urlString, urlVariables];
NSURL* urlWithVisitorData = [NSURL URLWithString:urlStringWithVisitorData];
// APIs which update the UI must be called from main thread
dispatch_async(dispatch_get_main_queue(), ^{
[[self webView] loadRequest:[NSURLRequest requestWithURL:urlWithVisitorData]];
}
}
}];

Swift

ACPIdentity.getUrlVariables {(urlVariables) in
var urlStringWithVisitorData: String = "https://example.com"
if let urlVariables: String = urlVariables {
urlStringWithVisitorData.append("?" + urlVariables)
}
guard let urlWithVisitorData: URL = URL(string: urlStringWithVisitorData) else {
// handle error, unable to construct URL
return
}
// APIs which update the UI must be called from main thread
DispatchQueue.main.async {
self.webView.load(URLRequest(url: urlWithVisitorData))
}
}
ACPIdentity.getUrlVariables { (urlVariables, error) in
if let error = error {
// handle error
} else {
var urlStringWithVisitorData: String = "https://example.com"
if let urlVariables: String = urlVariables {
urlStringWithVisitorData.append("?" + urlVariables)
}
guard let urlWithVisitorData: URL = URL(string: urlStringWithVisitorData) else {
// handle error, unable to construct URL
return
}
// APIs which update the UI must be called from main thread
DispatchQueue.main.async {
self.webView.load(URLRequest(url: urlWithVisitorData))
}
}
}
React Native

getUrlVariables

JavaScript

This method was added in react-native-acpcore v1.0.5.

This API gets the Visitor ID Service variables in URL query parameter form, and these variables will be consumed by the hybrid app. This method returns an appropriately formed string that contains the Visitor ID Service URL variables. There will be no leading (&) or (?) punctuation because the caller is responsible for placing the variables in their resulting java.net.URI in the correct location.

If an error occurs while retrieving the URL string, callback will be called with a null value. Otherwise, the following information is added to the string that is returned in the callback:

  • The adobe_mc attribute is an URL encoded list that contains:

    • MCMID - Experience Cloud ID (ECID)

    • MCORGID - Experience Cloud Org ID

    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension

    • TS - A timestamp taken when this request was made

  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

Syntax

getUrlVariables(): Promise<?string>;

Example

ACPIdentity.getUrlVariables().then(urlVariables => console.log("AdobeExperenceSDK: query params = " + urlVariables));
Flutter

getUrlVariables

Dart

This API gets the Visitor ID Service variables in URL query parameter form, and these variables will be consumed by the hybrid app. This method returns an appropriately formed string that contains the Visitor ID Service URL variables. There will be no leading (&) or (?) punctuation because the caller is responsible for placing the variables in their resulting java.net.URI in the correct location.

If an error occurs while retrieving the URL string, callback will be called with a null value. Otherwise, the following information is added to the string that is returned in the callback:

  • The adobe_mc attribute is an URL encoded list that contains:

    • MCMID - Experience Cloud ID (ECID)

    • MCORGID - Experience Cloud Org ID

    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension

    • TS - A timestamp taken when this request was made

  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

Syntax

Future<String> urlVariables;

Example

String result = "";
try {
result = await FlutterACPIdentity.urlVariables;
} on PlatformException {
log("Failed to get url variables");
}

registerExtension

The registerExtension() API registers the Identity extension with the Mobile Core extension. This API allows the extension to send and receive events to and from the Mobile SDK.

To register the Identity extension, use the following code sample:

Android
iOS
React Native
Flutter
Android

After calling the setApplication() method in the onCreate() method, register the extension. If the registration was not successful, an InvalidInitException is thrown.

Java

public class MobileApp extends Application {
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
try {
Identity.registerExtension();
} catch (Exception e) {
//Log the exception
}
}
}
iOS

iOS

Register the Identity extension in your app's didFinishLaunchingWithOptions function:

Objective-C

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPIdentity registerExtension];
// Override point for customization after application launch.
return YES;
}

Swift

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ACPIdentity.registerExtension();
// Override point for customization after application launch.
return true;
}
React Native

JavaScript

When using React Native, registering Identity with Mobile Core should be done in native code which is shown under the Android and iOS tabs.

Flutter

Dart

When using Flutter, registering Identity with Mobile Core should be done in native code which is shown under the Android and iOS tabs.

setAdvertisingIdentifier

The advertising ID is preserved between app upgrades, is saved and restored during the standard application backup process, available via Signals, and is removed at uninstall.

If the current SDK privacy status is optedout, the advertising identifier is not set or stored.

Android
iOS
React Native
Flutter
Android

setAdvertisingIdentifier

This API sets the provided advertising identifier.

Java

Syntax

public static void setAdvertisingIdentifier(final String advertisingIdentifier);
  • advertisingIdentifier is a string that provides developers with a simple, standard system to track the Ads through their apps.

Example

This is just an implementation example. For more information about advertising identifiers and how to handle them correctly in your mobile application, see Google Play Services documentation about Advertising ID.

This example requires Google Play Services to be configured in your mobile application. For instructions on how to import the Google Mobile Ads SDK and how to configure your ApplicationManifest.xml file, see Google Mobile Ads SDK setup.

...
@Override
public void onResume() {
super.onResume();
...
new Thread(new Runnable() {
@Override
public void run() {
String advertisingIdentifier = null;
try {
AdvertisingIdClient.Info adInfo = AdvertisingIdClient.getAdvertisingIdInfo(getApplicationContext());
if (adInfo != null) {
if (!adInfo.isLimitAdTrackingEnabled()) {
advertisingIdentifier = adInfo.getId();
} else {
MobileCore.log(LoggingMode.DEBUG, "ExampleActivity", "Limit Ad Tracking is enabled by the user, cannot process the advertising identifier");
}
}
} catch (IOException e) {
// Unrecoverable error connecting to Google Play services (e.g.,
// the old version of the service doesn't support getting AdvertisingId).
MobileCore.log(LoggingMode.DEBUG, "ExampleActivity", "IOException while retrieving the advertising identifier " + e.getLocalizedMessage());
} catch (GooglePlayServicesNotAvailableException e) {
// Google Play services is not available entirely.
MobileCore.log(LoggingMode.DEBUG, "ExampleActivity", "GooglePlayServicesNotAvailableException while retrieving the advertising identifier " + e.getLocalizedMessage());
} catch (GooglePlayServicesRepairableException e) {
// Google Play services is not installed, up-to-date, or enabled.
MobileCore.log(LoggingMode.DEBUG, "ExampleActivity", "GooglePlayServicesRepairableException while retrieving the advertising identifier " + e.getLocalizedMessage());
}
MobileCore.setAdvertisingIdentifier(advertisingIdentifier);
}
}).start();
}
iOS

setAdvertisingIdentifier

Retrieve the Identifier for Advertising (IDFA) from Apple APIs only if you are using an ad service. If you retrieve IDFA, and are not using it properly, your app might be rejected.

This is just an implementation example. For more information about IDFA and how to handle them correctly in your mobile application, see Apple developer documentation about IDFA

iOS

Syntax

+ (void) setAdvertisingIdentifier: (nullable NSString*) adId;
  • adId is a string that provides developers with a simple, standard system to continue to track the Ads through their apps.

Example

Objective-C

#import <AdSupport/ASIdentifierManager.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
NSString *idfa = nil;
if ([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
} else {
[ACPCore log:ACPMobileLogLevelDebug tag:@"AppDelegateExample" message:@"Advertising Tracking is disabled by the user, cannot process the advertising identifier"];
}
[ACPCore setAdvertisingIdentifier:idfa];
...
}

Swift

import AdSupport
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
var idfa:String = "";
if (ASIdentifierManager.shared().isAdvertisingTrackingEnabled) {
idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString;
} else {
ACPCore.log(ACPMobileLogLevel.debug, tag: "AppDelegateExample", message: "Advertising Tracking is disabled by the user, cannot process the advertising identifier");
}
ACPCore.setAdvertisingIdentifier(idfa);
...
}
React Native

setAdvertisingIdentifier

JavaScript

Syntax

setAdvertisingIdentifier(advertisingIdentifier?: String);
  • adID is a string that provides developers with a simple, standard system to continue to track the Ads through their apps.

Example

ACPCore.setAdvertisingIdentifier("ADVTID");
Flutter

setAdvertisingIdentifier

Dart

Syntax

Future<void> setAdvertisingIdentifier (String aid);
  • aid is a string that provides developers with a simple, standard system to continue to track the Ads through their apps.

Example

FlutterACPCore.setAdvertisingIdentifier("ADVTID");

setPushIdentifier

This API sets the device token for push notifications in the SDK. If the current SDK privacy status is optedout, the push identifier is not set.

Android
iOS
React Native
Android

setPushIdentifier

Java

Syntax

public static void setPushIdentifier(final String pushIdentifier);
  • pushIdentifier is a string that contains the device token for push notifications.

Example

//Retrieve the token from either GCM or FCM, and pass it to the SDK
MobileCore.setPushIdentifier(token);
iOS

setPushIdentifier

iOS

+ (void) setPushIdentifier: (nullable NSData*) deviceToken;
  • deviceToken is a string that contains the device token for push notifications.

Example

Objective-C

// Set the deviceToken that the APNS has assigned to the device
[ACPCore setPushIdentifier:deviceToken];

Swift

// Set the deviceToken that the APNs has assigned to the device
ACPCore.setPushIdentifier(deviceToken)
React Native

setPushIdentifier

JavaScript

Syntax

ACPCore.setPushIdentifier(pushIdentifier);
  • pushIdentifier is a string that contains the device token for push notifications.

Example

ACPCore.setPushIdentifier("pushID");

syncIdentifier

The syncIdentifier() and syncIdentifiers() APIs update the specified customer IDs with the Adobe Experience Cloud ID (ECID) Service.

These APIs synchronize the provided customer identifier type key and value with the authentication state to the ECID Service. If the specified customer ID type exists in the service, this ID type is updated with the new ID and the authentication state. Otherwise, a new customer ID is added.

Starting with ACPIdentity v2.1.3 (iOS) and Identity v1.1.2 (Android) if the new identifier value is null or empty, this ID type is removed from the local storage, Identity shared state and not synced with the Adobe ECID Service.

These IDs are preserved between app upgrades, are saved and restored during the standard application backup process, and are removed at uninstall.

If the current SDK privacy status is MobilePrivacyStatus.OPT_OUT, calling this method results in no operations being performed.

This API updates or appends the provided customer identifier type key and value with the given authentication state to the ECID Service. If the specified customer ID type exists in the service, the ID is updated with the new ID and authentication state. Otherwise a new customer ID is added.

Android
iOS
React Native
Flutter
Android

Java

Syntax

public static void syncIdentifier(final String identifierType,
final String identifier,
final VisitorID.AuthenticationState authenticationState);
  • identifierType (String) containsthe identifier type, and this parameter should not be null or empty.

  • identifier (String) contains the identifier value, and this parameter should not be null or empty.

  • authenticationState indicates the authentication state of the user and contains one of the VisitorID.AuthenticationState values:

    • VisitorID.AuthenticationState.AUTHENTICATED

    • VisitorID.AuthenticationState.LOGGED_OUT

    • VisitorID.AuthenticationState.UNKNOWN

Example

Identity.syncIdentifier("idType",
"idValue",
VisitorID.AuthenticationState.AUTHENTICATED);
iOS

iOS

Syntax

+ (void) syncIdentifier: (nonnull NSString*) identifierType
identifier: (nonnull NSString*) identifier
authentication: (ADBMobileVisitorAuthenticationState) authenticationState;
  • The identifierType (String) contains the identifier type, and this parameter should not be null or empty.

  • The identifier (String) contains the identifier value, and this parameter should not be null or empty.

    If either the identifier type or identifier contains a null or an empty string, the identifier is ignored by the Identity extension.

  • The authenticationState (VisitorIDAuthenticationState) value indicates the authentication state for the user and contains one of the following VisitorID.AuthenticationState values:

    • ACPMobileVisitorAuthenticationStateAuthenticated

    • ACPMobileVisitorAuthenticationStateLoggedOut

    • ACPMobileVisitorAuthenticationStateUnknown

Examples

Objective-C

[ACPIdentity syncIdentifier:@"idType" identifier:@"idValue" authentication:ACPMobileVisitorAuthenticationStateUnknown];

Swift

ACPIdentity.syncIdentifier("idType", identifier: "idValue", authentication: ACPMobileVisitorAuthenticationState.unknown)
React Native

JavaScript

Syntax

syncIdentifier(identifierType: String, identifier: String, authenticationState: string);
  • The identifierType (String) contains the identifier type, and this parameter should not be null or empty.

  • The identifier (String) contains the identifier value, and this parameter should not be null or empty.

    If either the identifier type or identifier contains a null or an empty string, the identifier is ignored by the Identity extension.

  • authenticationState (VisitorIDAuthenticationState) value indicating authentication state for the user contaisn one of the VisitorID.AuthenticationState values: indicats the authentication state of the user and contains one of the VisitorID.AuthenticationState values:

  • ACPMobileVisitorAuthenticationState.AUTHENTICATED

  • ACPMobileVisitorAuthenticationState.LOGGED_OUT

  • ACPMobileVisitorAuthenticationState.UNKNOWN

Example

import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';
ACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);
Flutter

Dart

Syntax

Future<void> syncIdentifier(String identifierType, String identifier, ACPMobileVisitorAuthenticationState authState);
  • The identifierType (String) contains the identifier type, and this parameter should not be null or empty.

  • The identifier (String) contains the identifier value, and this parameter should not be null or empty.

    If either the identifier type or identifier contains a null or an empty string, the identifier is ignored by the Identity extension.

  • authState value indicating authentication state for the user contaisn one of the ACPMobileVisitorAuthenticationState values: indicats the authentication state of the user and contains one of the ACPMobileVisitorAuthenticationState values:

  • ACPMobileVisitorAuthenticationState.AUTHENTICATED

  • ACPMobileVisitorAuthenticationState.LOGGED_OUT

  • ACPMobileVisitorAuthenticationState.UNKNOWN

Example

import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
FlutterACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);

syncIdentifiers

This API is an overloaded version, which does not include the parameter for the authentication state and it assumes a default value of VisitorID.AuthenticationState.UNKNOWN.

Android
iOS
React Native
Flutter
Android

Java

Syntax

public static void syncIdentifiers(final Map<String, String> identifiers);
  • identifiers is a map that contains the identifiers with the Identifier type as the key, and the string identifier as the value.

    In each identifier pair, if the identifier type contains a null or an empty string, the identifier is ignored by the Identity extension.

Example

Map<String, String> identifiers = new HashMap<String, String>();
identifiers.put("idType1", "idValue1");
identifiers.put("idType2", "idValue2");
identifiers.put("idType3", "idValue3");
Identity.syncIdentifier(identifiers);
iOS

iOS

Syntax

+ (void) syncIdentifiers: (nullable NSDictionary*) identifiers;
  • The identifiers dictionary contains identifiers, and each identifier contains an identifier type as the key and an identifier as the value.

    If any of the identifier pairs contains an empty or null value as the identifier type, then it will be ignored.

Examples

Objective-C

NSDictionary *ids = @{@"idType1":@"idValue1",
@"idType2":@"idValue2",
@"idType3":@"idValue3"};
[ACPIdentity syncIdentifiers:ids];

Swift

let identifiers : [String: String] = ["idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"];
ACPIdentity.syncIdentifiers(identifiers)
React Native

JavaScript

Syntax

syncIdentifiers(identifiers?: {string: string});
  • The identifiers dictionary contains identifiers, and each identifier contains an identifier type as the key and an identifier as the value.

    If any of the identifier pairs contains an empty or null value as the identifier type, then it will be ignored.

Example

ACPIdentity.syncIdentifiers({"id1": "identifier1"});
Flutter

Dart

Syntax

Future<void> syncIdentifiers (Map<String, String> identifiers);
  • The identifiers dictionary contains identifiers, and each identifier contains an identifier type as the key and an identifier as the value.

    If any of the identifier pairs contains an empty or null value as the identifier type, then it will be ignored.

Example

FlutterACPIdentity.syncIdentifiers({"idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"});

syncIdentifiers (overloaded)

The function of this API is the same as the syncIdentifier API. This API passes a list of identifiers, and each identifier contains an identifier type as the key and an identifier as the value. In each identifier pair, if the identifier type contains a null or an empty string, the identifier is ignored by the Identity extension.

Starting with ACPIdentity v2.1.3 (iOS) and Identity v1.1.2 (Android) if the new identifier value is null or empty, this ID type is removed from the local storage, Identity shared state and not synced with the Adobe ECID Service.

Android
iOS
React Native
Flutter
Android

Java

Syntax

public static void syncIdentifiers(final Map<String, String> identifiers, final VisitorID.AuthenticationState authState)
  • identifiers ia a map that contains IDs with the identifier type as the key, and the string identifier as the value.

  • authState indicates the authentication state for the user, which contains one of the following VisitorID.AuthenticationState values:

    • VisitorID.AuthenticationState.AUTHENTICATED

    • VisitorID.AuthenticationState.LOGGED_OUT

    • VisitorID.AuthenticationState.UNKNOWN

Example

Map<String, String> identifiers = new HashMap<String, String>();
identifiers.put("idType1", "idValue1");
identifiers.put("idType2", "idValue2");
identifiers.put("idType3", "idValue3");
Identity.syncIdentifier(identifiers, VisitorID.AuthenticationState.AUTHENTICATED);
iOS

iOS

Syntax

+ (void) syncIdentifiers: (nullable NSDictionary*) identifiers authentication: (ACPMobileVisitorAuthenticationState) authenticationState;
  • The identifiers dictionary contains identifiers, and each identifier contains an identifier type as the key and an identifier as the value.

    If any of the identifier pairs contains an empty or null value as the identifier type, then it will be ignored.

  • The authenticationState (VisitorIDAuthenticationState) indicates the authentication state of the user and contains one of the VisitorID.AuthenticationState values:

    • ACPMobileVisitorAuthenticationState.AUTHENTICATED

    • ACPMobileVisitorAuthenticationState.LOGGED_OUT

    • ACPMobileVisitorAuthenticationState.UNKNOWN

Examples

Objective-C

NSDictionary *ids = @{@"idType1":@"idValue1",
@"idType2":@"idValue2",
@"idType3":@"idValue3"};
[ACPIdentity syncIdentifiers:ids authentication:ACPMobileVisitorAuthenticationStateAuthenticated];

Swift

let identifiers : [String: String] = ["idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"];
ACPIdentity.syncIdentifiers(identifiers, authentication:
ACPMobileVisitorAuthenticationState.authenticated)
React Native

JavaScript

Syntax

syncIdentifiersWithAuthState(identifiers?: {string: string}, authenticationState: string);
  • The identifiers dictionary contains identifiers, and each identifier contains an identifier type as the key and an identifier as the value.

    If any of the identifier pairs contains an empty or null value as the identifier type, then it will be ignored.

  • The authenticationState (ACPMobileVisitorAuthenticationState) indicates the authentication state of the user and contains one of the ACPMobileVisitorAuthenticationState values:

    • ACPMobileVisitorAuthenticationState.AUTHENTICATED

    • ACPMobileVisitorAuthenticationState.LOGGED_OUT

    • ACPMobileVisitorAuthenticationState.UNKNOWN

Example

import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';
ACPIdentity.syncIdentifiersWithAuthState({"id1": "identifier1"}, ACPMobileVisitorAuthenticationState.UNKNOWN);
Flutter

Dart

Syntax

Future<void> syncIdentifiersWithAuthState (Map<String, String> identifiers, ACPMobileVisitorAuthenticationState authState);
  • The identifiers dictionary contains identifiers, and each identifier contains an identifier type as the key and an identifier as the value.

    If any of the identifier pairs contains an empty or null value as the identifier type, then it will be ignored.

  • The authState (ACPMobileVisitorAuthenticationState)_ indicates the authentication state of the user and contains one of the ACPMobileVisitorAuthenticationState values:

    • ACPMobileVisitorAuthenticationState.AUTHENTICATED

    • ACPMobileVisitorAuthenticationState.LOGGED_OUT

    • ACPMobileVisitorAuthenticationState.UNKNOWN

Example

import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
FlutterACPIdentity.syncIdentifiersWithAuthState({"idType1":"idValue1", "idType2":"idValue2", "idType3":"idValue3"}, ACPMobileVisitorAuthenticationState.UNKNOWN);

Public classes

Android
iOS
React Native
Flutter
Android

Android

AuthenticationState

This class is used to indicate the authentication state for the current VisitorID.

public enum AuthenticationState {
UNKNOWN,
AUTHENTICATED,
LOGGED_OUT;
}

VisitorID

This class is an identifier to be used with the Experience Cloud Visitor ID Service.

public class VisitorID {
//Constructor
public VisitorID(String idOrigin, String idType, String id, VisitorID.AuthenticationState authenticationState);
public VisitorID.AuthenticationState getAuthenticationState();
public final String getId();
public final String getIdOrigin();
public final String getIdType();
}
iOS

iOS

ACPMobileVisitorAuthenticationState

This is used to indicate the authentication state for the current VisitorID.

typedef NS_ENUM(NSUInteger,
ADBMobileVisitorAuthenticationState) {
ACPMobileVisitorAuthenticationStateUnknown = 0,
ACPMobileVisitorAuthenticationStateAuthenticated = 1,
ACPMobileVisitorAuthenticationStateLoggedOut = 2 };

ACPMobileVisitorId

This is an identifier to be used with the Experience Cloud Visitor ID Service and it contains the origin, the identifier type, the identifier,, and the authentication state of the visitor ID.

@interface ACPMobileVisitorId : NSObject
@property(nonatomic, strong, nullable) NSString* idOrigin;
@property(nonatomic, strong, nullable) NSString* idType;
@property(nonatomic, strong, nullable) NSString* identifier;
@property(nonatomic, readwrite) ACPMobileVisitorAuthenticationState authenticationState;
@end
React Native

JavaScript

ACPVisitorID

This is an identifier to be used with the Experience Cloud Visitor ID Service and it contains the origin, the identifier type, the identifier, and the authentication state of the visitor ID.

import {ACPVisitorID} from '@adobe/react-native-acpcore';
var visitorId = new ACPVisitorID(idOrigin?: string, idType: string, id?: string, authenticationState?: ACPMobileVisitorAuthenticationState);

ACPMobileVisitorAuthenticationState

This is used to indicate the authentication state for the current VisitorID.

import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';
var state = ACPMobileVisitorAuthenticationState.AUTHENTICATED;
//var state = ACPMobileVisitorAuthenticationState.LOGGED_OUT;
//var state = ACPMobileVisitorAuthenticationState.UNKNOWN;
Flutter

Dart

ACPVisitorID

This is an identifier to be used with the Experience Cloud Visitor ID Service and it contains the origin, the identifier type, the identifier, and the authentication state of the visitor ID.

import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
class ACPMobileVisitorId {
String get idOrigin;
String get idType;
String get identifier;
ACPMobileVisitorAuthenticationState get authenticationState;
};

ACPMobileVisitorAuthenticationState

This is used to indicate the authentication state for the current VisitorID.

import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
enum ACPMobileVisitorAuthenticationState {UNKNOWN, AUTHENTICATED, LOGGED_OUT};