Links

Analytics API reference

clearQueue

Force delete, without sending to Analytics, all hits being stored or batched on the SDK.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Flutter
Cordova
Unity
Xamarin
Use caution when manually clearing the queue. This operation cannot be reverted.

Java

Syntax
public static void clearQueue()
Example
Analytics.clearQueue();
Use caution when manually clearing the queue. This operation cannot be reverted.

Swift

Syntax
static func clearQueue()
Example
Analytics.clearQueue()

Objective-C

Syntax
+ (void) clearQueue
Example
[AEPMobileAnalytics clearQueue];
Use caution when manually clearing the queue. This operation cannot be reverted.

Swift

Syntax
static func clearQueue()
Example
ACPAnalytics.clearQueue()

Objective-C

Syntax
+ (void) clearQueue;
Example
[ACPAnalytics clearQueue];
Use caution when manually clearing the queue. This operation cannot be reverted.

JavaScript

Syntax
clearQueue();
Example
ACPAnalytics.clearQueue();
Use caution when manually clearing the queue. This operation cannot be reverted.

Dart

Syntax
Future<void> clearQueue();
Example
FlutterACPAnalytics.clearQueue();
Use caution when manually clearing the queue. This operation cannot be reverted.

Cordova

Syntax
ACPAnalytics.clearQueue = function(success, fail);
  • success is a callback containing a general success message if the clearQueue API executed without any errors.
  • fail is a callback containing error information if the clearQueue API was executed with errors.
Example
ACPAnalytics.clearQueue(function (handleCallback) {
console.log("AdobeExperienceSDK: Clear queued hits successful. " + handleCallback);
} ,function (handleError) {
console.log("AdobeExperenceSDK: Failed to clear queued hits: " + handleError);
});
Use caution when manually clearing the queue. This operation cannot be reverted.

C#

Syntax
public static void ClearQueue()
Example
ACPAnalytics.ClearQueue();
Use caution when manually clearing the queue. This operation cannot be reverted.

C#

Syntax
public static void ClearQueue ();
Example
ACPAnalytics.ClearQueue();

extensionVersion

The extensionVersion() API returns the version of the Analytics extension that is registered with the Mobile Core extension.
To get the version of the Analytics extension, use the following code sample:
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Flutter
Cordova
Unity
Xamarin

Java

String analyticsExtensionVersion = Analytics.extensionVersion();

Swift

Syntax
static var extensionVersion: String
Examples
let version = Analytics.extensionVersion

Objective-C

Syntax
+ (nonnull NSString*) extensionVersion;
Examples
NSString *version = [AEPMobileAnalytics extensionVersion];

Swift

Syntax
static func extensionVersion()
Examples
let analyticsExtensionVersion = ACPAnalytics.extensionVersion()

Objective-C

Syntax
+ (nonnull NSString*) extensionVersion;
Examples
NSString *analyticsExtensionVersion = [ACPAnalytics extensionVersion];

JavaScript

ACPAnalytics.extensionVersion().then(analyticsExtensionVersion => console.log("AdobeExperienceSDK: ACPAnalytics version: " + analyticsExtensionVersion));

Dart

String analyticsExtensionVersion = await FlutterACPAnalytics.extensionVersion;

Cordova

ACPAnalytics.extensionVersion(function(version) {
console.log("ACPAnalytics version: " + version);
}, function(error) {
console.log(error);
});

C#

string analyticsExtensionVersion = ACPAnalytics.ExtensionVersion();

C#

string analyticsExtensionVersion = ACPAnalytics.ExtensionVersion();

getQueueSize

Retrieves the total number of Analytics hits in the tracking queue.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Flutter
Cordova
Unity
Xamarin

Java

Syntax
public static void getQueueSize(final AdobeCallback<Long> callback)
  • callback is invoked with the queue size value. 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 queue size.
Example
Analytics.getQueueSize(new AdobeCallback<Long>() {
@Override
public void call(final Long queueSize) {
// handle the queueSize
}
});
Please use the getQueueSizeWithCompletionHandler API instead.

Swift

Syntax
static func getQueueSize(_ callback: @escaping (UInt) -> Void)
Example
ACPAnalytics.getQueueSize { (queueSize) in
// handle queue size
}

Objective-C

Syntax
+ (void) getQueueSize: (nonnull void (^) (NSUInteger queueSize)) callback;
  • callback is invoked with the queue size value.
Example
[ACPAnalytics getQueueSize: ^(NSUInteger queueSize) {
// handle queue size
}];

JavaScript

Syntax
getQueueSize(): Promise<?integer>;
Example
ACPAnalytics.getQueueSize().then(size => console.log("AdobeExperienceSDK: Queue size: " + size));

Dart

Syntax
Future<int> getQueueSize;
Example
int queueSize;
try {
queueSize = await FlutterACPAnalytics.queueSize;
} on PlatformException {
log("Failed to get the queue size");
}

Cordova

Syntax
ACPAnalytics.getQueueSize = function(success, fail);
  • success is a callback containing the queue size if the getQueueSize API executed without any errors.
  • fail is a callback containing error information if the getQueueSize API was executed with errors.
Example
ACPAnalytics.getQueueSize(function (handleCallback) {
console.log("AdobeExperienceSDK: Queue size: " + handleCallback);
} ,function (handleError) {
console.log("AdobeExperenceSDK: Failed to get queue size: " + handleError);
});

C#

Syntax
public static void GetQueueSize(AdobeGetQueueSizeCallback callback)
  • callback is a callback containing the queue size if the GetQueueSize API executed without any errors.
Example
[MonoPInvokeCallback(typeof(AdobeGetQueueSizeCallback))]
public static void HandleAdobeGetQueueSizeCallback(long queueSize)
{
Debug.Log("Queue size is : " + queueSize);
}
ACPAnalytics.GetQueueSize(HandleAdobeGetQueueSizeCallback);

C#

Syntax
public unsafe static void GetQueueSize (Action<nuint> callback);
  • callback is a callback containing the queue size if the GetQueueSize API executed without any errors.
example
ACPAnalytics.GetQueueSize(callback => {
Console.WriteLine("Queue size: " + callback);
});

Android

Syntax
public unsafe static void GetQueueSize (IAdobeCallback callback);
  • callback is a callback containing the queue size if the GetQueueSize API executed without any errors.
example
ACPAnalytics.GetQueueSize(new StringCallback());
class StringCallback : Java.Lang.Object, IAdobeCallback
{
public void Call(Java.Lang.Object stringContent)
{
if (stringContent != null)
{
Console.WriteLine("Queue size: " + stringContent);
}
else
{
Console.WriteLine("null content in string callback");
}
}
}

getQueueSizeWithCompletionHandler

Retrieves the total number of Analytics hits in the tracking queue. Invoke the callback with NSError if an unexpected error occurs or the request times out.
iOS (AEP 3.x)
iOS (ACP 2.x)

Swift

Syntax
static func getQueueSize(completion: @escaping (Int, Error?) -> Void)
Example
Analytics.getQueueSize { (queueSize, error) in
// Handle error (if non-nil) or use queueSize.
}

Objective-C

Syntax
+ (void)getQueueSize:^(NSInteger, NSError * _Nullable)completion
Example
[AEPMobileAnalytics getQueueSize:^(NSInteger queueSize, NSError * _Nullable error) {
// Handle error (if non-nil) or use queueSize.
}];

Swift

Syntax
static func getQueueSize(completionHandler: @escaping (UInt, Error?) -> Void)
Example
ACPAnalytics.getQueueSizeWithCompletionHandler { (queueSize, error) in
// Handle error (if non-nil) or use queueSize.
}

Objective-C

Syntax
+ (void) getQueueSizeWithCompletionHandler: (nonnull void (^) (NSUInteger queueSize, NSError* __nullable error)) completionHandler;
  • completionHandler is invoked with the queue size value or an NSError if an unexpected error occurs or the request times out.
Example
[ACPAnalytics getQueueSizeWithCompletionHandler: ^(NSUInteger queueSize, NSError * _Nullable error) {
// Handle error (if non-nil) or use queueSize.
}];

getTrackingIdentifier

Retrieves the Analytics tracking identifier that is generated for this app/device instance. This identifier is an app-specific, unique visitor ID that is generated at the initial launch and is stored and used after the initial launch. The ID is preserved between app upgrades and is removed when the app is uninstalled as well as on MobileCore.resetIdentities API call or on privacy status opt out.
Starting with v1.2.9 (Android) / v3.0.3(iOS AEPAnalytics) / v2.5.1 (iOS ACPAnalytics) this API does not generate or retrieve a new tracking identifier (AID) for new visitors. For the visitors which have an AID previously generated will continue retrieve the AID value with this API, and new users will use the ECID (MID) value as the primary identity. Before using this API, see the documentation on identifying unique visitors.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Flutter
Cordova
Unity
Xamarin

Java

Retrieves the Analytics tracking identifier.
Syntax
public static void
getTrackingIdentifier(final AdobeCallback<String> callback)
  • callback is invoked with the tracking Identifier string value. 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 analytics tracking identifier.
Example
Analytics.getTrackingIdentifier(new AdobeCallback<String>() {
@Override
public void call(final String trackingIdentifier) {
// check the trackingIdentifier value
}
});
Retrieves the Analytics tracking identifier. See getTrackingIdentifierWithCompletionHandler
Retrieves the Analytics tracking identifier.

Swift

Syntax
static func getTrackingIdentifier(_ callback: @escaping (String?) -> Void)
Example
ACPAnalytics.getTrackingIdentifier { (trackingIdentifier) in
// check the trackingIdentifier value
}

Objective-C

Syntax
+ (void) getTrackingIdentifier: (nonnull void (^) (NSString* __nullable trackingIdentifier)) callback;
  • callback is invoked with the tracking Identifier string value.
Example
[ACPAnalytics getTrackingIdentifier:^(NSString * _Nullable trackingIdentifier) {
// check the trackingIdentifier value
}];

JavaScript

Retrieves the Analytics tracking identifier.
Syntax
getTrackingIdentifier();
  • callback is invoked with the tracking Identifier string value.
Example
ACPAnalytics.getTrackingIdentifier().then(identifier => console.log("AdobeExperienceSDK: Tracking identifier: " + identifier));

Dart

Retrieves the Analytics tracking identifier.
Syntax
Future<String> getTrackingIdentifier;
Example
String trackingId;
try {
trackingId = await FlutterACPAnalytics.trackingIdentifier;
} on PlatformException {
log("Failed to get the tracking identifier");
}

Cordova

Retrieves the Analytics tracking identifier.
ACPAnalytics.getTrackingIdentifier = function(success, fail);
  • success is a callback containing the tracking Identifier string value.
  • fail is a callback containing error information if the getTrackingIdentifier API was executed with errors.
Example
ACPAnalytics.getTrackingIdentifier(function (handleCallback) {
console.log("AdobeExperienceSDK: Retrieved tracking identifier: " + handleCallback);
} ,function (handleError) {
console.log("AdobeExperenceSDK: Failed to retrieve tracking identifier: " + handleError);
});

C#

Retrieves the Analytics tracking identifier.
public static void GetTrackingIdentifier(AdobeGetTrackingIdentifierCallback callback)
  • callback is a callback containing the tracking Identifier string value.
Example
[MonoPInvokeCallback(typeof(AdobeGetTrackingIdentifierCallback))]
public static void HandleAdobeGetTrackingIdentifierCallback(string trackingIdentifier)
{
Debug.Log("Tracking identifier is : " + trackingIdentifier);
}
ACPAnalytics.GetTrackingIdentifier(HandleAdobeGetTrackingIdentifierCallback);

C#

Retrieves the Analytics tracking identifier.
Syntax
public unsafe static void GetTrackingIdentifier (Action<NSString> callback);
  • callback is a callback containing the tracking Identifier string value.
example
ACPAnalytics.GetTrackingIdentifier(callback => {
Console.WriteLine("Tracking identifier: " + callback);
});

Android

Syntax
public unsafe static void GetTrackingIdentifier (IAdobeCallback callback);
  • callback is a callback containing the tracking Identifier string value.
example
ACPAnalytics.GetTrackingIdentifier(new StringCallback());
class StringCallback : Java.Lang.Object, IAdobeCallback
{
public void Call(Java.Lang.Object stringContent)
{
if (stringContent != null)
{
Console.WriteLine("Tracking identifier: " + stringContent);
}
else
{
Console.WriteLine("null content in string callback");
}
}
}

getTrackingIdentifierWithCompletionHandler

Starting with v1.2.9 (Android) / v3.0.3(iOS AEPAnalytics) / v2.5.1 (iOS ACPAnalytics) this API does not generate or retrieve a new tracking identifier (AID) for new visitors. For the visitors which have an AID previously generated will continue retrieve the AID value with this API, and new users will use the ECID (MID) value as the primary identity. Before you use this API, please read the documentation on identifying unique visitors.
Retrieves the Analytics tracking identifier that is generated for this app/device instance. This identifier is an app-specific, unique visitor ID that is generated at the initial launch and is stored and used after the initial launch. The ID is preserved between app upgrades and is removed when the app is uninstalled as well as on MobileCore.resetIdentities API call or on privacy status opt out. Invoke the callback with NSError if an unexpected error occurs or the request times out.
If you have an Experience Cloud ID and have not yet configured a visitor ID grace period, the value returned by getTrackingIdentifier might be null.
iOS (AEP 3.x)
iOS (ACP 2.x)
Retrieves the Analytics tracking identifier.

Swift

Syntax
static func getTrackingIdentifier(completion: @escaping (String?, Error?) -> Void)
Example
Analytics.getTrackingIdentifier { (trackingId, error) in
// Handle the error (if non-nil) or use the trackingIdentifier value
}

Objective-C

Syntax
+ (void) getTrackingIdentifier:^(NSString * _Nullable, NSError * _Nullable)completion
Example
AEPMobileAnalytics getTrackingIdentifier:^(NSString * _Nullable trackingIdentifier, NSError * _Nullable error) {
// Handle the error (if non-nil) or use the trackingIdentifier value
}];

Swift

Syntax
static func getTrackingIdentifier(completionHandler: @escaping (String?, Error?) -> Void)
  • completionHandler is invoked with the tracking Identifier string value. or an NSError if an unexpected error occurs or the request times out.
Example
ACPAnalytics.getTrackingIdentifierWithCompletionHandler { (trackingIdentifier, error) in
// Handle the error (if non-nil) or use the trackingIdentifier value.
}

Objective-C

Syntax
+ (void) getTrackingIdentifierWithCompletionHandler: (nonnull void (^) (NSString* __nullable trackingIdentifier, NSError* __nullable error)) completionHandler;
Example
[ACPAnalytics getTrackingIdentifierWithCompletionHandler:^(NSString * _Nullable trackingIdentifier, NSError * _Nullable error) {
// Handle the error (if non-nil) or use the trackingIdentifier value.
}];

getVisitorIdentifier

Before using this API, see Identify unique visitors.
This API gets a custom Analytics visitor identifier, which has been set previously using setVisitorIdentifier.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Flutter
Cordova
Unity
Xamarin

Java

Syntax
public static void getVisitorIdentifier(AdobeCallback<String> callback)
  • callback is invoked with the visitor identifier value. 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 visitor identifier.
Example
Analytics.getVisitorIdentifier(new AdobeCallback<String>() {
@Override
public void call(final String visitorIdentifier) {
// check the visitorIdentifier value
}
});

Swift

Syntax
static func getVisitorIdentifier(_ callback: @escaping (String?) -> Void)
  • callback is invoked with the visitor identifier value.
Example
ACPAnalytics.getVisitorIdentifier { (visitorIdentifier) in
// check the visitorIdentifier value
}

Objective-C

Syntax
+ (void) getVisitorIdentifier: (nonnull void (^) (NSString* __nullable visitorIdentifier)) callback;
Example
[ACPAnalytics getVisitorIdentifier:^(NSString * _Nullable visitorIdentifier) {
// check the visitorIdentifier value
}];

JavaScript

Syntax
getVisitorIdentifier();
Example
ACPAnalytics.getVisitorIdentifier().then(vid => console.log("AdobeExperienceSDK: Visitor identifier: " + vid));

Dart

Syntax
Future<String> visitorIdentifier;
Example
String visitorId;
try {
visitorId = await FlutterACPAnalytics.visitorIdentifier;
} on PlatformException {
visitorId = "Failed to get the visitor identifier";
}

Cordova

Syntax
ACPAnalytics.getVisitorIdentifier = function(success, fail);
  • success is a callback containing the Visitor Identifier string if the getVisitorIdentifier API executed without any errors.
  • fail is a callback containing error information if the getVisitorIdentifier API was executed with errors.
Example
ACPAnalytics.getVisitorIdentifier(function (handleCallback) {
console.log("AdobeExperienceSDK: Retrieved custom visitor identifier: " + handleCallback);
} ,function (handleError) {
console.log("AdobeExperenceSDK: Failed to retrieve custom visitor identifier: " + handleError);
});

C#

Syntax
public static void GetVisitorIdentifier(AdobeGetVisitorIdentifierCallback callback)
  • callback is a callback containing the Visitor Identifier string if the GetVisitorIdentifier API executed without any errors.
Example
[MonoPInvokeCallback(typeof(AdobeGetVisitorIdentifierCallback))]
public static void HandleAdobeGetVisitorIdentifierCallback(string visitorIdentifier)
{
Debug.Log("Visitor identifier is : " + visitorIdentifier);
}
ACPAnalytics.GetVisitorIdentifier(HandleAdobeGetVisitorIdentifierCallback);

C#

Syntax
public unsafe static void GetVisitorIdentifier (Action<NSString> callback);