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 callback function:
- The
adobe_mc
attribute is a URL encoded list that contains:MCMID
- Experience Cloud ID (ECID)MCORGID
- Experience Cloud Org IDMCAID
- Analytics Tracking ID (AID), if available from the Analytics extensionTS
- 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.
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, you should use getUrlVariables.
{% tabs %} {% tab title="Android" %}
This API can be called with AdobeCallback or AdobeCallbackWithError for retrieving the attributes from the Mobile SDK. When AdobeCallbackWithError
is provided, this API uses a default timeout of 500ms. If the operation times out or an unexpected error occurs, the fail
method is called with the appropriate AdobeError.
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);
}
});
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
static func appendTo(url: URL?, completion: @escaping (URL?, Error?) -> Void)
- 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.
- completion is invoked after the updated URL is available or Error if an unexpected exception occurs or the request times out. The returned
Error
contains the AEPError code of the specific error.
Example
Identity.appendTo(url: URL(string: "https://example.com")) { 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
}
}
})
Syntax
+ (void) appendToUrl: (NSURL * _Nullable baseUrl) completion: ^(NSURL * _Nullable urlWithVisitorData, NSError * _Nullable error) completion;
Example
NSURL* url = [NSURL URLWithString:@"https://example.com"];
[AEPMobileIdentity appendToUrl:url completion:^(NSURL * _Nullable urlWithVisitorData, 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
}
}
}];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
{% hint style="info" %}
Method appendToUrl:withCompletionHandler
was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0.
{% endhint %}
Syntax
static func append(to: URL?, withCallback: ((URL?) -> Void)?)
static func append(to: URL?, withCompletionHandler: ((URL?, Error?)-> Void)?)
Example
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
}
}
})
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 of 500ms.
Example
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
}
}
}];
{% endtab %}
{% tab title="React Native" %}
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));
{% endtab %}
{% tab title="Flutter" %}
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");
}
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPIdentity.appendVisitorInfoForUrl = function(url, success, fail);
- url (String) 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.
- success is a callback containing the provided URL with the visitor information appended if the
appendVisitorInfoForUrl
API executed without any errors. - fail is a callback containing error information if the
appendVisitorInfoForUrl
API was executed with errors.
Example
ACPIdentity.appendVisitorInfoForUrl("https://example.com", function(handleCallback) {
console.log("AdobeExperenceSDK: Url with Visitor Data = " + handleCallback);
}, function(handleError) {
console.log("AdobeExperenceSDK: Failed to append URL : " + handleError);
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void AppendToUrl(string url, AdobeIdentityAppendToUrlCallback callback)
- url (String) 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 a callback containing the provided URL with the visitor information appended if the
AppendToUrl
API executed without any errors.
Example
[MonoPInvokeCallback(typeof(AdobeIdentityAppendToUrlCallback))]
public static void HandleAdobeIdentityAppendToUrlCallback(string url)
{
print("Url is : " + url);
}
ACPIdentity.AppendToUrl("https://www.adobe.com", HandleAdobeIdentityAppendToUrlCallback);
{% endtab %}
{% tab title="Xamarin" %}
iOS Syntax
public unsafe static void AppendToUrl (NSUrl baseUrl, Action<NSUrl> callback);
- baseUrl (NSUrl) 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 a callback containing the provided URL with the visitor information appended if the
AppendToUrl
API executed without any errors.
Android Syntax
public unsafe static void AppendVisitorInfoForURL (string baseURL, IAdobeCallback callback);
- baseURL (string) 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 a callback containing the provided URL with the visitor information appended if the
AppendVisitorInfoForURL
API executed without any errors.
iOS Example
ACPIdentity.AppendToUrl(url, callback => {
Console.WriteLine("Appended url: " + callback);
});
Android Example
ACPIdentity.AppendVisitorInfoForURL("https://example.com", new StringCallback());
class StringCallback : Java.Lang.Object, IAdobeCallback
{
public void Call(Java.Lang.Object stringContent)
{
if (stringContent != null)
{
Console.WriteLine("Appended url: " + stringContent);
}
else
{
Console.WriteLine("null content in string callback");
}
}
}
{% endtab %} {% endtabs %}
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:
{% tabs %} {% tab title="Android" %}
String identityExtensionVersion = Identity.extensionVersion();
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
static var extensionVersion: String
Example
let identityExtensionVersion = Identity.extensionVersion
Syntax
+ (nonnull NSString*) extensionVersion;
Example
NSString *identityVersion = [AEPMobileIdentity extensionVersion];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
static func extensionVersion() -> String
Example
let identityVersion = ACPIdentity.extensionVersion()
Syntax
+ (nonnull NSString*) extensionVersion;
Example
NSString *identityVersion = [ACPIdentity extensionVersion];
{% endtab %}
{% tab title="React Native" %}
ACPIdentity.extensionVersion().then(identityExtensionVersion => console.log("AdobeExperienceSDK: ACPIdentity version: " + identityExtensionVersion));
{% endtab %}
{% tab title="Flutter" %}
String identityExtensionVersion = FlutterACPIdentity.extensionVersion;
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPIdentity.extensionVersion = function(success, fail);
- success is a callback containing the ACPIdentity extension version if the
extensionVersion
API executed without any errors. - fail is a callback containing error information if the
appendVisitorInfoForUrl
API was executed with errors.
Example
ACPIdentity.extensionVersion(function (handleCallback) {
console.log("AdobeExperienceSDK: ACPIdentity version: " + handleCallback)
}, function (handleError) {
console.log("AdobeExperenceSDK: failed to get extension version : " + handleError)
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static string ExtensionVersion()
Example
string identityVersion = ACPIdentity.ExtensionVersion();
{% endtab %}
{% tab title="Xamarin" %}
Syntax
public static string ExtensionVersion ();
Example
string identityVersion = ACPIdentity.ExtensionVersion();
{% endtab %} {% endtabs %}
This API 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.
This ID is preserved between app upgrades, is saved and restored during the standard application backup process, and is removed at uninstall.
{% tabs %} {% tab title="Android" %}
This API can be called with AdobeCallback or AdobeCallbackWithError for retrieving the ECID from the Mobile SDK. When AdobeCallbackWithError
is provided, this API uses a default timeout of 500ms. If the operation times out or an unexpected error occurs, the fail
method is called with the appropriate AdobeError.
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
}
});
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
@objc(getExperienceCloudId:)
static func getExperienceCloudId(completion: @escaping (String?, Error?) -> Void)
- completion is invoked with String after the ECID is available, or Error if an unexpected error occurs or the request times out. The returned
Error
contains the AEPError code of the specific error.
Example
Identity.getExperienceCloudId { ecid, error in
if let error = error {
// handle error here
} else {
// handle the retrieved ID here
}
}
Syntax
+ (void) getExperienceCloudId: ^(NSString * _Nullable ecid, NSError * _Nullable error) completion;
Example
[AEPMobileIdentity getExperienceCloudId:^(NSString * _Nullable ecid, NSError *error) {
if (error) {
// handle error here
} else {
// handle the retrieved ID here
}
}];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
{% hint style="info" %}
Method getExperienceCloudIdWithCompletionHandler
was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0.
{% endhint %}
Syntax
static func getExperienceCloudId(_ callback: @escaping (String?) -> Void)
static func getExperienceCloudId(completionHandler: @escaping (String?, Error?) -> Void)
- 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 of 500ms.
Sample
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
}
}
Syntax
+ (void) getExperienceCloudId: (nonnull void (^) (NSString* __nullable experienceCloudId)) callback;
+ (void) getExperienceCloudIdWithCompletionHandler: (nonnull void (^) (NSString* __nullable experienceCloudId, NSError* __nullable error)) completionHandler;
Example
[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
}
}];
{% endtab %}
{% tab title="React Native" %}
Syntax
getExperienceCloudId(): Promise<?string>;
Example
ACPIdentity.getExperienceCloudId().then(cloudId => console.log("AdobeExperienceSDK: CloudID = " + cloudId));
{% endtab %}
{% tab title="Flutter" %}
Syntax
Future<String> experienceCloudId;
Example
String result = "";
try {
result = await FlutterACPIdentity.experienceCloudId;
} on PlatformException {
log("Failed to get experienceCloudId");
}
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPIdentity.getExperienceCloudId(success, fail);
- success is a callback containing the ECID if the
getExperienceCloudId
API executed without any errors. - fail is a callback containing error information if the
getExperienceCloudId
API was executed with errors.
Example
ACPIdentity.getExperienceCloudId(function (handleCallback) {
console.log("AdobeExperienceSDK: experienceCloudId: " + handleCallback)
}, function (handleError) {
console.log("AdobeExperenceSDK: Failed to retrieve experienceCloudId : " + handleError);
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void GetExperienceCloudId(AdobeGetExperienceCloudIdCallback callback)
- callback is a callback containing the ECID if the
GetExperienceCloudId
API executed without any errors.
Example
[MonoPInvokeCallback(typeof(AdobeGetExperienceCloudIdCallback))]
public static void HandleAdobeGetExperienceCloudIdCallback(string cloudId)
{
print("ECID is : " + cloudId);
}
ACPIdentity.GetExperienceCloudId(HandleAdobeGetExperienceCloudIdCallback);
{% endtab %}
{% tab title="Xamarin" %}
iOS Syntax
public unsafe static void GetExperienceCloudId (Action<NSString> callback);
- callback is a callback containing the ECID if the
getExperienceCloudId
API executed without any errors.
Android Syntax
public unsafe static void GetExperienceCloudId (IAdobeCallback callback);
- callback is a callback containing the ECID if the
getExperienceCloudId
API executed without any errors.
iOS Example
ACPIdentity.GetExperienceCloudId(callback => {
Console.WriteLine("Experience Cloud Id: " + callback);
});
Android Example
ACPIdentity.GetExperienceCloudId(new StringCallback());
class StringCallback : Java.Lang.Object, IAdobeCallback
{
public void Call(Java.Lang.Object stringContent)
{
if (stringContent != null)
{
Console.WriteLine("Experience Cloud Id: " + stringContent);
}
else
{
Console.WriteLine("null content in string callback");
}
}
}
{% endtab %} {% endtabs %}
This API returns all customer identifiers that were previously synced with the Adobe Experience Cloud Identity Service.
{% tabs %} {% tab title="Android" %}
This API can be called with AdobeCallback or AdobeCallbackWithError for retrieving the custom identifiers from the Mobile SDK. When AdobeCallbackWithError
is provided, this API uses a default timeout of 500ms. If the operation times out or an unexpected error occurs, the fail
method is called with the appropriate AdobeError.
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
}
});
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
@objc(getIdentifiers:)
static func getIdentifiers(completion: @escaping ([Identifiable]?, Error?) -> Void)
- completion is invoked with a list of Identifiable objects after the customer identifiers are available, or Error if an unexpected error occurs or the request times out. The returned
Error
contains the AEPError code of the specific error.
Example
Identity.getIdentifiers { identifiers, error in
if let error = error {
// handle error here
} else {
// handle the retrieved identifiers here
}
}
Syntax
+ (void) getIdentifiers: ^(NSArray<id<AEPIdentifiables>> * _Nullable identifiers, NSError * _Nullable error) completion;
Example
[[AEPMobileIdentity getIdentifiers:^(NSArray<id<AEPIdentifiable>> * _Nullable identifiers, NSError *error) {
if (error) {
// handle error here
} else {
// handle the retrieved identifiers here
}
}];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
{% hint style="info" %}
Method getIdentifiersWithCompletionHandler
was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0.
{% endhint %}
Syntax
static func getIdentifiers(_ callback: @escaping ([ACPMobileVisitorId]?) -> Void)
static func getIdentifiersWithCompletionHandler(_ completionHandler: @escaping ([ACPMobileVisitorId]?, Error?) -> Void)
- 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 of 500ms.
Example
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
}
}
Syntax
+ (void) getIdentifiers: (nonnull void (^) (NSArray<ADBMobileVisitorId*>* __nullable visitorIDs)) callback;
+ (void) getIdentifiersWithCompletionHandler: (nonnull void (^) (NSArray<ACPMobileVisitorId*>* __nullable visitorIDs, NSError* __nullable error)) completionHandler;
Example
[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
}
}];
{% endtab %}
{% tab title="React Native" %}
Syntax
getIdentifiers(): Promise<Array<?ACPVisitorID>>;
Example
ACPIdentity.getIdentifiers().then(identifiers => console.log("AdobeExperienceSDK: Identifiers = " + identifiers));
{% endtab %}
{% tab title="Flutter" %}
Syntax
Future<List<ACPMobileVisitorId>> identifiers;
Example
List<ACPMobileVisitorId> result;
try {
result = await FlutterACPIdentity.identifiers;
} on PlatformException {
log("Failed to get identifiers");
}
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPIdentity.getIdentifiers(success, fail);
- success is a callback containing the previously synced identifiers if the
getIdentifiers
API executed without any errors. - fail is a callback containing error information if the
getIdentifiers
API was executed with errors.
Example
ACPIdentity.getIdentifiers(function (handleCallback) {
console.log("AdobeExperienceSDK: Visitor identifiers: " + handleCallback);
}, function (handleError) {
console.log("AdobeExperenceSDK: Failed to retrieve visitor identifiers : " + handleError);
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void GetIdentifiers(AdobeGetIdentifiersCallback callback)
- callback is a callback containing the previously synced identifiers if the
GetIdentifiers
API executed without any errors.
Example
[MonoPInvokeCallback(typeof(AdobeGetIdentifiersCallback))]
public static void HandleAdobeGetIdentifiersCallback(string visitorIds)
{
print("Ids is : " + visitorIds);
}
ACPIdentity.GetIdentifiers(HandleAdobeGetIdentifiersCallback);
{% endtab %}
{% tab title="Xamarin" %}
iOS Syntax
public unsafe static void GetIdentifiers (Action<ACPMobileVisitorId[]> callback);
- callback is a callback containing the previously synced identifiers if the
GetIdentifiers
API executed without any errors.
Android Syntax
public unsafe static void GetIdentifiers (IAdobeCallback callback);
- callback is a callback containing the previously synced identifiers if the
GetIdentifiers
API executed without any errors.
iOS Example
Action<ACPMobileVisitorId[]> callback = new Action<ACPMobileVisitorId[]>(handleCallback);
ACPIdentity.GetIdentifiers(callback);
private void handleCallback(ACPMobileVisitorId[] ids)
{
String visitorIdsString = "[]";
if (ids.Length != 0)
{
visitorIdsString = "";
foreach (ACPMobileVisitorId id in ids)
{
visitorIdsString = visitorIdsString + "[Id: " + id.Identifier + ", Type: " + id.IdType + ", Origin: " + id.IdOrigin + ", Authentication: " + id.AuthenticationState + "]";
}
}
Console.WriteLine("Retrieved visitor ids: " + visitorIdsString);
}
Android Example
ACPIdentity.GetIdentifiers(new GetIdentifiersCallback());
class GetIdentifiersCallback : Java.Lang.Object, IAdobeCallback
{
public void Call(Java.Lang.Object retrievedIds)
{
System.String visitorIdsString = "[]";
if (retrievedIds != null)
{
var ids = GetObject<JavaList>(retrievedIds.Handle, JniHandleOwnership.DoNotTransfer);
if (ids != null && ids.Count > 0)
{
visitorIdsString = "";
foreach (VisitorID id in ids)
{
visitorIdsString = visitorIdsString + "[Id: " + id.Id + ", Type: " + id.IdType + ", Origin: " + id.IdOrigin + ", Authentication: " + id.GetAuthenticationState() + "]";
}
}
}
Console.WriteLine("Retrieved visitor ids: " + visitorIdsString);
}
}
{% endtab %} {% endtabs %}
This API gets the Adobe Experience Cloud Identity 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 Experience Cloud Identity Service URL variables. There will be no leading (&) or (?) punctuation because the caller is responsible for placing the variables in their resulting URL in the correct location.
If an error occurs while retrieving the URL string, the callback handler 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 IDMCAID
- Analytics Tracking ID (AID), if available from the Analytics extensionTS
- 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.
{% tabs %} {% tab title="Android" %}
{% hint style="info" %} This method was added in Core version 1.4.0 and Identity version 1.1.0. {% endhint %}
This API can be called with AdobeCallback or AdobeCallbackWithError for retrieving the attributes from the Mobile SDK. When AdobeCallbackWithError
is provided, this API uses a default timeout of 500ms. If the operation times out or an unexpected error occurs, the fail
method is called with the appropriate AdobeError.
Syntax
public static void getUrlVariables(final AdobeCallback<String> callback);
- callback has an NSString value that contains the visitor identifiers as a query string 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);
}
});
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
@objc(getUrlVariables:)
static func getUrlVariables(completion: @escaping (String?, Error?) -> Void)
- completion is invoked with String containing the visitor identifiers as a query string, or Error if an unexpected error occurs or the request times out. The returned
Error
contains the AEPError code of the specific error. The default timeout of 500ms.
Example
Identity.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))
}
}
}
Syntax
+ (void) getUrlVariables: ^(NSString * _Nullable urlVariables, NSError * _Nullable error) completion;
Example
[AEPMobileIdentity getUrlVariables:^(NSString * _Nullable urlVariables, NSError *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]];
}
}
}];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
{% hint style="info" %}
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.
{% endhint %}
Syntax
static func getUrlVariables(_ callback: @escaping (String?) -> Void)
static func getUrlVariables(completionHandler: @escaping (String?, Error?) -> Void)
- callback has an NSString value that contains the visitor identifiers as a query string 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 of 500ms.
Example
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))
}
}
}
Syntax
+ (void) getUrlVariables: (nonnull void (^) (NSString* __nullable urlVariables)) callback;
+ (void) getUrlVariablesWithCompletionHandler: (nonnull void (^) (NSString* __nullable urlVariables, NSError* __nullable error)) completionHandler;
Example
[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]];
}
}
}];
{% endtab %}
{% tab title="React Native" %}
{% hint style="info" %} This method was added in react-native-acpcore v1.0.5. {% endhint %}
Syntax
getUrlVariables(): Promise<?string>;
Example
ACPIdentity.getUrlVariables().then(urlVariables => console.log("AdobeExperenceSDK: query params = " + urlVariables));
{% endtab %}
{% tab title="Flutter" %}
Syntax
Future<String> urlVariables;
Example
String result = "";
try {
result = await FlutterACPIdentity.urlVariables;
} on PlatformException {
log("Failed to get url variables");
}
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPIdentity.getUrlVariables(success, fail);
- success is a callback containing the url variables in query parameter form if the
getUrlVariables
API executed without any errors. - fail is a callback containing error information if the
getUrlVariables
API was executed with errors.
Example
ACPIdentity.getUrlVariables(function (handleCallback) {
console.log("AdobeExperienceSDK: Url variables: " + handleCallback);
}, function (handleError) {
console.log("AdobeExperenceSDK: Failed to retrieve url variables : " + handleError);
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void GetUrlVariables(AdobeGetUrlVariables callback)
- callback is a callback containing the url variables in query parameter form if the
GetUrlVariables
API executed without any errors.
Example
[MonoPInvokeCallback(typeof(AdobeGetUrlVariables))]
public static void HandleAdobeGetUrlVariables(string urlVariables)
{
print("Url variables are : " + urlVariables);
}
ACPIdentity.GetUrlVariables(HandleAdobeGetUrlVariables);
{% endtab %}
{% tab title="Xamarin" %}
iOS Syntax
public unsafe static void GetUrlVariables (Action<NSString> callback);
- callback is a callback containing the url variables in query parameter form if the
GetUrlVariables
API executed without any errors.
Android Syntax
public unsafe static void GetUrlVariables (IAdobeCallback callback);
- callback is a callback containing the url variables in query parameter form if the
GetUrlVariables
API executed without any errors.
iOS Example
ACPIdentity.GetUrlVariables(callback => {
Console.WriteLine("Url variables: " + callback);
});
Android Example
ACPIdentity.GetUrlVariables(new StringCallback());
class StringCallback : Java.Lang.Object, IAdobeCallback
{
public void Call(Java.Lang.Object stringContent)
{
if (stringContent != null)
{
Console.WriteLine("Url variables: " + stringContent);
}
else
{
Console.WriteLine("null content in string callback");
}
}
}
{% endtab %} {% endtabs %}
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:
{% tabs %} {% tab title="Android" %}
After calling the setApplication()
method in the onCreate()
method, register the extension. If the registration was not successful, an InvalidInitException
is thrown.
public class MobileApp extends Application {
@Override
public void onCreate() {
super.onCreate();
MobileCore.setApplication(this);
try {
Identity.registerExtension();
} catch (Exception e) {
//Log the exception
}
}
}
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
{% hint style="info" %} For iOS AEP libraries, registration is changed to a single API call. Calling the MobileCore.start API is no longer required. See MobileCore.registerExtensions() for more information. {% endhint %}
// AppDelegate.swift
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
MobileCore.registerExtensions([AEPIdentity.Identity.self, Lifecycle.self, Analytics.self], {
MobileCore.configureWith(appId: "mobilePropertyEnvironmentID")
})
...
}
// AppDelegate.m
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[AEPMobileCore registerExtensions:@[AEPMobileIdentity.class, AEPMobileLifecycle.class, AEPMobileAnalytics.class] completion:^{
[AEPMobileCore configureWithAppId: @"mobilePropertyEnvironmentID"];
}];
...
}
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Register the Identity extension in your app's didFinishLaunchingWithOptions
function:
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
ACPIdentity.registerExtension()
// Override point for customization after application launch.
return true;
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
[ACPIdentity registerExtension];
// Override point for customization after application launch.
return YES;
}
{% endtab %}
{% tab title="React Native" %}
When using React Native, registering Identity with Mobile Core should be done in native code which is shown under the Android and iOS tabs. {% endtab %}
{% tab title="Flutter" %}
When using Flutter, registering Identity with Mobile Core should be done in native code which is shown under the Android and iOS tabs. {% endtab %}
{% tab title="Cordova" %}
When using Cordova, registering Identity with Mobile Core should be done in native code which is shown under the Android and iOS tabs. {% endtab %}
{% tab title="Unity" %}
Register the Identity extension in your app's Start()
function:
void Start() {
ACPIdentity.RegisterExtension();
}
{% endtab %}
{% tab title="Xamarin" %}
iOS
Register the Identity extension in your app's FinishedLaunching()
function:
public override bool FinishedLaunching(UIApplication app, NSDictionary options)
{
global::Xamarin.Forms.Forms.Init();
LoadApplication(new App());
ACPIdentity.RegisterExtension();
// start core
ACPCore.Start(startCallback);
return base.FinishedLaunching(app, options);
}
Android
Register the Identity extension in your app's OnCreate()
function:
protected override void OnCreate(Bundle savedInstanceState)
{
base.OnCreate(savedInstanceState);
global::Xamarin.Forms.Forms.Init(this, savedInstanceState);
LoadApplication(new App());
ACPIdentity.RegisterExtension();
// start core
ACPCore.Start(new CoreStartCompletionCallback());
}
{% endtab %} {% endtabs %}
The advertising ID is preserved between app upgrades, is saved and restored during the standard application backup process, available via the Signals extension, and is removed at uninstall.
{% hint style="info" %}
If the current SDK privacy status is optedout
, the advertising identifier is not set or stored.
{% endhint %}
{% tabs %} {% tab title="Android" %}
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
{% hint style="warning" %} 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 AdvertisingIdClient. {% endhint %}
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();
}
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
{% hint style="info" %} To access IDFA and handle it correctly in your mobile application, see the Apple developer documentation about IDFA {% endhint %}
{% hint style="warning" %} Starting iOS 14+, applications must use the App Tracking Transparency framework to request user authorization before using the Identifier for Advertising (IDFA). {% endhint %}
Syntax
@objc(setAdvertisingIdentifier:)
public static func setAdvertisingIdentifier(_ identifier: String?)
- identifier is a string that provides developers with a simple, standard system to continue to track the Ads through their apps.
Example
import AdSupport
import AppTrackingTransparency
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
if #available(iOS 14, *) {
setAdvertisingIdentiferUsingTrackingManager()
} else {
// Fallback on earlier versions
setAdvertisingIdentifierUsingIdentifierManager()
}
}
func setAdvertisingIdentifierUsingIdentifierManager() {
var idfa:String = "";
if (ASIdentifierManager.shared().isAdvertisingTrackingEnabled) {
idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString;
} else {
Log.debug(label: "AppDelegateExample",
"Advertising Tracking is disabled by the user, cannot process the advertising identifier.");
}
MobileCore.setAdvertisingIdentifier(idfa);
}
@available(iOS 14, *)
func setAdvertisingIdentiferUsingTrackingManager() {
ATTrackingManager.requestTrackingAuthorization { (status) in
var idfa: String = "";
switch (status) {
case .authorized:
idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
case .denied:
Log.debug(label: "AppDelegateExample",
"Advertising Tracking is denied by the user, cannot process the advertising identifier.")
case .notDetermined:
Log.debug(label: "AppDelegateExample",
"Advertising Tracking is not determined, cannot process the advertising identifier.")
case .restricted:
Log.debug(label: "AppDelegateExample",
"Advertising Tracking is restricted by the user, cannot process the advertising identifier.")
}
MobileCore.setAdvertisingIdentifier(idfa)
}
}
Syntax
+ (void) setAdvertisingIdentifier: (NSString * _Nullable identifier);
Example
#import <AdSupport/ASIdentifierManager.h>
#import <AppTrackingTransparency/ATTrackingManager.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- ...
-
if (@available(iOS 14, *)) {
[self setAdvertisingIdentiferUsingTrackingManager];
} else {
// fallback to earlier versions
[self setAdvertisingIdentifierUsingIdentifierManager];
}
}
- (void) setAdvertisingIdentifierUsingIdentifierManager {
// setup the advertising identifier
NSString *idfa = nil;
if ([[ASIdentifierManager sharedManager] isAdvertisingTrackingEnabled]) {
idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
} else {
[AEPLog debugWithLabel:@"AppDelegateExample"
message:@"Advertising Tracking is disabled by the user, cannot process the advertising identifier"];
}
[AEPMobileCore setAdvertisingIdentifier:idfa];
}
- (void) setAdvertisingIdentiferUsingTrackingManager API_AVAILABLE(ios(14)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:
^(ATTrackingManagerAuthorizationStatus status){
NSString *idfa = nil;
switch(status) {
case ATTrackingManagerAuthorizationStatusAuthorized:
idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
break;
case ATTrackingManagerAuthorizationStatusDenied:
[AEPLog debugWithLabel:@"AppDelegateExample"
message:@"Advertising Tracking is denied by the user, cannot process the advertising identifier"];
break;
case ATTrackingManagerAuthorizationStatusNotDetermined:
[AEPLog debugWithLabel:@"AppDelegateExample"
message:@"Advertising Tracking is not determined, cannot process the advertising identifier"];
break;
case ATTrackingManagerAuthorizationStatusRestricted:
[AEPLog debugWithLabel:@"AppDelegateExample"
message:@"Advertising Tracking is restricted by the user, cannot process the advertising identifier"];
break;
}
[AEPMobileCore setAdvertisingIdentifier:idfa];
}];
}
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
{% hint style="info" %} To access IDFA and handle it correctly in your mobile application, see Apple developer documentation about IDFA {% endhint %}
{% hint style="warning" %} Starting iOS 14+, applications must use the App Tracking Transparency framework to request user authorization before using the Identifier for Advertising (IDFA). {% endhint %}
Syntax
static func setAdvertisingIdentifier(adId: String?)
- adId is a string that provides developers with a simple, standard system to continue to track the Ads through their apps.
Example
import AdSupport
import AppTrackingTransparency
...
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
...
if #available(iOS 14, *) {
setAdvertisingIdentiferUsingTrackingManager()
} else {
// Fallback on earlier versions
setAdvertisingIdentifierUsingIdentifierManager()
}
}
func setAdvertisingIdentifierUsingIdentifierManager() {
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);
}
@available(iOS 14, *)
func setAdvertisingIdentiferUsingTrackingManager() {
ATTrackingManager.requestTrackingAuthorization { (status) in
var idfa: String = "";
switch (status) {
case .authorized:
idfa = ASIdentifierManager.shared().advertisingIdentifier.uuidString
case .denied:
ACPCore.log(.debug,
tag: "AppDelegateExample",
message: "Advertising Tracking is denied by the user, cannot process the advertising identifier.")
case .notDetermined:
ACPCore.log(.debug,
tag: "AppDelegateExample",
message: "Advertising Tracking is not determined, cannot process the advertising identifier.")
case .restricted:
ACPCore.log(.debug,
tag: "AppDelegateExample",
message: "Advertising Tracking is restricted by the user, cannot process the advertising identifier.")
}
ACPCore.setAdvertisingIdentifier(idfa)
}
}
Syntax
+ (void) setAdvertisingIdentifier: (nullable NSString*) adId;
Example
#import <AdSupport/ASIdentifierManager.h>
#import <AppTrackingTransparency/ATTrackingManager.h>
...
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
- ...
-
if (@available(iOS 14, *)) {
[self setAdvertisingIdentiferUsingTrackingManager];
} else {
// fallback to earlier versions
[self setAdvertisingIdentifierUsingIdentifierManager];
}
}
- (void) setAdvertisingIdentifierUsingIdentifierManager {
// setup the advertising identifier
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];
}
- (void) setAdvertisingIdentiferUsingTrackingManager API_AVAILABLE(ios(14)) {
[ATTrackingManager requestTrackingAuthorizationWithCompletionHandler:
^(ATTrackingManagerAuthorizationStatus status){
NSString *idfa = nil;
switch(status) {
case ATTrackingManagerAuthorizationStatusAuthorized:
idfa = [[[ASIdentifierManager sharedManager] advertisingIdentifier] UUIDString];
break;
case ATTrackingManagerAuthorizationStatusDenied:
[ACPCore log:ACPMobileLogLevelDebug
tag:@"AppDelegateExample"
message:@"Advertising Tracking is denied by the user, cannot process the advertising identifier"];
break;
case ATTrackingManagerAuthorizationStatusNotDetermined:
[ACPCore log:ACPMobileLogLevelDebug
tag:@"AppDelegateExample"
message:@"Advertising Tracking is not determined, cannot process the advertising identifier"];
break;
case ATTrackingManagerAuthorizationStatusRestricted:
[ACPCore log:ACPMobileLogLevelDebug
tag:@"AppDelegateExample"
message:@"Advertising Tracking is restricted by the user, cannot process the advertising identifier"];
break;
}
[ACPCore setAdvertisingIdentifier:idfa];
}];
}
{% endtab %}
{% tab title="React Native" %}
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");
{% endtab %}
{% tab title="Flutter" %}
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");
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPCore.setAdvertisingIdentifier(identifier, success, fail);
- identifier (String) provides developers with a simple, standard system to continue to track the Ads through their apps.
- success is a callback containing a general success message if the
setAdvertisingIdentifier
API executed without any errors. - fail is a callback containing error information if the
setAdvertisingIdentifier
API was executed with errors.
Example
ACPCore.setAdvertisingIdentifier("ADVTID", function (handleCallback) {
console.log("AdobeExperienceSDK: Advertising identifier successfully set.");
}, function (handleError) {
console.log("AdobeExperenceSDK: Failed to set advertising identifier : " + handleError);
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void SetAdvertisingIdentifier(string adId)
- adId (String) provides developers with a simple, standard system to continue to track the Ads through their apps.
Example
ACPCore.SetAdvertisingIdentifier("ADVTID");
{% endtab %}
{% tab title="Xamarin" %}
iOS Syntax
public static void SetAdvertisingIdentifier (string adId);
- adId (String) provides developers with a simple, standard system to continue to track the Ads through their apps.
Android Syntax
public unsafe static void SetAdvertisingIdentifier (string advertisingIdentifier);
- advertisingIdentifier (String) provides developers with a simple, standard system to continue to track the Ads through their apps.
Example
ACPCore.SetAdvertisingIdentifier("ADVTID");
{% endtab %} {% endtabs %}
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.
{% hint style="info" %}
It is recommended to call setPushIdentifier
on each application launch to ensure the most up-to-date device token is set to the SDK. If no device token is available, null
/nil
should be passed.
{% endhint %}
{% tabs %} {% tab title="Android" %}
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);
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
@objc(setPushIdentifier:)
public static func setPushIdentifier(_ deviceToken: Data?)
- deviceToken is a string that contains the device token for push notifications.
Example
// Set the deviceToken that the APNs has assigned to the device
MobileCore.setPushIdentifier(deviceToken)
Syntax
+ (void) setPushIdentifier: (NSString * _Nullable deviceToken);
Example
// Set the deviceToken that the APNS has assigned to the device
[AEPMobileCore setPushIdentifier:deviceToken];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
static func setPushIdentifier(deviceToken: NSData?)
- deviceToken is a string that contains the device token for push notifications.
Example
// Set the deviceToken that the APNs has assigned to the device
ACPCore.setPushIdentifier(deviceToken)
Syntax
+ (void) setPushIdentifier: (nullable NSData*) deviceToken;
Example
// Set the deviceToken that the APNS has assigned to the device
[ACPCore setPushIdentifier:deviceToken];
{% endtab %}
{% tab title="React Native" %}
Syntax
ACPCore.setPushIdentifier(pushIdentifier);
- pushIdentifier is a string that contains the device token for push notifications.
Example
ACPCore.setPushIdentifier("pushID");
{% endtab %} {% endtabs %}
The syncIdentifier()
and syncIdentifiers()
APIs update the specified customer IDs with the Adobe Experience Cloud Identity Service.
These APIs synchronize the provided customer identifier type key and value with the authentication state to the Experience Cloud Identity 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 Experience Cloud Identity 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 Experience Cloud Identity 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.
{% tabs %} {% tab title="Android" %}
Syntax
public static void syncIdentifier(final String identifierType,
final String identifier,
final VisitorID.AuthenticationState authenticationState);
- identifierType (String) contains the
identifier type
, and this parameter should not be null or empty. The allowed characters are [A-Za-z0-9_.] - identifier (String) contains the
identifier value
, and this parameter should not be null or empty. - authenticationState (AuthenticationState) indicates the authentication state of the user and contains one of the VisitorID.AuthenticationState values.
Example
Identity.syncIdentifier("idType",
"idValue",
VisitorID.AuthenticationState.AUTHENTICATED);
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
@objc(syncIdentifierWithType:identifier:authenticationState:)
static func syncIdentifier(identifierType: String, identifier: String, authenticationState: MobileVisitorAuthenticationState)
-
The identifierType (String) contains the
identifier type
, and this parameter should not be null or empty. The allowed characters are [A-Za-z0-9_.] -
The identifier (String) contains the
identifier
value, and this parameter should not be null or empty.If either the
identifierType
oridentifier
contains a null or an empty string, the identifier is ignored by the Identity extension. -
The authenticationState (MobileVisitorAuthenticationState) value indicates the authentication state for the user and contains one of the MobileVisitorAuthenticationState values.
Example
Identity.syncIdentifier(identifierType: "idType",
identifier: "idValue",
authentication: .unknown)
Syntax
+ (void) syncIdentifierWithType: (NSString * _Nonnull identifierType)
identifier: (NSString * _Nonnull identifier)
authentication: (enum AEPAuthenticationState authenticationState);
Example
[AEPMobileIdentity syncIdentifierWithType:@"idType"
identifier:@"idValue"
authenticationState:AEPMobileVisitorAuthStateUnknown];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
static func syncIdentifier(_ identifierType: String, identifier: String, authentication authenticationState: ACPMobileVisitorAuthenticationState)
-
The identifierType (String) contains the
identifier type
, and this parameter should not be null or empty. The allowed characters are [A-Za-z0-9_.] -
The identifier (String) contains the
identifier
value, and this parameter should not be null or empty.If either the
identifier type
oridentifier
contains a null or an empty string, the identifier is ignored by the Identity extension. -
The authenticationState (ACPMobileVisitorAuthenticationState) value indicates the authentication state for the user and contains one of the ACPMobileVisitorAuthenticationState values.
Example
ACPIdentity.syncIdentifier("idType", identifier: "idValue", authentication: ACPMobileVisitorAuthenticationState.unknown)
Syntax
+ (void) syncIdentifier: (nonnull NSString*) identifierType
identifier: (nonnull NSString*) identifier
authentication: (ADBMobileVisitorAuthenticationState) authenticationState;
Example
[ACPIdentity syncIdentifier:@"idType" identifier:@"idValue" authentication:ACPMobileVisitorAuthenticationStateUnknown];
{% endtab %}
{% tab title="React Native" %}
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 allowed characters are [A-Za-z0-9_.] -
The identifier (String) contains the
identifier
value, and this parameter should not be null or empty.If either the
identifier type
oridentifier
contains a null or an empty string, the identifier is ignored by the Identity extension. -
authenticationState (ACPMobileVisitorAuthenticationState) value indicating authentication state for the user and contains one of the following ACPMobileVisitorAuthenticationState values.
Example
import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';
ACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);
{% endtab %}
{% tab title="Flutter" %}
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 allowed characters are [A-Za-z0-9_.] -
The identifier (String) contains the
identifier
value, and this parameter should not be null or empty.If either the
identifier type
oridentifier
contains a null or an empty string, the identifier is ignored by the Identity extension. -
authState (ACPMobileVisitorAuthenticationState value indicating authentication state for the user and contains one of the following ACPMobileVisitorAuthenticationState values.
Example
import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
FlutterACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPIdentity.syncIdentifier = function(identifierType, identifier, authState, success, fail);
-
The identifierType (String) contains the
identifier type
, and this parameter should not be null or empty. The allowed characters are [A-Za-z0-9_.] -
The identifier (String) contains the
identifier
value, and this parameter should not be null or empty.If either the
identifier type
oridentifier
contains a null or an empty string, the identifier is ignored by the Identity extension. -
authState (ACPMobileVisitorAuthenticationState) value indicating authentication state for the user and contains one of the following ACPMobileVisitorAuthenticationState values.
-
success is a callback containing the visitor id type, value, and authentication state if the
syncIdentifier
API executed without any errors. -
fail is a callback containing error information if the
syncIdentifier
API was executed with errors.
Example
ACPIdentity.syncIdentifier("id1", "value1", ACPIdentity.ACPMobileVisitorAuthenticationStateUnknown, function (handleCallback) {
console.log("AdobeExperenceSDK: Identifier synced successfully : " + handleCallback);
}, function (handleError) {
console.log("AdobeExperenceSDK: Failed to sync identifier : " + handleError);
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void SyncIdentifier(string identifierType, string identifier, ACPAuthenticationState authState)
-
The identifierType (String) contains the
identifier type
, and this parameter should not be null or empty. The allowed characters are [A-Za-z0-9_.] -
The identifier (String) contains the
identifier
value, and this parameter should not be null or empty.If either the
identifier type
oridentifier
contains a null or an empty string, the identifier is ignored by the Identity extension. -
authState (ACPAuthenticationState) value indicating authentication state for the user and contains one of the following ACPAuthenticationState values.
Example
ACPIdentity.SyncIdentifier("idType1", "idValue1", ACPIdentity.ACPAuthenticationState.AUTHENTICATED);
{% endtab %}
{% tab title="Xamarin" %}
iOS Syntax
public static void SyncIdentifier (string identifierType, string identifier, ACPMobileVisitorAuthenticationState authenticationState);
-
The identifierType (String) contains the
identifier type
, and this parameter should not be null or empty. The allowed characters are [A-Za-z0-9_.] -
The identifier (String) contains the
identifier
value, and this parameter should not be null or empty.If either the
identifier type
oridentifier
contains a null or an empty string, the identifier is ignored by the Identity extension. -
authenticationState (ACPMobileVisitorAuthenticationState value indicating authentication state for the user and contains one of the following ACPMobileVisitorAuthenticationState values.
Android Syntax
public unsafe static void SyncIdentifier (string identifierType, string identifier, VisitorID.AuthenticationState authenticationState);
-
The identifierType (String) contains the
identifier type
, and this parameter should not be null or empty. The allowed characters are [A-Za-z0-9_.] -
The identifier (String) contains the
identifier
value, and this parameter should not be null or empty.If either the
identifier type
oridentifier
contains a null or an empty string, the identifier is ignored by the Identity extension. -
authenticationState (AuthenticationState) value indicating authentication state for the user and contains one of the following VisitorID.AuthenticationState values.
iOS Example
ACPIdentity.SyncIdentifier("idType1", "idValue1", ACPMobileVisitorAuthenticationState.Authenticated);
Android Example
ACPIdentity.SyncIdentifier("idType1", "idValue1", VisitorID.AuthenticationState.Authenticated);
{% endtab %} {% endtabs %}
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
.
{% tabs %} {% tab title="Android" %}
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.syncIdentifiers(identifiers);
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
@objc(syncIdentifiers:)
static func syncIdentifiers(identifiers: [String: String]?)
- The identifiers dictionary contains identifier type as the key and identifier as the value, both identifier type and identifier should be non empty and non nil values.
Example
let ids : [String: String] = ["idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"];
Identity.syncIdentifiers(identifiers: ids)
Syntax
+ (void) syncIdentifiers: (NSDictionary<NSString *, NSString *> * _Nullable identifiers);
Example
NSDictionary *ids = @{@"idType1":@"idValue1",
@"idType2":@"idValue2",
@"idType3":@"idValue3"};
[AEPMobileIdentity syncIdentifiers:ids];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
static func syncIdentifiers(_ identifiers: [AnyHashable : Any]?)
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
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
let identifiers : [String: String] = ["idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"];
ACPIdentity.syncIdentifiers(identifiers)
Syntax
+ (void) syncIdentifiers: (nullable NSDictionary*) identifiers;
Example
NSDictionary *ids = @{@"idType1":@"idValue1",
@"idType2":@"idValue2",
@"idType3":@"idValue3"};
[ACPIdentity syncIdentifiers:ids];
{% endtab %}
{% tab title="React Native" %}
Syntax
syncIdentifiers(identifiers?: {string: string});
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
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"});
{% endtab %}
{% tab title="Flutter" %}
Syntax
Future<void> syncIdentifiers (Map<String, String> identifiers);
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
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"});
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPIdentity.syncIdentifiers = function(identifiers, success, fail);
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
as the value.If any of the identifier pairs contains an empty or null value as the
identifier type
, then it will be ignored. -
success is a callback containing the synced identifiers if the
syncIdentifiers
API executed without any errors. -
fail is a callback containing error information if the
syncIdentifiers
API was executed with errors.
Example
ACPIdentity.syncIdentifiers({"idType1":"idValue1", "idType2":"idValue2", "idType3":"idValue3"}, function (handleCallback) {
console.log("AdobeExperienceSDK: " + handleCallback)
}, function (handleError) {
console.log("AdobeExperenceSDK: Failed to sync identifiers : " + handleError)
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void SyncIdentifiers(Dictionary<string, string> identifiers)
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
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
Dictionary<string, string> ids = new Dictionary<string, string>();
ids.Add("idsType1", "idValue1");
ids.Add("idsType2", "idValue2");
ids.Add("idsType3", "idValue3");
ACPIdentity.SyncIdentifiers(ids);
{% endtab %}
{% tab title="Xamarin" %}
iOS Syntax
public static void SyncIdentifiers (NSDictionary identifiers);
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
as the value.If any of the identifier pairs contains an empty or null value as the
identifier type
, then it will be ignored.
Android Syntax
public unsafe static void SyncIdentifiers (IDictionary<string, string> identifiers);
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
as the value.If any of the identifier pairs contains an empty or null value as the
identifier type
, then it will be ignored.
iOS Example
var ids = new NSMutableDictionary<NSString, NSObject>
{
["idsType1"] = new NSString("idValue1"),
["idsType2"] = new NSString("idValue2"),
["idsType3"] = new NSString("idValue3")
};
ACPIdentity.SyncIdentifiers(ids);
Android Example
var ids = new Dictionary<string, string>();
ids.Add("idsType1", "idValue1");
ids.Add("idsType2", "idValue2");
ids.Add("idsType3", "idValue3");
ACPIdentity.SyncIdentifiers(ids);
{% endtab %} {% endtabs %}
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 Experience Cloud Identity Service.
{% tabs %} {% tab title="Android" %}
Syntax
public static void syncIdentifiers(final Map<String, String> identifiers, final VisitorID.AuthenticationState authState)
- identifiers is 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.
Example
Map<String, String> identifiers = new HashMap<String, String>();
identifiers.put("idType1", "idValue1");
identifiers.put("idType2", "idValue2");
identifiers.put("idType3", "idValue3");
Identity.syncIdentifiers(identifiers, VisitorID.AuthenticationState.AUTHENTICATED);
{% endtab %}
{% tab title="iOS (AEP 3.x)" %}
Syntax
@objc(syncIdentifiers:authenticationState:)
static func syncIdentifiers(identifiers: [String: String]?, authenticationState: MobileVisitorAuthenticationState)
-
The identifiers dictionary contains identifier type as the key and identifier as the value, both identifier type and identifier should be non empty and non nil values.
-
The authenticationState (MobileVisitorAuthenticationState) indicates the authentication state of the user and contains one of the MobileVisitorAuthenticationState values.
Example
let ids : [String: String] = ["idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"];
Identity.syncIdentifiers(identifiers: ids, authenticationState: .authenticated)
Syntax
+ (void) syncIdentifiers: (NSDictionary<NSString *, NSString *> * _Nullable identifiers)
authentication: (enum AEPAuthenticationState authenticationState);
Example
NSDictionary *ids = @{@"idType1":@"idValue1",
@"idType2":@"idValue2",
@"idType3":@"idValue3"};
[AEPMobileIdentity syncIdentifiers:ids authenticationState:AEPMobileVisitorAuthStateAuthenticated];
{% endtab %}
{% tab title="iOS (ACP 2.x)" %}
Syntax
static func syncIdentifiers(_ identifiers: [AnyHashable : Any]?, authentication authenticationState: ACPMobileVisitorAuthenticationState)
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
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.
Example
let ids : [String: String] = ["idType1":"idValue1",
"idType2":"idValue2",
"idType3":"idValue3"];
ACPIdentity.syncIdentifiers(identifiers, authentication:
ACPMobileVisitorAuthenticationState.authenticated)
Syntax
+ (void) syncIdentifiers: (nullable NSDictionary*) identifiers authentication: (ACPMobileVisitorAuthenticationState) authenticationState;
Example
NSDictionary *ids = @{@"idType1":@"idValue1",
@"idType2":@"idValue2",
@"idType3":@"idValue3"};
[ACPIdentity syncIdentifiers:ids authentication:ACPMobileVisitorAuthenticationStateAuthenticated];
{% endtab %}
{% tab title="React Native" %}
Syntax
syncIdentifiersWithAuthState(identifiers?: {string: string}, authenticationState: string);
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
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.
Example
import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';
ACPIdentity.syncIdentifiersWithAuthState({"id1": "identifier1"}, ACPMobileVisitorAuthenticationState.UNKNOWN);
{% endtab %}
{% tab title="Flutter" %}
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 anidentifier
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.
Example
import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';
FlutterACPIdentity.syncIdentifiersWithAuthState({"idType1":"idValue1", "idType2":"idValue2", "idType3":"idValue3"}, ACPMobileVisitorAuthenticationState.UNKNOWN);
{% endtab %}
{% tab title="Cordova" %}
Syntax
ACPIdentity.syncIdentifiers = function(identifiers, authState, success, fail);
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
as the value.If any of the identifier pairs contains an empty or null value as the
identifier type
, then it will be ignored. -
authState value indicating authentication state for the identifiers to be synced and contains one of the ACPMobileVisitorAuthenticationState values.
-
success is a callback containing the synced identifiers if the
syncIdentifiers
API executed without any errors. -
fail is a callback containing error information if the
syncIdentifiers
API was executed with errors.
Example
ACPIdentity.syncIdentifiers({"idType1":"idValue1", "idType2":"idValue2", "idType3":"idValue3"}, ACPIdentity.ACPMobileVisitorAuthenticationStateAuthenticated, function (handleCallback) {
console.log("AdobeExperienceSDK: " + handleCallback)
}, function (handleError) {
console.log("AdobeExperenceSDK: Failed to sync identifiers : " + handleError)
});
{% endtab %}
{% tab title="Unity" %}
Syntax
public static void SyncIdentifiers(Dictionary<string, string> ids, ACPAuthenticationState authenticationState)
-
The ids dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
as the value.If any of the identifier pairs contains an empty or null value as the
identifier type
, then it will be ignored. -
authenticationState value indicating authentication state for the identifiers to be synced and contains one of the ACPAuthenticationState values.
Example
Dictionary<string, string> ids = new Dictionary<string, string>();
ids.Add("idsType1", "idValue1");
ids.Add("idsType2", "idValue2");
ids.Add("idsType3", "idValue3");
ACPIdentity.SyncIdentifiers(ids, ACPIdentity.ACPAuthenticationState.AUTHENTICATED);
ACPIdentity.SyncIdentifiers(ids, ACPIdentity.ACPAuthenticationState.LOGGED_OUT);
ACPIdentity.SyncIdentifiers(ids, ACPIdentity.ACPAuthenticationState.UNKNOWN);
{% endtab %}
{% tab title="Xamarin" %}
iOS Syntax
public static void SyncIdentifiers (NSDictionary identifiers, ACPMobileVisitorAuthenticationState authenticationState);
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
as the value.If any of the identifier pairs contains an empty or null value as the
identifier type
, then it will be ignored. -
authenticationState value indicating authentication state for the user and contains one of the following ACPMobileVisitorAuthenticationState values.
Android Syntax
public unsafe static void SyncIdentifiers (IDictionary<string, string> identifiers, VisitorID.AuthenticationState authenticationState);
-
The identifiers dictionary contains identifiers, and each identifier contains an
identifier type
as the key and anidentifier
as the value.If any of the identifier pairs contains an empty or null value as the
identifier type
, then it will be ignored. -
authenticationState value indicating authentication state for the user and contains one of the following VisitorID.AuthenticationState values.
iOS Example
var ids = new NSMutableDictionary<NSString, NSObject>
{
["idsType1"] = new NSString("idValue1"),
["idsType2"] = new NSString("idValue2"),
["idsType3"] = new NSString("idValue3")
};
ACPIdentity.SyncIdentifiers(ids, ACPMobileVisitorAuthenticationState.LoggedOut);
Android Example
var ids = new Dictionary<string, string>();
ids.Add("idsType1", "idValue1");
ids.Add("idsType2", "idValue2");
ids.Add("idsType3", "idValue3");
ACPIdentity.SyncIdentifiers(ids, VisitorID.AuthenticationState.LoggedOut);
{% endtab %} {% endtabs %}
{% tabs %} {% tab title="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 Adobe Experience Cloud Identity 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();
}
{% endtab %}
{% tab title="iOS (AEP 3.x)" %} iOS (AEP 3.x)
MobileVisitorAuthenticationState
This is used to indicate the authentication state for the current Identifiable
.
@objc(AEPMobileVisitorAuthState) public enum MobileVisitorAuthenticationState: Int, Codable {
case unknown = 0
case authenticated = 1
case loggedOut = 2
}
Identifiable
@objc(AEPIdentifiable) public protocol Identifiable {
/// Origin of the identifier
var origin: String? { get }
/// Type of the identifier
var type: String? { get }
/// The identifier
var identifier: String? { get }
/// The authentication state for the identifier
var authenticationState: MobileVisitorAuthenticationState { get }
}
{% endtab %}
{% tab title="iOS (ACP 2.x)" %} iOS (ACP 2.x)
ACPMobileVisitorAuthenticationState
This is used to indicate the authentication state for the current VisitorID
.
typedef NS_ENUM(NSUInteger,
ACPMobileVisitorAuthenticationState) {
ACPMobileVisitorAuthenticationStateUnknown = 0,
ACPMobileVisitorAuthenticationStateAuthenticated = 1,
ACPMobileVisitorAuthenticationStateLoggedOut = 2 };
ACPMobileVisitorId
This is an identifier to be used with the Adobe Experience Cloud Identity 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
{% endtab %}
{% tab title="React Native" %}
ACPVisitorID
This is an identifier to be used with the Adobe Experience Cloud Identity 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;
{% endtab %}
{% tab title="Flutter" %}
ACPVisitorID
This is an identifier to be used with the Adobe Experience Cloud Identity 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};
{% endtab %}
{% tab title="Cordova" %}
ACPMobileVisitorAuthenticationState
This is used to indicate the authentication state for the current VisitorID
.
ACPIdentity.ACPMobileVisitorAuthenticationStateUnknown = 0;
ACPIdentity.ACPMobileVisitorAuthenticationStateAuthenticated = 1;
ACPIdentity.ACPMobileVisitorAuthenticationStateLoggedOut = 2;
{% endtab %}
{% tab title="Unity" %}
ACPAuthenticationState
This is used to indicate the authentication state for the current VisitorID
.
ACPIdentity.ACPAuthenticationState.UNKNOWN = 0;
ACPIdentity.ACPAuthenticationState.AUTHENTICATED = 1;
ACPIdentity.ACPAuthenticationState.LOGGED_OUT = 2;
{% endtab %}
{% tab title="Xamarin" %}
iOS
ACPMobileVisitorAuthenticationState
This is used to indicate the authentication state for the current ACPMobileVisitorId
.
ACPMobileVisitorAuthenticationState.Unknown = 0;
ACPMobileVisitorAuthenticationState.Authenticated = 1;
ACPMobileVisitorAuthenticationState.LoggedOut = 2;
Android
VisitorID.AuthenticationState
This is used to indicate the authentication state for the current VisitorID
.
VisitorID.AuthenticationState.Unknown = 0;
VisitorID.AuthenticationState.Authenticated = 1;
VisitorID.AuthenticationState.LoggedOut = 2;
{% endtab %} {% endtabs %}