Analytics API reference

Send queued hits

Sends all queued hits to Analytics, regardless of the current hit batch settings.

Android
iOS
React Native
Flutter
Android

sendQueuedHits

Regardless of how many hits are currently queued, this method forces the library to send all hits in the offline queue.

Warning: Use caution when manually clearing the queue. This process cannot be reversed.

Syntax

public static void sendQueuedHits()

Example

Analytics.sendQueuedHits();
iOS

sendQueuedHits

Regardless of how many hits are currently queued, this method forces the library to send all hits in the offline queue.

Warning: Use caution when manually clearing the queue. This process cannot be reversed.

Syntax

+ (void) sendQueuedHits;

Example

Here are examples in Objective-C and Swift:

Objective-C

[ACPAnalytics sendQueuedHits];

Swift

ACPAnalytics.sendQueuedHits()
React Native

JavaScript

sendQueuedHits

Regardless of how many hits are currently queued, this method forces the library to send all hits in the offline queue.

ACPAnalytics.sendQueuedHits();
Flutter

Dart

sendQueuedHits

Regardless of how many hits are currently queued, this method forces the library to send all hits in the offline queue.

FlutterACPAnalytics.sendQueuedHits();

Clear queued hits

Force delete, without sending to Analytics, all hits being stored or batched on the SDK.

Android
iOS
React Native
Flutter
Android

clearQueue

Warning: Use caution when manually clearing the queue. This process cannot be reversed.

Syntax

public static void clearQueue()

Example

Analytics.clearQueue();
iOS

clearQueue

Warning: Use caution when manually clearing the queue. This process cannot be reversed.

Syntax

+ (void) clearQueue;

Example

Objective-C

[ACPAnalytics clearQueue];

Swift

ACPAnalytics.clearQueue()
React Native

JavaScript

clearQueue

Warning: Use caution when manually clearing the queue. This process cannot be reversed.

ACPAnalytics.clearQueue();
Flutter

Dart

clearQueue

Warning: Use caution when manually clearing the queue. This process cannot be reversed.

FlutterACPAnalytics.clearQueue();

Get the queue size

Retrieves the total number of Analytics hits in the tracking queue.

Android
iOS
React Native
Flutter
Android

getQueueSize

Syntax

public static void getQueueSize(final AdobeCallback<Long> callback)

Example

Analytics.getQueueSize(new AdobeCallback<Long>() {
@Override
public void call(final Long queueSize) {
// handle the queueSize
}
});
iOS

getQueueSize

Syntax

+ (void) getQueueSize: (nonnull void (^) (NSUInteger queueSize)) callback;

Example

Here are examples in Objective-C and Swift:

Objective-C

[ACPAnalytics getQueueSize: ^(NSUInteger queueSize) {
// use queue size
}];

Swift

ACPAnalytics.getQueueSize { (queueSize) in
// use queue size
}
React Native

JavaScript

getQueueSize

ACPAnalytics.getQueueSize().then(size => console.log("AdobeExperienceSDK: Queue size: " + size));
Flutter

Dart

getQueueSize

int queueSize;
try {
queueSize = await FlutterACPAnalytics.queueSize;
} on PlatformException {
log("Failed to get the queue size");
}

Get the tracking identifier

Before you use this API, see Identify 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
React Native
Flutter
Android

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

Syntax

public static void
getTrackingIdentifier(final AdobeCallback<String> callback)

Example

AdobeCallback<String> trackingIdentifierCallback = new AdobeCallback<String>() {
@Override
public void call(final String trackingIdentifier) {
// check the trackingIdentifier value
}
};
Analytics.getTrackingIdentifier(analyticsTrackingIdentifierCallback);
iOS

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

Syntax

+ (void) getTrackingIdentifier: (nonnull void (^) (NSString* __nullable trackingIdentifier)) callback;

Example

Here are examples in Objective-C and Swift:

Objective-C

[ACPAnalytics getTrackingIdentifier:^(NSString * _Nullable trackingIdentifier) {
// use returned trackingIdentifier
}];

Swift

ACPAnalytics.getTrackingIdentifier { (trackingIdentifier) in
// use returned trackingIdentifier
}
React Native

JavaScript

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

ACPAnalytics.getTrackingIdentifier().then(identifier => console.log("AdobeExperienceSDK: Tracking identifier: " + identifier));
Flutter

Dart

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

String trackingId;
try {
trackingId = await FlutterACPAnalytics.trackingIdentifier;
} on PlatformException {
log("Failed to get the tracking identifier");
}

Set the custom visitor identifier

Before using this API, see Identify unique visitors.

Sets a custom Analytics visitor identifier. For more information, see Custom Visitor ID.

Android
iOS
React Native
Flutter
Android

setVisitorIdentifier

Syntax

public static void setVisitorIdentifier(final String visitorIdentifier)

Example

Analytics.setVisitorIdentifier("custom_identifier");
iOS

setVisitorIdentifier

Syntax

+ (void) setVisitorIdentifier: (nonnull NSString*) visitorIdentifier;

Example

Here are examples in Objective-C and Swift:

Objective-C

[ACPAnalytics setVisitorIdentifier:@"custom_identifier"];

Swift

ACPAnalytics.setVisitorIdentifier("custom_identifier")
React Native

JavaScript

setVisitorIdentifier

ACPAnalytics.setVisitorIdentifier("custom_identifier");
Flutter

Dart

setVisitorIdentifier

FlutterACPAnalytics.setVisitorIdentifier("yourVisitorId");

Get the custom visitor identifier

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
React Native
Flutter
Android

getVisitorIdentifier

Syntax

public static void getVisitorIdentifier(AdobeCallback<String> callback)

Example

AdobeCallback<String> visitorIdentifierCallback = new AdobeCallback<String>() {
@Override
public void call(final String visitorIdentifier) {
// check the visitorIdentifier value
}
};
Analytics.getVisitorIdentifier(visitorIdentifierCallback);
iOS

getVisitorIdentifier

Syntax

+ (void) getVisitorIdentifier: (nonnull void (^) (NSString* __nullable visitorIdentifier)) callback;

Example

Here are examples in Objective-C and Swift:

Objective-C

[ACPAnalytics getVisitorIdentifier:^(NSString * _Nullable visitorIdentifier) {
// use returned visitorIdentifier
}];

Swift

ACPAnalytics.getVisitorIdentifier { (visitorIdentifier) in
// use returned visitorIdentifier
}
React Native

JavaScript

getVisitorIdentifier

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

Dart

getVisitorIdentifier

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