Edit in GitHubLog an issue

Analytics API reference

clearQueue

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

Java

Syntax

Copied to your clipboard
public static void clearQueue()

Example

Copied to your clipboard
Analytics.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:

Java

Copied to your clipboard
String analyticsExtensionVersion = Analytics.extensionVersion();

getQueueSize

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

Java

Syntax

Copied to your clipboard
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

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

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.

Swift

Syntax

Copied to your clipboard
static func getQueueSize(completionHandler: @escaping (UInt, Error?) -> Void)

Example

Copied to your clipboard
ACPAnalytics.getQueueSizeWithCompletionHandler { (queueSize, error) in
// Handle error (if non-nil) or use queueSize.
}

Objective-C

Syntax

Copied to your clipboard
+ (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

Copied to your clipboard
[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.

Java

Syntax

Copied to your clipboard
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

Copied to your clipboard
Analytics.getTrackingIdentifier(new AdobeCallback<String>() {
@Override
public void call(final String trackingIdentifier) {
// check the trackingIdentifier value
}
});

getTrackingIdentifierWithCompletionHandler

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.

Swift

Syntax

Copied to your clipboard
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

Copied to your clipboard
ACPAnalytics.getTrackingIdentifierWithCompletionHandler { (trackingIdentifier, error) in
// Handle the error (if non-nil) or use the trackingIdentifier value.
}

Objective-C

Syntax

Copied to your clipboard
+ (void) getTrackingIdentifierWithCompletionHandler: (nonnull void (^) (NSString* __nullable trackingIdentifier, NSError* __nullable error)) completionHandler;

Example

Copied to your clipboard
[ACPAnalytics getTrackingIdentifierWithCompletionHandler:^(NSString * _Nullable trackingIdentifier, NSError * _Nullable error) {
// Handle the error (if non-nil) or use the trackingIdentifier value.
}];

getVisitorIdentifier

This API gets a custom Analytics visitor identifier, which has been set previously using setVisitorIdentifier.

Java

Syntax

Copied to your clipboard
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

Copied to your clipboard
Analytics.getVisitorIdentifier(new AdobeCallback<String>() {
@Override
public void call(final String visitorIdentifier) {
// check the visitorIdentifier value
}
});

getVisitorIdentifierWithCompletionHandler

This API gets a custom Analytics visitor identifier, which has been set previously using setVisitorIdentifier. Callback with NSError if an unexpected error occurs or the request times out.

Swift

Syntax

Copied to your clipboard
static func getVisitorIdentifier(completionHandler: @escaping (String?, Error?) -> Void)
  • completionHandler is invoked with the visitor identifier value or an NSError if an unexpected error occurs or the request times out.

Example

Copied to your clipboard
ACPAnalytics.getVisitorIdentifierWithCompletionHandler { (visitorIdentifier, error) in
// Handle the error (if non-nil) or use the visitorIdentifier value
}

Objective-C

Syntax

Copied to your clipboard
+ (void) getVisitorIdentifierWithCompletionHandler: (nonnull void (^) (NSString* __nullable visitorIdentifier, NSError* __nullable error)) completionHandler;

Example

Copied to your clipboard
[ACPAnalytics getVisitorIdentifierWithCompletionHandler:^(NSString * _Nullable visitorIdentifier, NSError * _Nullable error) {
// Handle the error (if non-nil) or use the visitorIdentifier value
}];

resetIdentities

Clears the identities stored in the Analytics extension - tracking identifier (AID) and the custom visitor identifiers (VID) stored in the Analytics extension and force deletes, without sending to Analytics, all hits being stored or batched on the SDK.

sendQueuedHits

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

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

Java

Syntax

Copied to your clipboard
public static void sendQueuedHits()

Example

Copied to your clipboard
Analytics.sendQueuedHits();

setVisitorIdentifier

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

Java

Syntax

Copied to your clipboard
public static void setVisitorIdentifier(final String visitorIdentifier)
  • visitorIdentifier is the new value for the visitor identifier.

Example

Copied to your clipboard
Analytics.setVisitorIdentifier("custom_identifier");
Was this helpful?
  • Privacy
  • Terms of Use
  • Do not sell or share my personal information
  • AdChoices
Copyright © 2024 Adobe. All rights reserved.