Skip to content

Latest commit

 

History

History
2934 lines (2125 loc) · 97.4 KB

File metadata and controls

2934 lines (2125 loc) · 97.4 KB

Identity API reference

appendVisitorInfoForURL

{% tabs %} {% tab title="Android" %} This API appends Adobe visitor information to the query component of the specified URL.

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

  • The adobe_mc attribute is a URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

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

Java

appendVisitorInfoForURL

Syntax

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

Example

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

{% hint style="info" %} 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. {% endhint %} {% endtab %}

{% tab title="iOS" %}

appendToURL

{% hint style="info" %} Method appendToUrl:withCompletionHandler was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0. {% endhint %}

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

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

  • The adobe_mc attribute is a URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

iOS

Syntax

+ (void) appendToUrl: (nullable NSURL*) baseUrl withCallback: (nullable void (^) (NSURL* __nullable urlWithVisitorData)) callback;
+ (void) appendToUrl: (nullable NSURL*) baseUrl withCompletionHandler: (nullable void (^) (NSURL* __nullable urlWithVersionData, NSError* __nullable error)) completionHandler;
  • baseUrl is the URL to which the visitor information needs to be appended. If the visitor information is nil or empty, the URL is returned as is.
  • callback is invoked after the updated URL is available.
  • completionHandler is invoked with urlWithVersionData after the updated URL is available or error if an unexpected exception occurs or the request times out. The returned NSError contains the ACPError code of the specific error. The default timeout is 500ms.

Examples

Objective-C

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

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

Swift

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

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

{% hint style="info" %} 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. {% endhint %} {% endtab %}

{% tab title="React Native" %}

appendVisitorInfoForURL

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

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

  • The adobe_mc attribute is a URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

JavaScript

Syntax

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

Example

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

{% hint style="info" %} 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. {% endhint %} {% endtab %}

{% tab title="Flutter" %}

appendVisitorInfoForURL

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

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

  • The adobe_mc attribute is a URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

Dart

Syntax

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

Example

String result = "";

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

{% hint style="info" %} 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. {% endhint %} {% endtab %}

{% tab title="Cordova" %}

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.

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

{% hint style="info" %} 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 we recommend that you use getUrlVariables. {% endhint %} {% endtab %}

{% tab title="Unity" %}

AppendToUrl

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.

C#

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

{% hint style="info" %} 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 we recommend that you use GetUrlVariables. {% endhint %} {% endtab %}

{% tab title="Xamarin" %}

AppendToUrl

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.

C#

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

{% hint style="info" %} 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 we recommend that you use GetUrlVariables. {% endhint %} {% endtab %} {% endtabs %}

extensionVersion

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

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

{% tabs %} {% tab title="Android" %}

Java

String identityExtensionVersion = Identity.extensionVersion();

{% endtab %}

{% tab title="iOS" %}

iOS

Objective-C

NSString *identityExtensionVersion = [ACPIdentity extensionVersion];

Swift

var identityExtensionVersion  = ACPIdentity.extensionVersion()

{% endtab %}

{% tab title="React Native" %}

JavaScript

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

{% endtab %}

{% tab title="Flutter" %}

Dart

String identityExtensionVersion = FlutterACPIdentity.extensionVersion;

{% endtab %}

{% tab title="Cordova" %}

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" %}

C#

Syntax

public static string ExtensionVersion()

Example

string identityVersion = ACPIdentity.ExtensionVersion();

{% endtab %}

{% tab title="Xamarin" %}

C#

Syntax

public static string ExtensionVersion ();

Example

string identityVersion = ACPIdentity.ExtensionVersion();

{% endtab %} {% endtabs %}

getExperienceCloudId

{% tabs %} {% tab title="Android" %}

getExperienceCloudId

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

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

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

Java

Syntax

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

Example

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

{% endtab %}

{% tab title="iOS" %}

getExperienceCloudId

{% hint style="info" %} Method getExperienceCloudIdWithCompletionHandler was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0. {% endhint %}

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

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

Syntax

+ (void) getExperienceCloudId: (nonnull void (^) (NSString* __nullable experienceCloudId)) callback;
+ (void) getExperienceCloudIdWithCompletionHandler: (nonnull void (^) (NSString* __nullable experienceCloudId, NSError* __nullable error)) completionHandler;
  • callback is invoked after the ECID is available.
  • completionHandler is invoked with experienceCloudId after the ECID is available, or error if an unexpected error occurs or the request times out. The returned NSError contains the ACPError code of the specific error. The default timeout is 500ms.

Examples

Objective-C

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

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

Swift

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

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

{% endtab %}

{% tab title="React Native" %}

getExperienceCloudId

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

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

JavaScript

Syntax

getExperienceCloudId(): Promise<?string>;

Example

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

{% endtab %}

{% tab title="Flutter" %}

getExperienceCloudId

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

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

Dart

Syntax

Future<String> experienceCloudId;

Example

String result = "";

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

{% endtab %}

{% tab title="Cordova" %}

getExperienceCloudId

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

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

Cordova

Syntax

ACPIdentity.getExperienceCloudId(success, fail);
  • success is a callback containing the experience cloud id 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" %}

getExperienceCloudId

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

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

C#

Syntax

public static void GetExperienceCloudId(AdobeGetExperienceCloudIdCallback callback)
  • callback is a callback containing the experience cloud id 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" %}

getExperienceCloudId

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

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

C#

iOS Syntax

public unsafe static void GetExperienceCloudId (Action<NSString> callback);
  • callback is a callback containing the experience cloud id if the getExperienceCloudId API executed without any errors.

Android Syntax

public unsafe static void GetExperienceCloudId (IAdobeCallback callback);
  • callback is a callback containing the experience cloud id 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 %}

getIdentifiers

{% tabs %} {% tab title="Android" %}

getIdentifiers

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

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

Java

Syntax

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

Example

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

});

{% endtab %}

{% tab title="iOS" %}

getIdentifiers

{% hint style="info" %} Method getIdentifiersWithCompletionHandler was added in ACPCore version 2.5.0 and ACPIdentity version 2.2.0. {% endhint %}

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

iOS

Syntax

+ (void) getIdentifiers: (nonnull void (^) (NSArray<ADBMobileVisitorId*>* __nullable visitorIDs)) callback;
+ (void) getIdentifiersWithCompletionHandler: (nonnull void (^) (NSArray<ACPMobileVisitorId*>* __nullable visitorIDs, NSError* __nullable error)) completionHandler;
  • callback is invoked after the customer identifiers are available.
  • completionHandler is invoked with visitorIDs after the customer identifiers are available, or error if an unexpected error occurs or the request times out. The returned NSError contains the ACPError code of the specific error. The default timeout is 500ms.

Examples

Objective-C

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

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

Swift

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

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

{% endtab %}

{% tab title="React Native" %}

getIdentifiers

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

JavaScript

Syntax

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

Example

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

{% endtab %}

{% tab title="Flutter" %}

getIdentifiers

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

Dart

Syntax

 Future<List<ACPMobileVisitorId>> identifiers;

Example

List<ACPMobileVisitorId> result;

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

{% endtab %}

{% tab title="Cordova" %}

getIdentifiers

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

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" %}

getIdentifiers

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

C#

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" %}

getIdentifiers

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

C#

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 %}

getUrlVariables

{% tabs %} {% tab title="Android" %}

getUrlVariables

{% hint style="info" %} This method was added in Core version 1.4.0 and Identity version 1.1.0_._ {% endhint %}

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

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

  • The adobe_mc attribute is an URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

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

Java

Syntax

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

Example

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

{% endtab %}

{% tab title="iOS" %}

getUrlVariables

{% 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 %}

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

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

  • The adobe_mc attribute is an URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

iOS

Syntax

+ (void) getUrlVariables: (nonnull void (^) (NSString* __nullable urlVariables)) callback;
+ (void) getUrlVariablesWithCompletionHandler: (nonnull void (^) (NSString* __nullable urlVariables, NSError* __nullable error)) completionHandler;
  • callback has an NSString value that contains the visitor identifiers as a querystring after the service request is complete.
  • completionHandler is invoked with urlVariables containing the visitor identifiers as a query string, or error if an unexpected error occurs or the request times out. The returned NSError contains the ACPError code of the specific error. The default timeout is 500ms.

Examples

Objective-C

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

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

Swift

ACPIdentity.getUrlVariables {(urlVariables) in
  var urlStringWithVisitorData: String = "https://example.com"
  if let urlVariables: String = urlVariables {
    urlStringWithVisitorData.append("?" + urlVariables)
  }

  guard let urlWithVisitorData: URL = URL(string: urlStringWithVisitorData)   else {
    // handle error, unable to construct URL
    return
  }
  // APIs which update the UI must be called from main thread
  DispatchQueue.main.async {
    self.webView.load(URLRequest(url: urlWithVisitorData))
  }
}

ACPIdentity.getUrlVariables { (urlVariables, error) in
  if let error = error {
    // handle error
  } else {
    var urlStringWithVisitorData: String = "https://example.com"
    if let urlVariables: String = urlVariables {
      urlStringWithVisitorData.append("?" + urlVariables)
    }

    guard let urlWithVisitorData: URL = URL(string: urlStringWithVisitorData) else {
      // handle error, unable to construct URL
      return
    }
    // APIs which update the UI must be called from main thread
    DispatchQueue.main.async {
      self.webView.load(URLRequest(url: urlWithVisitorData))
    }
  }
}

{% endtab %}

{% tab title="React Native" %}

JavaScript

{% hint style="info" %} This method was added in react-native-acpcore v1.0.5. {% endhint %}

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

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

  • The adobe_mc attribute is an URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

Syntax

getUrlVariables(): Promise<?string>;

Example

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

{% endtab %}

{% tab title="Flutter" %}

getUrlVariables

Dart

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

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

  • The adobe_mc attribute is an URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

Syntax

 Future<String> urlVariables;

Example

String result = "";

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

{% endtab %}

{% tab title="Cordova" %}

Cordova

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

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

  • The adobe_mc attribute is an URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

Syntax

ACPIdentity.getUrlVariables(success, fail);
  • success is a callback containing the url varaibles 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" %}

C#

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

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

  • The adobe_mc attribute is an URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

Syntax

public static void GetUrlVariables(AdobeGetUrlVariables callback)
  • callback is a callback containing the url varaibles 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" %}

C#

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

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

  • The adobe_mc attribute is an URL encoded list that contains:
    • MCMID - Experience Cloud ID (ECID)
    • MCORGID - Experience Cloud Org ID
    • MCAID - Analytics Tracking ID (AID), if available from the Analytics extension
    • TS - A timestamp taken when this request was made
  • The optional adobe_aa_vid attribute is the URL-encoded Analytics Custom Visitor ID (VID), if previously set in the Analytics extension.

iOS Syntax

public unsafe static void GetUrlVariables (Action<NSString> callback);
  • callback is a callback containing the url varaibles 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 varaibles 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 %}

registerExtension

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

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

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

Java

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" %}

iOS

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

Objective-C

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

Swift

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

{% endtab %}

{% tab title="React Native" %}

JavaScript

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

{% tab title="Flutter" %}

Dart

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

{% tab title="Cordova" %}

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" %}

C#

Register the Identity extension in your app's Start() function:

void Start() {
  ACPIdentity.RegisterExtension();
}

{% endtab %}

{% tab title="Xamarin" %}

C#

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 %}

setAdvertisingIdentifier

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

{% hint style="info" %} If the current SDK privacy status is optedout, the advertising identifier is not set or stored. {% endhint %}

{% tabs %} {% tab title="Android" %}

setAdvertisingIdentifier

This API sets the provided advertising identifier.

Java

Syntax

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

Example

{% 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 Advertising ID. {% 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" %}

setAdvertisingIdentifier

{% 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 %}

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>
#import <AppTrackingTransparency/ATTrackingManager.h>
...

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
-   ...
-   
    if (@available(iOS 14, *)) {
        [self setAdvertisingIdentitiferUsingTrackingManager];
    } 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) setAdvertisingIdentitiferUsingTrackingManager 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];
    }];
}

Swift

import AdSupport
import AppTrackingTransparency
...

func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
    ...
    if #available(iOS 14, *) {
       setAdvertisingIdentitiferUsingTrackingManager()
    } 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 setAdvertisingIdentitiferUsingTrackingManager() {
    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)
    }
}

{% endtab %}

{% tab title="React Native" %}

setAdvertisingIdentifier

JavaScript

Syntax

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

Example

ACPCore.setAdvertisingIdentifier("ADVTID");

{% endtab %}

{% tab title="Flutter" %}

setAdvertisingIdentifier

Dart

Syntax

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

Example

FlutterACPCore.setAdvertisingIdentifier("ADVTID");

{% endtab %}

{% tab title="Cordova" %}

setAdvertisingIdentifier

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" %}

SetAdvertisingIdentifier

C#

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" %}

SetAdvertisingIdentifier

C#

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 %}

setPushIdentifier

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

{% 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" %}

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

{% endtab %}

{% tab title="iOS" %}

setPushIdentifier

iOS

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

Example

Objective-C

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

Swift

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

{% endtab %}

{% tab title="React Native" %}

setPushIdentifier

JavaScript

Syntax

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

Example

ACPCore.setPushIdentifier("pushID");

{% endtab %} {% endtabs %}

syncIdentifier

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

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

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

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

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

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

{% tabs %} {% tab title="Android" %}

Java

Syntax

public static void syncIdentifier(final String identifierType,
                                      final String identifier,
                                      final VisitorID.AuthenticationState authenticationState);
  • identifierType (String) containsthe identifier type, and this parameter should not be null or empty.
  • identifier (String) contains the identifier value, and this parameter should not be null or empty.
  • authenticationState indicates the authentication state of the user and contains one of the VisitorID.AuthenticationState values:
    • VisitorID.AuthenticationState.AUTHENTICATED
    • VisitorID.AuthenticationState.LOGGED_OUT
    • VisitorID.AuthenticationState.UNKNOWN

Example

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

{% endtab %}

{% tab title="iOS" %}

iOS

Syntax

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

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

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

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

    • ACPMobileVisitorAuthenticationStateAuthenticated
    • ACPMobileVisitorAuthenticationStateLoggedOut
    • ACPMobileVisitorAuthenticationStateUnknown

Examples

Objective-C

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

Swift

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

{% endtab %}

{% tab title="React Native" %}

JavaScript

Syntax

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

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

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

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

  • ACPMobileVisitorAuthenticationState.AUTHENTICATED

  • ACPMobileVisitorAuthenticationState.LOGGED_OUT

  • ACPMobileVisitorAuthenticationState.UNKNOWN

Example

import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';

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

{% endtab %}

{% tab title="Flutter" %}

Dart

Syntax

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

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

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

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

  • ACPMobileVisitorAuthenticationState.AUTHENTICATED

  • ACPMobileVisitorAuthenticationState.LOGGED_OUT

  • ACPMobileVisitorAuthenticationState.UNKNOWN

Example

import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';

FlutterACPIdentity.syncIdentifier("identifierType", "identifier", ACPMobileVisitorAuthenticationState.AUTHENTICATED);

{% endtab %}

{% tab title="Cordova" %}

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 identifier (String) contains the identifier value, and this parameter should not be null or empty.

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

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

    • ACPIdentity.ACPMobileVisitorAuthenticationStateAuthenticated
    • ACPIdentity.ACPMobileVisitorAuthenticationStateLoggedOut
    • ACPIdentity.ACPMobileVisitorAuthenticationStateUnknown
  • 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" %}

C#

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 identifier (String) contains the identifier value, and this parameter should not be null or empty.

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

  • authState value indicating authentication state for the user and contains one of the following ACPAuthenticationState values:

    • ACPIdentity.ACPAuthenticationState.AUTHENTICATED
    • ACPIdentity.ACPAuthenticationState.UNKNOWN
    • ACPIdentity.ACPAuthenticationState.LOGGED_OUT

Example

ACPIdentity.SyncIdentifier("idType1", "idValue1", ACPIdentity.ACPAuthenticationState.AUTHENTICATED);

{% endtab %}

{% tab title="Xamarin" %}

C#

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 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 value indicating authentication state for the user and contains one of the following ACPMobileVisitorAuthenticationState values:

    • ACPMobileVisitorAuthenticationState.Authenticated
    • ACPMobileVisitorAuthenticationState.Unknown
    • ACPMobileVisitorAuthenticationState.LoggedOut

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 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 value indicating authentication state for the user and contains one of the following VisitorID.AuthenticationState values:

    • VisitorID.AuthenticationState.Authenticated
    • VisitorID.AuthenticationState.Unknown
    • VisitorID.AuthenticationState.LoggedOut

iOS Example

ACPIdentity.SyncIdentifier("idType1", "idValue1", ACPMobileVisitorAuthenticationState.Authenticated);

Android Example

ACPIdentity.SyncIdentifier("idType1", "idValue1", VisitorID.AuthenticationState.Authenticated);

{% endtab %} {% endtabs %}

syncIdentifiers

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

{% tabs %} {% tab title="Android" %}

Java

Syntax

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

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

Example

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

{% endtab %}

{% tab title="iOS" %}

iOS

Syntax

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

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

Examples

Objective-C

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

Swift

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

{% endtab %}

{% tab title="React Native" %}

JavaScript

Syntax

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

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

Example

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

{% endtab %}

{% tab title="Flutter" %}

Dart

Syntax

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

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

Example

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

{% endtab %}

{% tab title="Cordova" %}

Cordova

Syntax

ACPIdentity.syncIdentifiers = function(identifiers, success, fail);
  • 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.

  • 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" %}

C#

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

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" %}

C#

iOS Syntax

public static void SyncIdentifiers (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.

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

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 %}

syncIdentifiers (overloaded)

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

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

{% tabs %} {% tab title="Android" %}

Java

Syntax

public static void syncIdentifiers(final Map<String, String> identifiers, final VisitorID.AuthenticationState authState)
  • identifiers ia a map that contains IDs with the identifier type as the key, and the string identifier as the value.
  • authState indicates the authentication state for the user, which contains one of the following VisitorID.AuthenticationState values:
    • VisitorID.AuthenticationState.AUTHENTICATED
    • VisitorID.AuthenticationState.LOGGED_OUT
    • VisitorID.AuthenticationState.UNKNOWN

Example

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

{% endtab %}

{% tab title="iOS" %}

iOS

Syntax

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

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

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

    • ACPMobileVisitorAuthenticationState.AUTHENTICATED
    • ACPMobileVisitorAuthenticationState.LOGGED_OUT
    • ACPMobileVisitorAuthenticationState.UNKNOWN

Examples

Objective-C

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

Swift

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

{% endtab %}

{% tab title="React Native" %}

JavaScript

Syntax

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

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

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

    • ACPMobileVisitorAuthenticationState.AUTHENTICATED
    • ACPMobileVisitorAuthenticationState.LOGGED_OUT
    • ACPMobileVisitorAuthenticationState.UNKNOWN

Example

import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';

ACPIdentity.syncIdentifiersWithAuthState({"id1": "identifier1"}, ACPMobileVisitorAuthenticationState.UNKNOWN);

{% endtab %}

{% tab title="Flutter" %}

Dart

Syntax

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

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

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

    • ACPMobileVisitorAuthenticationState.AUTHENTICATED
    • ACPMobileVisitorAuthenticationState.LOGGED_OUT
    • ACPMobileVisitorAuthenticationState.UNKNOWN

Example

import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';

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

{% endtab %}

{% tab title="Cordova" %}

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

  • authState value indicating authentication state for the identifiers to be synced and contains one of the ACPMobileVisitorAuthenticationState values:

    • ACPIdentity.ACPMobileVisitorAuthenticationStateAuthenticated
    • ACPIdentity.ACPMobileVisitorAuthenticationStateLoggedOut
    • ACPIdentity.ACPMobileVisitorAuthenticationStateUnknown
  • 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" %}

C#

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

  • authenticationState value indicating authentication state for the identifiers to be synced and contains one of the VisitorID.AuthenticationState values:

    • VisitorID.AuthenticationState.AUTHENTICATED
    • VisitorID.AuthenticationState.LOGGED_OUT
    • VisitorID.AuthenticationState.UNKNOWN

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" %}

C#

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

  • authenticationState value indicating authentication state for the user and contains one of the following ACPMobileVisitorAuthenticationState values:

    • ACPMobileVisitorAuthenticationState.Authenticated
    • ACPMobileVisitorAuthenticationState.Unknown
    • ACPMobileVisitorAuthenticationState.LoggedOut

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

  • authenticationState value indicating authentication state for the user and contains one of the following VisitorID.AuthenticationState values:

    • VisitorID.AuthenticationState.Authenticated
    • VisitorID.AuthenticationState.Unknown
    • VisitorID.AuthenticationState.LoggedOut

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 %}

Public classes

{% 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 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();

}

{% endtab %}

{% tab title="iOS" %}

iOS

ACPMobileVisitorAuthenticationState

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

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

ACPMobileVisitorId

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

@interface ACPMobileVisitorId : NSObject

@property(nonatomic, strong, nullable) NSString* idOrigin;
@property(nonatomic, strong, nullable) NSString* idType;
@property(nonatomic, strong, nullable) NSString* identifier;
@property(nonatomic, readwrite) ACPMobileVisitorAuthenticationState authenticationState;

@end

{% endtab %}

{% tab title="React Native" %}

JavaScript

ACPVisitorID

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

import {ACPVisitorID} from '@adobe/react-native-acpcore';

var visitorId = new ACPVisitorID(idOrigin?: string, idType: string, id?: string, authenticationState?: ACPMobileVisitorAuthenticationState);

ACPMobileVisitorAuthenticationState

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

import {ACPMobileVisitorAuthenticationState} from '@adobe/react-native-acpcore';

var state = ACPMobileVisitorAuthenticationState.AUTHENTICATED;
//var state = ACPMobileVisitorAuthenticationState.LOGGED_OUT;
//var state = ACPMobileVisitorAuthenticationState.UNKNOWN;

{% endtab %}

{% tab title="Flutter" %}

Dart

ACPVisitorID

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

import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';


class ACPMobileVisitorId {
  String get idOrigin;
  String get idType;
  String get identifier;
  ACPMobileVisitorAuthenticationState get authenticationState;
};

ACPMobileVisitorAuthenticationState

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

import 'package:flutter_acpcore/src/acpmobile_visitor_id.dart';

enum ACPMobileVisitorAuthenticationState {UNKNOWN, AUTHENTICATED, LOGGED_OUT};

{% endtab %}

{% tab title="Cordova" %}

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" %}

C#

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" %}

C#

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 %}