Java
Example
Copied to your clipboardString audienceExtensionVersion = Audience.extensionVersion();
Swift
Syntax
Copied to your clipboard+ (nonnull NSString*) extensionVersion;
Example
Copied to your clipboardlet audienceExtensionVersion = ACPAudience.extensionVersion()
Objective-C
Syntax
Copied to your clipboardadd
Example
Copied to your clipboardNSString *audienceExtensionVersion = [ACPAudience extensionVersion];
JavaScript
Example
Copied to your clipboardACPAudience.extensionVersion().then(audienceExtensionVersion => console.log("AdobeExperienceSDK: ACPAudience version: " + audienceExtensionVersion));
Dart
Example
Copied to your clipboardString audienceExtensionVersion = await FlutterACPAudience.extensionVersion;
Cordova
Example
Copied to your clipboardACPAudience.extensionVersion(function(version) {console.log("ACPAudience version: " + version);}, function(error) {console.log(error);});
C#
Example
Copied to your clipboardstring audienceExtensionVersion = ACPAudience.ExtensionVersion();
C#
Example
Copied to your clipboardstring audienceExtensionVersion = ACPAudience.ExtensionVersion();
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);
The getVisitorProfile
API returns the most recently obtained visitor profile. For easy access across multiple launches of your app, the visitor profile is saved in NSUserDefaults
. If no signal has been submitted, nil is returned.
The getVisitorProfileWithCompletionHandler
method was added in ACPAudience version 2.1.0.
Swift
Syntax
Copied to your clipboardstatic func getVisitorProfile(_ callback: @escaping ([AnyHashable : Any]?) -> Void)static func getVisitorProfile(completionHandler: @escaping ([AnyHashable : Any]?, Error?) -> Void)
Example
Copied to your clipboardACPAudience.getVisitorProfile { (visitorProfile) in// handle the visitorProfile here}ACPAudience.getVisitorProfile { (visitorProfile, error) inif let error = error {// handle error here} else {// handle the returned visitorProfile here}}
Objective-C
Syntax
Copied to your clipboard+ (void) getVisitorProfile: (nonnull void (^) (NSDictionary* __nullable visitorProfile)) callback;+ (void) getVisitorProfileWithCompletionHandler: (nonnull void (^) (NSDictionary* __nullable visitorProfile, NSError* __nullable error)) completionHandler;
Example
Copied to your clipboard[ACPAudience getVisitorProfile:^(NSDictionary* visitorProfile){// handle the visitorProfile here}];[ACPAudience getVisitorProfileWithCompletionHandler:^(NSDictionary * _Nullable visitorProfile, NSError * _Nullable error) {if (error) {// handle error here} else {// handle the returned visitorProfile here}}];
JavaScript
Example
Copied to your clipboardACPAudience.getVisitorProfile().then(profile => console.log("AdobeExperienceSDK: Visitor Profile: " + profile));
Java
Syntax
Copied to your clipboardpublic static void registerExtension() throws InvalidInitException
Example
Copied to your clipboardAudience.registerExtension();
Swift
Syntax
Copied to your clipboardstatic func registerExtension()
Example
Copied to your clipboardACPAudience.registerExtension()
Objective-C
Syntax
Copied to your clipboard+ (BOOL) registerExtension: (nonnull Class) extensionClasserror: (NSError* _Nullable* _Nullable) error;
Example
Copied to your clipboard[ACPAudience registerExtension];
JavaScript
Example
Copied to your clipboardACPAudience.registerExtension();
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();
The reset
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 clipboardACPAudience.reset()
Objective-C
Syntax
Copied to your clipboard+ (void) reset;
Example
Copied to your clipboard[ACPAudience reset];
JavaScript
Example
Copied to your clipboardACPAudience.reset();
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);
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 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.
Please note that the signalWithData:withCompletionHandler
method was added in ACPAudience version 2.1.0.
Swift
Syntax
Copied to your clipboardstatic func signal(withData data: [String : String]?, callback: (([AnyHashable : Any]?) -> Void)? = nil)static func signal(withData data: [String : String], withCompletionHandler completionHandler: @escaping ([AnyHashable : Any]?, Error?) -> Void)
Example
Copied to your clipboardACPAudience.signal(withData: ["key1": "value1", "key2": "value2"], callback: { (visitorProfile) in// handle the visitorProfile here})ACPAudience.signal(withData: ["key1": "value1", "key2": "value2"], withCompletionHandler: { (visitorProfile, error) inif let error = error {// handle error} else {// handle the returned visitorProfile here}})
Objective-C
Syntax
Copied to your clipboard+ (void) signalWithData: (NSDictionary<NSString*, NSString*>* __nullable) datacallback: (nullable void (^) (NSDictionary* __nullable visitorProfile)) callback;+ (void) signalWithData: (NSDictionary<NSString*, NSString*>* __nullable) datawithCompletionHandler:: (nullable void (^) (NSDictionary* __nullable visitorProfile, NSError* __nullable error)) completionHandler;
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 clipboardNSDictionary *traits = @{@"key1":@"value1",@"key2":@"value2"};[ACPAudience signalWithData:traits callback:^(NSDictionary* _Nullable visitorProfile){// handle the returned visitorProfile dictionary here}];[ACPAudience signalWithData:traits withCompletionHandler:^(NSDictionary * _Nullable visitorProfile, NSError * _Nullable error) {if (error) {// handle the error here} else {// handle the returned visitorProfile dictionary here}}];
JavaScript
Example
Copied to your clipboardACPAudience.signalWithData({"yourDataKey": "yourDataValue"}).then(profile => console.log("AdobeExperienceSDK: Visitor Profile: " + profile));