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

clearQueue

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

clearQueue

Use caution when manually clearing the queue. This operation cannot be reverted.
Syntax
1
static func clearQueue()
Copied!
Example
Swift
1
Analytics.clearQueue()
Copied!
Objective-C
1
[AEPMobileAnalytics clearQueue];
Copied!

clearQueue

Use caution when manually clearing the queue. This operation cannot be reverted.
Syntax
1
+ (void) clearQueue;
Copied!
Example
Objective-C
1
[ACPAnalytics clearQueue];
Copied!
Swift
1
ACPAnalytics.clearQueue()
Copied!

clearQueue

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

clearQueue

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

clearQueue

Use caution when manually clearing the queue. This operation cannot be reverted.
Syntax
1
ACPAnalytics.clearQueue = function(success, fail);
Copied!
    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
Cordova
1
ACPAnalytics.clearQueue(function (handleCallback) {
2
console.log("AdobeExperienceSDK: Clear queued hits successful. " + handleCallback);
3
} ,function (handleError) {
4
console.log("AdobeExperenceSDK: Failed to clear queued hits: " + handleError);
5
});
Copied!

ClearQueue - C#

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

ClearQueue - C#

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

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
1
String analyticsExtensionVersion = Analytics.extensionVersion();
Copied!
Swift
1
let version = Analytics.extensionVersion
Copied!
Objective-C
1
NSString *version = [AEPMobileAnalytics extensionVersion];
Copied!
Objective-C
1
NSString *analyticsExtensionVersion = [ACPAnalytics extensionVersion];
Copied!
Swift
1
let analyticsExtensionVersion = ACPAnalytics.extensionVersion()
Copied!
JavaScript
1
ACPAnalytics.extensionVersion().then(analyticsExtensionVersion => console.log("AdobeExperienceSDK: ACPAnalytics version: " + analyticsExtensionVersion));
Copied!
Dart
1
String analyticsExtensionVersion = await FlutterACPAnalytics.extensionVersion;
Copied!
Cordova
1
ACPAnalytics.extensionVersion(function(version) {
2
console.log("ACPAnalytics version: " + version);
3
}, function(error) {
4
console.log(error);
5
});
Copied!
C#
1
string analyticsExtensionVersion = ACPAnalytics.ExtensionVersion();
Copied!
C#
1
string analyticsExtensionVersion = ACPAnalytics.ExtensionVersion();
Copied!

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

getQueueSize

Syntax
1
public static void getQueueSize(final AdobeCallback<Long> callback)
Copied!
    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
1
Analytics.getQueueSize(new AdobeCallback<Long>() {
2
@Override
3
public void call(final Long queueSize) {
4
// handle the queueSize
5
}
6
});
Copied!

getQueueSize

Please use the getQueueSizeWithCompletionHandler API instead.

getQueueSize

Syntax
1
+ (void) getQueueSize: (nonnull void (^) (NSUInteger queueSize)) callback;
Copied!
    callback is invoked with the queue size value.
Example
Here are examples in Objective-C and Swift:
Objective-C
1
[ACPAnalytics getQueueSize: ^(NSUInteger queueSize) {
2
// handle queue size
3
}];
Copied!
Swift
1
ACPAnalytics.getQueueSize { (queueSize) in
2
// handle queue size
3
}
Copied!
**JavaScript

getQueueSize

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

getQueueSize - Dart

Syntax
1
Future<int> getQueueSize;
Copied!
Example
1
int queueSize;
2
3
try {
4
queueSize = await FlutterACPAnalytics.queueSize;
5
} on PlatformException {
6
log("Failed to get the queue size");
7
}
Copied!

getQueueSize - Cordova

Syntax
1
ACPAnalytics.getQueueSize = function(success, fail);
Copied!
    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
1
ACPAnalytics.getQueueSize(function (handleCallback) {
2
console.log("AdobeExperienceSDK: Queue size: " + handleCallback);
3
} ,function (handleError) {
4
console.log("AdobeExperenceSDK: Failed to get queue size: " + handleError);
5
});
Copied!

GetQueueSize - C#

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

GetQueueSize - C#

iOS syntax
1
public unsafe static void GetQueueSize (Action<nuint> callback);
Copied!
    callback is a callback containing the queue size if the GetQueueSize API executed without any errors.
iOS example
1
ACPAnalytics.GetQueueSize(callback => {
2
Console.WriteLine("Queue size: " + callback);
3
});
Copied!
Android syntax
1
public unsafe static void GetQueueSize (IAdobeCallback callback);
Copied!
    callback is a callback containing the queue size if the GetQueueSize API executed without any errors.
Android example
1
ACPAnalytics.GetQueueSize(new StringCallback());
2
3
class StringCallback : Java.Lang.Object, IAdobeCallback
4
{
5
public void Call(Java.Lang.Object stringContent)
6
{
7
if (stringContent != null)
8
{
9
Console.WriteLine("Queue size: " + stringContent);
10
}
11
else
12
{
13
Console.WriteLine("null content in string callback");
14
}
15
}
16
}
Copied!

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)

getQueueSize

Syntax
1
static func getQueueSize(completion: @escaping (Int, Error?) -> Void)
Copied!
Example
The following examples are shown in both Swift and Objective-C.
Swift
1
Analytics.getQueueSize { (queueSize, error) in
2
// Handle error (if non-nil) or use queueSize.
3
}
Copied!
Objective-C
1
[AEPMobileAnalytics getQueueSize:^(NSInteger queueSize, NSError * _Nullable error) {
2
// Handle error (if non-nil) or use queueSize.
3
}];
Copied!

getQueueSizeWithCompletionHandler

Syntax
1
+ (void) getQueueSizeWithCompletionHandler: (nonnull void (^) (NSUInteger queueSize, NSError* __nullable error)) completionHandler;
Copied!
    completionHandler is invoked with the queue size value or an NSError if an unexpected error occurs or the request times out.
Example
The following examples are shown in both Swift and Objective-C.
Swift
1
ACPAnalytics.getQueueSizeWithCompletionHandler { (queueSize, error) in
2
// Handle error (if non-nil) or use queueSize.
3
}
Copied!
Objective-C
1
[ACPAnalytics getQueueSizeWithCompletionHandler: ^(NSUInteger queueSize, NSError * _Nullable error) {
2
// Handle error (if non-nil) or use queueSize.
3
}];
Copied!

getTrackingIdentifier

Before you use this API, see 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.
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.
Android
iOS (AEP 3.x)
iOS (ACP 2.x)
React Native
Flutter
Cordova
Unity
Xamarin

getTrackingIdentifier

Retrieves the Analytics tracking identifier.
Syntax
1
public static void
2
getTrackingIdentifier(final AdobeCallback<String> callback)
Copied!
    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
1
Analytics.getTrackingIdentifier(new AdobeCallback<String>() {
2
@Override
3
public void call(final String trackingIdentifier) {
4
// check the trackingIdentifier value
5
}
6
});
Copied!

getTrackingIdentifier

Retrieves the Analytics tracking identifier. See getTrackingIdentifierWithCompletionHandler

getTrackingIdentifier

Retrieves the Analytics tracking identifier.
Syntax
1
+ (void) getTrackingIdentifier: (nonnull void (^) (NSString* __nullable trackingIdentifier)) callback;
Copied!
    callback is invoked with the tracking Identifier string value.
Example
Here are examples in Objective-C and Swift:
Objective-C
1
[ACPAnalytics getTrackingIdentifier:^(NSString * _Nullable trackingIdentifier) {
2
// check the trackingIdentifier value
3
}];
Copied!
Swift
1
ACPAnalytics.getTrackingIdentifier { (trackingIdentifier) in
2
// check the trackingIdentifier value
3
}
Copied!

getTrackingIdentifier - JavaScript

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

getTrackingIdentifier - Dart

Retrieves the Analytics tracking identifier.
Syntax
1
Future<String> getTrackingIdentifier;
Copied!
Example
1
String trackingId;
2
3
try {
4
trackingId = await FlutterACPAnalytics.trackingIdentifier;
5
} on PlatformException {
6
log("Failed to get the tracking identifier");
7
}
Copied!

getTrackingIdentifier - Cordova

Retrieves the Analytics tracking identifier.
1
ACPAnalytics.getTrackingIdentifier = function(success, fail);
Copied!
    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
1
ACPAnalytics.getTrackingIdentifier(function (handleCallback) {
2
console.log("AdobeExperienceSDK: Retrieved tracking identifier: " + handleCallback);
3
} ,function (handleError) {
4
console.log("AdobeExperenceSDK: Failed to retrieve tracking identifier: " + handleError);
5
});
Copied!

GetTrackingIdentifier - C#

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

GetTrackingIdentifier - C#

Retrieves the Analytics tracking identifier.
iOS syntax
1
public unsafe static void GetTrackingIdentifier (Action<NSString> callback);
Copied!
    callback is a callback containing the tracking Identifier string value.
iOS example
1
ACPAnalytics.GetTrackingIdentifier(callback => {
2
Console.WriteLine("Tracking identifier: " + callback);
3
});
Copied!
Android syntax
1
public unsafe static void GetTrackingIdentifier (IAdobeCallback callback);
Copied!
    callback is a callback containing the tracking Identifier string value.
Android example
1
ACPAnalytics.GetTrackingIdentifier(new StringCallback());
2
3
class StringCallback : Java.Lang.Object, IAdobeCallback
4
{
5
public void Call(Java.Lang.Object stringContent)
6
{
7
if (stringContent != null)
8
{
9
Console.WriteLine("Tracking identifier: " + stringContent);
10
}
11
else
12
{
13
Console.WriteLine("null content in string callback");
14
}
15
}
16
}
Copied!

getTrackingIdentifierWithCompletionHandler

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

getTrackingIdentifier

Retrieves the Analytics tracking identifier.
Syntax
1
static func getTrackingIdentifier(completion: @escaping (String?, Error?) -> Void)
Copied!
Example
Swift
1
Analytics.getTrackingIdentifier { (trackingId, error) in
2
// Handle the error (if non-nil) or use the trackingIdentifier value
3
}
Copied!
Objective-C
1
AEPMobileAnalytics getTrackingIdentifier:^(NSString * _Nullable trackingIdentifier, NSError * _Nullable error) {
2
// Handle the error (if non-nil) or use the trackingIdentifier value
3
}];
Copied!

getTrackingIdentifierWithCompletionHandler

Syntax
1
+ (void) getTrackingIdentifierWithCompletionHandler: (nonnull void (^) (NSString* __nullable trackingIdentifier, NSError* __nullable error)) completionHandler;
Copied!
    completionHandler is invoked with the tracking Identifier string value. or an NSError if an unexpected error occurs or the request times out.
Example
Here are examples in Objective-C and Swift:
Objective-C
1
[ACPAnalytics getTrackingIdentifierWithCompletionHandler:^(NSString * _Nullable trackingIdentifier, NSError * _Nullable error) {
2
// Handle the error (if non-nil) or use the trackingIdentifier value.
3
}];
Copied!
Swift
1
ACPAnalytics.getTrackingIdentifierWithCompletionHandler { (trackingIdentifier, error) in
2
// Handle the error (if non-nil) or use the trackingIdentifier value.
3
}
Copied!

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

getVisitorIdentifier

Syntax
1
public static void getVisitorIdentifier(AdobeCallback<String> callback)
Copied!
    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
1
Analytics.getVisitorIdentifier(new AdobeCallback<String>() {
2
@Override
3
public void call(final String visitorIdentifier) {
4
// check the visitorIdentifier value
5
}
6
});
Copied!

getVisitorIdentifier

Syntax
1
+ (void) getVisitorIdentifier: (nonnull void (^) (NSString* __nullable visitorIdentifier)) callback;
Copied!
    callback is invoked with the visitor identifier value.
Example
Objective-C
1
[ACPAnalytics getVisitorIdentifier:^(NSString * _Nullable visitorIdentifier) {
2
// check the visitorIdentifier value
3
}];
Copied!
Swift
1
ACPAnalytics.getVisitorIdentifier { (visitorIdentifier) in
2
// check the visitorIdentifier value
3
}
Copied!

getVisitorIdentifier - JavaScript

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

getVisitorIdentifier - Dart

Syntax
1
Future<String> visitorIdentifier;
Copied!
Example
1
String visitorId;
2
3
try {
4
visitorId = await FlutterACPAnalytics.visitorIdentifier;
5
} on PlatformException {
6
visitorId = "Failed to get the visitor identifier";
7
}
Copied!

getVisitorIdentifier - Cordova

Syntax
1
ACPAnalytics.getVisitorIdentifier = function(success, fail);
Copied!
    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
1
ACPAnalytics.getVisitorIdentifier(function (handleCallback) {
2
console.log("AdobeExperienceSDK: Retrieved custom visitor identifier: " + handleCallback);
3
} ,function (handleError) {
4
console.log("AdobeExperenceSDK: Failed to retrieve custom visitor identifier: " + handleError);
5
});
Copied!

GetVisitorIdentifier - C#

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

GetVisitorIdentifier - C#

iOS syntax
1
public unsafe static void GetVisitorIdentifier (Action<NSString> callback);
Copied!
    callback is a callback containing the visitor Identifier string value.
iOS example
1
ACPAnalytics.GetVisitorIdentifier(callback => {
2
Console.WriteLine("Visitor identifier: " + callback);
3
});
Copied!
Android syntax
1
public unsafe static void GetVisitorIdentifier (IAdobeCallback callback);
Copied!
    callback is a callback containing the visitor Identifier string value.
Android example
1