Skip to content

Latest commit

 

History

History
387 lines (264 loc) · 7.95 KB

analytics-api-reference.md

File metadata and controls

387 lines (264 loc) · 7.95 KB

Analytics API reference

Send queued hits

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

{% tabs %} {% tab title="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();

{% endtab %}

{% tab title="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()

{% endtab %}

{% tab title="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();

{% endtab %} {% endtabs %}

Clear queued hits

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

{% tabs %} {% tab title="Android" %}

clearQueue

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

Syntax

public static void clearQueue()

Example

Analytics.clearQueue();

{% endtab %}

{% tab title="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()

{% endtab %}

{% tab title="React Native" %}

JavaScript

clearQueue

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

ACPAnalytics.clearQueue();

{% endtab %} {% endtabs %}

Get the queue size

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

{% tabs %} {% tab title="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
    }
});

{% endtab %}

{% tab title="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   
}

{% endtab %}

{% tab title="React Native" %}

JavaScript

getQueueSize

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

{% endtab %} {% endtabs %}

Get the tracking identifier

{% hint style="warning" %} Please review Adobe Analytics's Visitor ID Order documentation before using this API. {% endhint %}

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.

{% hint style="info" %} If you have an Experience Cloud ID, and do not have visitor ID grace period configured, the value returned by getTrackingIdentifier might be null. {% endhint %}

{% tabs %} {% tab title="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);

{% endtab %}

{% tab title="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
}

{% endtab %}

{% tab title="React Native" %}

JavaScript

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

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

{% endtab %} {% endtabs %}

Set the custom visitor identifier

{% hint style="warning" %} Please review Adobe Analytics's Visitor ID Order documentation before using this API. {% endhint %}

Sets a custom Analytics visitor identifier. Please see Custom Visitor ID for more information.

{% tabs %} {% tab title="Android" %}

setVistorIdentifier

Syntax

 public static void setVistorIdentifier(final String visitorIdentifier)

Example

Analytics.setVistorIdentifier("custom_identifier");

{% endtab %}

{% tab title="iOS" %}

setVistorIdentifier

Syntax

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

Example

Here are examples in Objective-C and Swift:

Objective-C

[ACPAnalytics setVistorIdentifier:@"custom_identifier"];

Swift

ACPAnalytics.setVistorIdentifier("custom_identifier")

{% endtab %}

{% tab title="React Native" %}

JavaScript

setVistorIdentifier

ACPAnalytics.setVisitorIdentifier("yourVisitorId");

{% endtab %} {% endtabs %}

Get the custom visitor identifier

{% hint style="warning" %} Please review Adobe Analytics's Visitor ID Order documentation before using this API. {% endhint %}

Sets a custom Analytics visitor identifier. Please see Custom Visitor ID for more information.

{% tabs %} {% tab title="Android" %}

getVistorIdentifier

Syntax

public static void getVisitorIdentifier(AdobeCallback<String> callback)

{% endtab %}

{% tab title="iOS" %}

getVistorIdentifier

Syntax

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

**** {% endtab %}

{% tab title="React Native" %}

JavaScript

getVistorIdentifier

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

{% endtab %} {% endtabs %}