Adobe Audience Manager API reference
extensionVersion
The extensionVersion()
API returns the version of the Audience extension that is registered with the Mobile Core extension.
To get the version of the Audience extension, use the following code sample:
Swift
Syntax
Copied to your clipboardstatic var extensionVersion: String
Example
Copied to your clipboardlet audienceExtensionVersion = Audience.extensionVersion()
Objective-C
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion;
Example
Copied to your clipboardNSString *audienceExtensionVersion = [AEPMobileAudience extensionVersion];
Java
Syntax
Copied to your clipboardpublic static String extensionVersion()
Example
Copied to your clipboardString audienceExtensionVersion = Audience.extensionVersion();
Kotlin
Example
Copied to your clipboardval extensionVersion = Audience.extensionVersion();
Swift
Syntax
Copied to your clipboardstatic var extensionVersion: String
Example
Copied to your clipboardlet audienceExtensionVersion = Audience.extensionVersion()
Objective-C
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion;
Example
Copied to your clipboardNSString *audienceExtensionVersion = [AEPMobileAudience extensionVersion];
getVisitorProfile
This API returns the most recently obtained visitor profile. The visitor profile is saved in the SDK's local storage for access across multiple launches of your app. If no audience signal has been sent before, when this API is called, a null value is returned.
This API returns the most recently obtained visitor profile. For easy access across multiple launches of your app, the visitor profile is saved in SharedPreferences
. If no signal has been submitted, null is returned.
When an AdobeCallbackWithError is provided, an AdobeError can be returned in the eventuality of an unexpected error or if the default timeout (5000ms) is met before the callback is returned with the visitor profile.
Java
Syntax
Copied to your clipboardpublic static void getVisitorProfile(final AdobeCallback<Map<String, String>> adobeCallback)
Example
Copied to your clipboardAdobeCallback<Map<String, String>> visitorProfileCallback = new AdobeCallback<Map<String, String>>() {@Overridepublic void call(final Map<String, String> visitorProfile) {// your own customized code}};Audience.getVisitorProfile(visitorProfileCallback);
Kotlin
Example
Copied to your clipboardAudience.getVisitorProfile { visitorProfile ->// provide code to process the visitorProfile}
This API returns the most recently obtained visitor profile.
Swift
Syntax
Copied to your clipboardstatic func getVisitorProfile(completion: @escaping ([String: String]?, Error?) -> Void)
Example
Copied to your clipboardAudience.getVisitorProfile { (visitorProfile, error) inif error != nil {// handle the error here} else {// handle the retrieved visitorProfile here}}
Objective-C
Syntax
Copied to your clipboard+ (void) getVisitorProfile:^(NSDictionary<NSString *,NSString *> * _Nullable, NSError * _Nullable)completion
Example
Copied to your clipboard[AEPMobileAudience getVisitorProfile:^(NSDictionary<NSString *,NSString *> * _Nullable visitorProfile, NSError * _Nullable error) {if (error) {// handle the error here} else {// handle the returned visitorProfile dictionary here}}];
This API returns the most recently obtained visitor profile. For easy access across multiple launches of your app, the visitor profile is saved in SharedPreferences
. If no signal has been submitted, null is returned.
When an AdobeCallbackWithError is provided, an AdobeError can be returned in the eventuality of an unexpected error or if the default timeout (5000ms) is met before the callback is returned with the visitor profile.
Java
Syntax
Copied to your clipboardpublic static void getVisitorProfile(final AdobeCallback<Map<String, String>> adobeCallback)
Example
Copied to your clipboardAdobeCallback<Map<String, String>> visitorProfileCallback = new AdobeCallback<Map<String, String>>() {@Overridepublic void call(final Map<String, String> visitorProfile) {// your own customized code}};Audience.getVisitorProfile(visitorProfileCallback);
Kotlin
Example
Copied to your clipboardAudience.getVisitorProfile { visitorProfile ->// provide code to process the visitorProfile}
This API returns the most recently obtained visitor profile.
Swift
Syntax
Copied to your clipboardstatic func getVisitorProfile(completion: @escaping ([String: String]?, Error?) -> Void)
Example
Copied to your clipboardAudience.getVisitorProfile { (visitorProfile, error) inif error != nil {// handle the error here} else {// handle the retrieved visitorProfile here}}
Objective-C
Syntax
Copied to your clipboard+ (void) getVisitorProfile:^(NSDictionary<NSString *,NSString *> * _Nullable, NSError * _Nullable)completion
Example
Copied to your clipboard[AEPMobileAudience getVisitorProfile:^(NSDictionary<NSString *,NSString *> * _Nullable visitorProfile, NSError * _Nullable error) {if (error) {// handle the error here} else {// handle the returned visitorProfile dictionary here}}];
registerExtension
This API has been deprecated starting in v2.0.0 and removed in v3.0.0 of the Android mobile extension.
Use MobileCore.registerExtensions()
API instead.
Registers the Audience Manager extension with the Mobile Core SDK.
reset
This API helps you reset the Audience Manager UUID and purges the current visitor profile.
For more information about the UUID, the DPID, the DPUUID and other Audience Manager identifiers, see Index of IDs in Audience Manager.
This API resets the Audience Manager UUID and purges the current visitor profile from android.content.SharedPreferences
. The Audience reset also clears the current in-memory DPID and DPUUID variables.
Java
Syntax
Copied to your clipboardpublic static void reset()
Example
Copied to your clipboardAudience.reset();
Kotlin
Example
Copied to your clipboardAudience.reset()
This API resets the Audience Manager UUID and purges the current visitor profile from UserDefaults
. The Audience reset also clears the current in-memory DPID and DPUUID variables.
Swift
Syntax
Copied to your clipboardstatic func reset()
Example
Copied to your clipboardAudience.reset()
Objective-C
Syntax
Copied to your clipboard+ (void) reset
Example
Copied to your clipboard[AEPMobileAudience reset];
This API resets the Audience Manager UUID and purges the current visitor profile from android.content.SharedPreferences
. The Audience reset also clears the current in-memory DPID and DPUUID variables.
Java
Syntax
Copied to your clipboardpublic static void reset()
Example
Copied to your clipboardAudience.reset();
Kotlin
Example
Copied to your clipboardAudience.reset()
This API resets the Audience Manager UUID and purges the current visitor profile from UserDefaults
. The Audience reset also clears the current in-memory DPID and DPUUID variables.
Swift
Syntax
Copied to your clipboardstatic func reset()
Example
Copied to your clipboardAudience.reset()
Objective-C
Syntax
Copied to your clipboard+ (void) reset
Example
Copied to your clipboard[AEPMobileAudience reset];
signalWithData
This method is used to send a signal with traits to Audience Manager and get the matching segments returned in a block callback. Audience Manager sends the UUID in response to an initial signal call. The UUID is persisted on local SDK storage and is sent by the SDK to Audience Manager in all subsequent signal requests.
If you are using the Experience Cloud ID (ECID) Service (formerly MCID), the ECID and other custom identifiers for the same visitor are sent with each signal request. The visitor profile that is returned by Audience Manager is saved in SDK local storage and is updated with subsequent signal calls.
For more information about the UUID and other Audience Manager identifiers, see the index of IDs in Audience Manager.
The signalWithData
API sends Audience Manager a signal with traits and returns the matching segments for the visitor in a callback.
Audience Manager sends the AAM UUID in response in initial signal call. The AAM UUID is persisted in SharedPreferences
and is sent by the SDK in all subsequent signal requests. If available, the ECID is also sent in each signal request with the DPID and the DPUUID. The visitor profile that Audience Manager returns is saved in SharedPreferences
and is updated with every signal call.
When an AdobeCallbackWithError
is provided, an AdobeError
can be returned in the eventuality of an unexpected error or if the default timeout (5000ms) is met before the callback is returned with the visitor profile.
Java
Syntax
Copied to your clipboardpublic static void signalWithData(final Map<String, String> data, final AdobeCallback<Map<String, String>> callback)
data
is the traits data for the current visitor.callback
is the void method that is invoked with the visitor's profile as a parameter.
Example
Copied to your clipboardAdobeCallback<Map<String, String>> visitorProfileCallback = new AdobeCallback<Map<String, String>>() {@Overridepublic void call(final Map<String, String> visitorProfile) {// handle the returned visitorProfile here}};Map<String, String> traits = new HashMap<String, String>();traits.put("trait", "xyz");Audience.signalWithData(traits, visitorProfileCallback);
Kotlin
Example
Copied to your clipboardval traits: Map<String, String?> = mapOf("trait1" to "value1","trait2" to "value2")Audience.signalWithData(traits) { visitorProfile ->// handle the returned visitorProfile}
The signalWithData
API sends Audience Manager a signal with traits and returns the matching segments for the visitor in a closure.
Audience Manager sends the AAM UUID in response in initial signal call. The AAM UUID is persisted in NSUserDefaults
and is sent by the SDK in all subsequent signal requests. If available, the Experience Cloud ID (MID) is also sent in each signal request with the DPID and the DPUUID. The visitor profile that Audience Manager returns is saved in NSUserDefaults
and is updated with every signal call.
Swift
Syntax
Copied to your clipboardstatic func signalWithData(data: [String: String], completion: @escaping ([String: String]?, Error?) -> Void)
data
is the traits data for the current visitor.callback
is the void method that is invoked with the visitor's profile as a parameter.
Example
Copied to your clipboardAudience.signalWithData(data: ["trait": "trait value"]) { (traits, error) inif error != nil {// handle the error here} else {// handle the returned visitorProfile here}}
Objective-C
Syntax
Copied to your clipboard+ (void) signalWithData:(NSDictionary<NSString *,NSString *> * _Nonnull) completion:^(NSDictionary<NSString *,NSString *> * _Nullable, NSError * _Nullable)completion
Example
Copied to your clipboardNSDictionary *traits = @{@"key1":@"value1",@"key2":@"value2"};[AEPMobileAudience signalWithData:traits completion:^(NSDictionary<NSString *,NSString *> * _Nullable visitorProfile, NSError* _Nullable error) {if (error) {// handle the error here} else {// handle the returned visitorProfile dictionary here}}];
The signalWithData
API sends Audience Manager a signal with traits and returns the matching segments for the visitor in a callback.
Audience Manager sends the AAM UUID in response in initial signal call. The AAM UUID is persisted in SharedPreferences
and is sent by the SDK in all subsequent signal requests. If available, the ECID is also sent in each signal request with the DPID and the DPUUID. The visitor profile that Audience Manager returns is saved in SharedPreferences
and is updated with every signal call.
When an AdobeCallbackWithError
is provided, an AdobeError
can be returned in the eventuality of an unexpected error or if the default timeout (5000ms) is met before the callback is returned with the visitor profile.
Java
Syntax
Copied to your clipboardpublic static void signalWithData(final Map<String, String> data, final AdobeCallback<Map<String, String>> callback)
data
is the traits data for the current visitor.callback
is the void method that is invoked with the visitor's profile as a parameter.
Example
Copied to your clipboardAdobeCallback<Map<String, String>> visitorProfileCallback = new AdobeCallback<Map<String, String>>() {@Overridepublic void call(final Map<String, String> visitorProfile) {// handle the returned visitorProfile here}};Map<String, String> traits = new HashMap<String, String>();traits.put("trait", "xyz");Audience.signalWithData(traits, visitorProfileCallback);
Kotlin
Example
Copied to your clipboardval traits: Map<String, String?> = mapOf("trait1" to "value1","trait2" to "value2")Audience.signalWithData(traits) { visitorProfile ->// handle the returned visitorProfile}
The signalWithData
API sends Audience Manager a signal with traits and returns the matching segments for the visitor in a closure.
Audience Manager sends the AAM UUID in response in initial signal call. The AAM UUID is persisted in NSUserDefaults
and is sent by the SDK in all subsequent signal requests. If available, the Experience Cloud ID (MID) is also sent in each signal request with the DPID and the DPUUID. The visitor profile that Audience Manager returns is saved in NSUserDefaults
and is updated with every signal call.
Swift
Syntax
Copied to your clipboardstatic func signalWithData(data: [String: String], completion: @escaping ([String: String]?, Error?) -> Void)
data
is the traits data for the current visitor.callback
is the void method that is invoked with the visitor's profile as a parameter.
Example
Copied to your clipboardAudience.signalWithData(data: ["trait": "trait value"]) { (traits, error) inif error != nil {// handle the error here} else {// handle the returned visitorProfile here}}
Objective-C
Syntax
Copied to your clipboard+ (void) signalWithData:(NSDictionary<NSString *,NSString *> * _Nonnull) completion:^(NSDictionary<NSString *,NSString *> * _Nullable, NSError * _Nullable)completion
Example
Copied to your clipboardNSDictionary *traits = @{@"key1":@"value1",@"key2":@"value2"};[AEPMobileAudience signalWithData:traits completion:^(NSDictionary<NSString *,NSString *> * _Nullable visitorProfile, NSError* _Nullable error) {if (error) {// handle the error here} else {// handle the returned visitorProfile dictionary here}}];