Analytics API reference

Send queued hits

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

Android
iOS
React Native

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();

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

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();

Clear queued hits

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

Android
iOS
React Native

clearQueue

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

Syntax

public static void clearQueue()

Example

Analytics.clearQueue();

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

JavaScript

clearQueue

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

ACPAnalytics.clearQueue();

Get the queue size

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

Android
iOS
React Native

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
}
});

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
}

JavaScript

getQueueSize

ACPAnalytics.getQueueSize().then(size => console.log("AdobeExperienceSDK: Queue size: " + 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

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

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
}

JavaScript

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

ACPAnalytics.getTrackingIdentifier().then(identifier => console.log("AdobeExperienceSDK: Tracking identifier: " + 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

setVisitorIdentifier

Syntax

public static void setVisitorIdentifier(final String visitorIdentifier)

Example

Analytics.setVisitorIdentifier("custom_identifier");

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

JavaScript

setVisitorIdentifier

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

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

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
}

JavaScript

getVisitorIdentifier

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