Skip to content

Latest commit

 

History

History
1122 lines (776 loc) · 22.1 KB

analytics-api-reference.md

File metadata and controls

1122 lines (776 loc) · 22.1 KB

Analytics API reference

clearQueue

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

Syntax

clearQueue();

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

Example

ACPAnalytics.clearQueue();

{% endtab %}

{% tab title="Flutter" %}

Dart

clearQueue

Syntax

Future<void> clearQueue();

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

Example

FlutterACPAnalytics.clearQueue();

{% endtab %}

{% tab title="Cordova" %}

Cordova

clearQueue

ACPAnalytics.clearQueue = function(success, fail);
  • 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.

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

Example

ACPAnalytics.clearQueue(function (handleCallback) {
  console.log("AdobeExperienceSDK: Clear queued hits successful. " + handleCallback);
} ,function (handleError) {
  console.log("AdobeExperenceSDK: Failed to clear queued hits: " + handleError);
});

{% endtab %}

{% tab title="Unity" %}

C#

ClearQueue

public static void ClearQueue()

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

Example

ACPAnalytics.ClearQueue();

{% endtab %}

{% tab title="Xamarin" %}

C#

ClearQueue

public static void ClearQueue ();

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

Example

ACPAnalytics.ClearQueue();

{% endtab %} {% endtabs %}

getQueueSize

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)
  • callback is invoked with the queue size value.

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;
  • callback is invoked with the queue size value.

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

Syntax

getQueueSize(): Promise<?integer>;

Example

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

{% endtab %}

{% tab title="Flutter" %}

Dart

getQueueSize

Syntax

Future<int> getQueueSize;

Example

int queueSize;

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

{% endtab %}

{% tab title="Cordova" %}

Cordova

getQueueSize

Syntax

ACPAnalytics.getQueueSize = function(success, fail);
  • 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

ACPAnalytics.getQueueSize(function (handleCallback) {
  console.log("AdobeExperienceSDK: Queue size: " + handleCallback);
} ,function (handleError) {
  console.log("AdobeExperenceSDK: Failed to get queue size: " + handleError);
});

{% endtab %}

{% tab title="Unity" %}

C#

GetQueueSize

Syntax

public static void GetQueueSize(AdobeGetQueueSizeCallback callback)
  • callback is a callback containing the queue size if the GetQueueSize API executed without any errors.

Example

[MonoPInvokeCallback(typeof(AdobeGetQueueSizeCallback))]
public static void HandleAdobeGetQueueSizeCallback(long queueSize)
{
    Debug.Log("Queue size is : " + queueSize);
}
ACPAnalytics.GetQueueSize(HandleAdobeGetQueueSizeCallback);

{% endtab %}

{% tab title="Xamarin" %}

C#

GetQueueSize

iOS Syntax

public unsafe static void GetQueueSize (Action<nuint> callback);
  • callback is a callback containing the queue size if the GetQueueSize API executed without any errors.

iOS Example

ACPAnalytics.GetQueueSize(callback => {
  Console.WriteLine("Queue size: " + callback);
});

Android Syntax

public unsafe static void GetQueueSize (IAdobeCallback callback);
  • callback is a callback containing the queue size if the GetQueueSize API executed without any errors.

Android Example

ACPAnalytics.GetQueueSize(new StringCallback());

class StringCallback : Java.Lang.Object, IAdobeCallback
{
  public void Call(Java.Lang.Object stringContent)
  {
    if (stringContent != null)
    {
      Console.WriteLine("Queue size: " + stringContent);
    }
    else
    {
      Console.WriteLine("null content in string callback");
    }
  }
}

{% endtab %} {% endtabs %}

getTrackingIdentifier

{% hint style="warning" %} Before you use this API, see Identify unique visitors. {% 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 have not yet configured a visitor ID grace period, 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)
  • callback is invoked with the tracking Identifier string value.

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;
  • callback is invoked with the tracking Identifier string value.

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.

Syntax

getTrackingIdentifier();
  • callback is invoked with the tracking Identifier string value.

Example

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

{% endtab %}

{% tab title="Flutter" %}

Dart

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

Syntax

Future<String> getTrackingIdentifier;

Example

String trackingId;

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

{% endtab %}

{% tab title="Cordova" %}

Cordova

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

ACPAnalytics.getTrackingIdentifier = function(success, fail);
  • 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

ACPAnalytics.getTrackingIdentifier(function (handleCallback) {
  console.log("AdobeExperienceSDK: Retrieved tracking identifier: " + handleCallback);
} ,function (handleError) {
  console.log("AdobeExperenceSDK: Failed to retrieve tracking identifier: " + handleError);
});

{% endtab %}

{% tab title="Unity" %}

C#

GetTrackingIdentifier

Retrieves the Analytics tracking identifier.

public static void GetTrackingIdentifier(AdobeGetTrackingIdentifierCallback callback)
  • callback is a callback containing the tracking Identifier string value.

Example

[MonoPInvokeCallback(typeof(AdobeGetTrackingIdentifierCallback))]
public static void HandleAdobeGetTrackingIdentifierCallback(string trackingIdentifier)
{
    Debug.Log("Tracking identifier is : " + trackingIdentifier);
}
ACPAnalytics.GetTrackingIdentifier(HandleAdobeGetTrackingIdentifierCallback);

{% endtab %}

{% tab title="Xamarin" %}

C#

GetTrackingIdentifier

Retrieves the Analytics tracking identifier.

iOS Syntax

public unsafe static void GetTrackingIdentifier (Action<NSString> callback);
  • callback is a callback containing the tracking Identifier string value.

iOS Example

ACPAnalytics.GetTrackingIdentifier(callback => {
  Console.WriteLine("Tracking identifier: " + callback);
});

Android Syntax

public unsafe static void GetTrackingIdentifier (IAdobeCallback callback);
  • callback is a callback containing the tracking Identifier string value.

Android Example

ACPAnalytics.GetTrackingIdentifier(new StringCallback());

class StringCallback : Java.Lang.Object, IAdobeCallback
{
  public void Call(Java.Lang.Object stringContent)
  {
    if (stringContent != null)
    {
      Console.WriteLine("Tracking identifier: " + stringContent);
    }
    else
    {
      Console.WriteLine("null content in string callback");
    }
  }
}

{% endtab %} {% endtabs %}

getVisitorIdentifier

{% hint style="warning" %} Before using this API, see Identify unique visitors. {% endhint %}

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

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

getVisitorIdentifier

Syntax

public static void getVisitorIdentifier(AdobeCallback<String> callback)
  • callback is invoked with the visitor identifier value.

Example

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

Analytics.getVisitorIdentifier(visitorIdentifierCallback);

{% endtab %}

{% tab title="iOS" %}

getVisitorIdentifier

Syntax

+ (void) getVisitorIdentifier: (nonnull void (^) (NSString* __nullable visitorIdentifier)) callback;
  • callback is invoked with the visitor identifier value.

Example

Objective-C

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

Swift

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

{% endtab %}

{% tab title="React Native" %}

JavaScript

getVisitorIdentifier

Syntax

getVisitorIdentifier();

Example

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

{% endtab %}

{% tab title="Flutter" %}

Dart

getVisitorIdentifier

Syntax

Future<String> visitorIdentifier;

Example

String visitorId;

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

{% endtab %}

{% tab title="Cordova" %}

Cordova

getVisitorIdentifier

Syntax

ACPAnalytics.getVisitorIdentifier = function(success, fail);
  • 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

ACPAnalytics.getVisitorIdentifier(function (handleCallback) {
  console.log("AdobeExperienceSDK: Retrieved custom visitor identifier: " + handleCallback);
} ,function (handleError) {
  console.log("AdobeExperenceSDK: Failed to retrieve custom visitor identifier: " + handleError);
});

{% endtab %}

{% tab title="Unity" %}

C#

GetVisitorIdentifier

Syntax

public static void GetVisitorIdentifier(AdobeGetVisitorIdentifierCallback callback)
  • callback is a callback containing the Visitor Identifier string if the GetVisitorIdentifier API executed without any errors.

Example

[MonoPInvokeCallback(typeof(AdobeGetVisitorIdentifierCallback))]
public static void HandleAdobeGetVisitorIdentifierCallback(string visitorIdentifier)
{
    Debug.Log("Visitor identifier is : " + visitorIdentifier);
}
ACPAnalytics.GetVisitorIdentifier(HandleAdobeGetVisitorIdentifierCallback);

{% endtab %}

{% tab title="Xamarin" %}

C#

GetVisitorIdentifier

iOS Syntax

public unsafe static void GetVisitorIdentifier (Action<NSString> callback);
  • callback is a callback containing the visitor Identifier string value.

iOS Example

ACPAnalytics.GetVisitorIdentifier(callback => {
  Console.WriteLine("Visitor identifier: " + callback);
});

Android Syntax

public unsafe static void GetVisitorIdentifier (IAdobeCallback callback);
  • callback is a callback containing the visitor Identifier string value.

Android Example

ACPAnalytics.GetVisitorIdentifier(new StringCallback());

class StringCallback : Java.Lang.Object, IAdobeCallback
{
  public void Call(Java.Lang.Object stringContent)
  {
    if (stringContent != null)
    {
      Console.WriteLine("Visitor identifier: " + stringContent);
    }
    else
    {
      Console.WriteLine("null content in string callback");
    }
  }
}

{% endtab %} {% endtabs %}

sendQueuedHits

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

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.

Syntax

sendQueuedHits();

Example

ACPAnalytics.sendQueuedHits();

{% endtab %}

{% tab title="Flutter" %}

Dart

sendQueuedHits

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

Syntax

Future<void> sendQueuedHits();

Example

FlutterACPAnalytics.sendQueuedHits();

{% endtab %}

{% tab title="Cordova" %}

Cordova

sendQueuedHits

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

Syntax

ACPAnalytics.sendQueuedHits = function(success, fail);
  • success is a callback containing a general success message if the sendQueuedHits API executed without any errors.
  • fail is a callback containing error information if the sendQueuedHits API was executed with errors.

Example

ACPAnalytics.sendQueuedHits(function (handleCallback) {
  console.log("AdobeExperienceSDK: Send queued hits successful. " + handleCallback);
} ,function (handleError) {
  console.log("AdobeExperenceSDK: Failed to send queued hits: " + handleError);
});

{% endtab %}

{% tab title="Unity" %}

C#

SendQueuedHits

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

Syntax

public static void SendQueuedHits()

Example

ACPAnalytics.SendQueuedHits();

{% endtab %}

{% tab title="Xamarin" %}

C#

SendQueuedHits

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

Syntax

public static void SendQueuedHits ();

Example

ACPAnalytics.SendQueuedHits();

{% endtab %} {% endtabs %}

setVisitorIdentifier

{% hint style="warning" %} Before using this API, see Identify unique visitors. {% endhint %}

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

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

setVisitorIdentifier

Syntax

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

Example

Analytics.setVisitorIdentifier("custom_identifier");

{% endtab %}

{% tab title="iOS" %}

setVisitorIdentifier

Syntax

+ (void) setVisitorIdentifier: (nonnull NSString*) visitorIdentifier;
  • visitorIdentifier is the new value for the visitor identifier.

Example

Here are examples in Objective-C and Swift:

Objective-C

[ACPAnalytics setVisitorIdentifier:@"custom_identifier"];

Swift

ACPAnalytics.setVisitorIdentifier("custom_identifier")

{% endtab %}

{% tab title="React Native" %}

JavaScript

setVisitorIdentifier

Syntax

setVisitorIdentifier(visitorIdentifier);
  • visitorIdentifier is the new value for the visitor identifier.

Example

ACPAnalytics.setVisitorIdentifier("custom_identifier");

{% endtab %}

{% tab title="Flutter" %}

Dart

setVisitorIdentifier

Syntax

Future<void> setVisitorIdentifier(visitorIdentifier);
  • visitorIdentifier is the new value for the visitor identifier.

Example

FlutterACPAnalytics.setVisitorIdentifier("yourVisitorId");

{% endtab %}

{% tab title="Cordova" %}

Cordova

setVisitorIdentifier

Syntax

ACPAnalytics.setVisitorIdentifier(visitorIdentifier, success, fail);
  • visitorIdentifier is the new value for the visitor identifier.
  • success is a callback containing a general success message if the setVisitorIdentifier API executed without any errors.
  • fail is a callback containing error information if the setVisitorIdentifier API was executed with errors.

Example

ACPAnalytics.setVisitorIdentifier("custom_identifier", function (handleCallback) {
  console.log("AdobeExperienceSDK: Custom visitor identifier set successfully. " + handleCallback);
} ,function (handleError) {
  console.log("AdobeExperenceSDK: Failed to set custom visitor identifier: " + handleError);
});

{% endtab %}

{% tab title="Unity" %}

C#

SetVisitorIdentifier

Syntax

public static void SetVisitorIdentifier(string visitorId)
  • visitorId is the new value for the visitor identifier.

Example

ACPAnalytics.SetVisitorIdentifier("VisitorIdentifier");

{% endtab %}

{% tab title="Xamarin" %}

C#

SetVisitorIdentifier

iOS Syntax

public static void SetVisitorIdentifier (string visitorIdentifier);
  • visitorIdentifier is the new value for the visitor identifier.

Android Syntax

public unsafe static void SetVisitorIdentifier (string visitorID);
  • visitorID is the new value for the visitor identifier.

Example

ACPAnalytics.SetVisitorIdentifier("VisitorIdentifier");

{% endtab %} {% endtabs %}