Identity API reference

Sync identifiers

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

These APIs synchronize the provided customer identifier type key and value with the authentication state to the Adobe Experience Cloud ID (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.

syncIdentifier

This API updates or appends the provided customer identifier type key and value with the given authentication state to the Adobe Experience Cloud ID 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

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

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)

JavaScript

Syntax

ACPIdentity.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

ACPIdentity.syncIdentifier(identifierType, identifier, ACPMobileVisitorAuthenticationState.AUTHENTICATED);

syncIdentifiers

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

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

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)

JavaScript

Syntax

ACPIdentity.syncIdentifiersWithAuthState((nullable NSDictionary*) identifiers, 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 (VisitorIDAuthenticationState) indicates 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.syncIdentifiersWithAuthState({"id1": "identifier1"}, ACPMobileVisitorAuthenticationState.UNKNOWN);

syncIdentifiers (overloaded)

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

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

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)

JavaScript

Syntax

ACPIdentity.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.

Example

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

Append visitor data to a URL

Android
iOS
React Native

appendVisitorInfoForURL

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.

Java

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("http://myurl.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.

appendToURL

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;
  • 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.

Examples

Objective-C

NSURL* url = [[NSURL alloc] initWithString:@"www.myUrl.com"];
[ACPIdentity appendToUrl:url withCallback:^(NSURL * _Nullable urlWithVisitorData) {
// handle the appended url here}
}];

Swift

ACPIdentity.append(to:URL(string: "www.myUrl.com"), withCallback: {(appendedURL) in
// handle the appended url here
});

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.

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

ACPIdentity.appendVisitorInfoForURL(baseURL);
  • 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("www.myUrl.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.

Get visitor data as URL query parameter

Android
iOS
React Native

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.

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("http://myUrl.com?" + urlWithAdobeVisitorInfo));
startActivity(i);
}
});

getUrlVariables

This method was added in ACPCore version 2.3.0 and ACPIdentity version 2.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.

iOS

Syntax

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

Examples

Objective-C

[ACPIdentity getUrlVariables:^(NSString * _Nullable urlVariables) {
// handle the URL query parameter string here
NSString* urlString = @"http://myUrl.com";
NSString* urlStringWithVisitorData = [NSString stringWithFormat:@"%@?%@", urlString, urlVariables];
NSURL* urlWithVisitorData = [NSURL URLWithString:urlStringWithVisitorData];
[[UIApplication sharedApplication] openURL:urlWithVisitorData options:@{} completionHandler:^(BOOL success) {
// handle openURL success
}];
}];

Swift

ACPIdentity.getUrlVariables {(urlVariables) in
// URL query parameter string
let urlStringWithVisitorData : String = "http://myUrl.com?" + urlVariables!
let urlWithVisitorData : NSURL = NSURL(string: urlStringWithVisitorData)!
UIApplication.shared.open(urlWithVisitorData as URL,
options: [:],
completionHandler: {(complete) in
// handle open success
})
}

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 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.

Syntax

ACPIdentity.getUrlVariables();

Example

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

Get identifiers

Android
iOS
React Native

getIdentifiers

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

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
}
});

getIdentifiers

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;
  • callback is invoked after the customer identifiers are available.

Examples

Objective-C

[ACPIdentity getIdentifiers:^(NSArray<ACPMobileVisitorId *> * _Nullable retrievedVisitorIds) {
// handle the retrieved identifiers here
}];

Swift

ACPIdentity.getIdentifiers { (retrievedVisitorIds) in
// handle the retrieved identifiers here
}

getIdentifiers

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

JavaScript

Syntax

ACPIdentity.getIdentifiers()

Example

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

Get Experience Cloud IDs

Android
iOS
React Native

getExperienceCloudId

This API retrieves the Experience Cloud ID that was generated when the app was initially launched and is stored in the Experience Cloud ID 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.

Java

Syntax

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

Example

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

getExperienceCloudId

This API retrieves the Experience Cloud ID that was generated when the app was initially launched and is stored in the Experience Cloud ID 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.

Syntax

+ (void) getExperienceCloudId: (nonnull void (^) (NSString* __nullable experienceCloudId)) callback;
  • callback is invoked after the Experience Cloud ID is available.

Examples

Objective-C

[ACPIdentity getExperienceCloudId:^(NSString * _Nullable retrievedCloudId) {
// handle the retrieved Id here
}];

Swift

ACPIdentity.getExperienceCloudId { (retrievedCloudId) in
// handle the retrieved Id here
}

getExperienceCloudId

This API retrieves the Experience Cloud ID that was generated when the app was initially launched and is stored in the Experience Cloud ID 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

ACPIdentity.getExperienceCloudId()

Example

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

Set an advertising identifier

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

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();
}

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);
...
}

setAdvertisingIdentifier

JavaScript

Syntax

ACPCore.setAdvertisingIdentifier(adID);
  • 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");

Set the push identifier

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

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);

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)

setPushIdentifier

JavaScript

Syntax

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

Example

ACPCore.setPushIdentifier("pushID");

Identity service classes

Android
iOS
React Native

Android

AdobeCallback

This class provides the interface to receive results when the async APIs perform the requested action.

public interface AdobeCallback<T> {
void call(final T value);
}

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();​​
}

AuthenticationState

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

public enum AuthenticationState {
UNKNOWN,
AUTHENTICATED,
LOGGED_OUT;
}

iOS

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

ACPMobileVisitorAuthenticationState

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

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

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)