Skip to content

Latest commit

 

History

History
1507 lines (1057 loc) · 33 KB

File metadata and controls

1507 lines (1057 loc) · 33 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

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

public static void clearQueue()

Example

Analytics.clearQueue();

{% endtab %}

{% tab title="iOS (AEP 3.x)" %}

clearQueue

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

static func clearQueue()

Example

Swift

Analytics.clearQueue()

Objective-C

[AEPMobileAnalytics clearQueue];

{% endtab %}

{% tab title="iOS (ACP 2.x)" %}

clearQueue

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

+ (void) clearQueue;

Example

Objective-C

[ACPAnalytics clearQueue];

Swift

ACPAnalytics.clearQueue()

{% endtab %}

{% tab title="React Native" %}

clearQueue

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

clearQueue();

Example

JavaScript

ACPAnalytics.clearQueue();

{% endtab %}

{% tab title="Flutter" %}

clearQueue

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

Future<void> clearQueue();

Example

Dart

FlutterACPAnalytics.clearQueue();

{% endtab %}

{% tab title="Cordova" %}

clearQueue

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

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.

Example

Cordova

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" %}

ClearQueue - C#

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

public static void ClearQueue()

Example

ACPAnalytics.ClearQueue();

{% endtab %}

{% tab title="Xamarin" %}

ClearQueue - C#

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

public static void ClearQueue ();

Example

ACPAnalytics.ClearQueue();

{% endtab %} {% endtabs %}

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:

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

String analyticsExtensionVersion = Analytics.extensionVersion();

{% endtab %}

{% tab title="iOS (AEP 3.x)" %} Swift

let version = Analytics.extensionVersion

Objective-C

NSString *version = [AEPMobileAnalytics extensionVersion];

{% endtab %}

{% tab title="iOS (ACP 2.x)" %} Objective-C

NSString *analyticsExtensionVersion = [ACPAnalytics extensionVersion];

Swift

let analyticsExtensionVersion  = ACPAnalytics.extensionVersion()

{% endtab %}

{% tab title="React Native" %} JavaScript

ACPAnalytics.extensionVersion().then(analyticsExtensionVersion => console.log("AdobeExperienceSDK: ACPAnalytics version: " + analyticsExtensionVersion));

{% endtab %}

{% tab title="Flutter" %} Dart

String analyticsExtensionVersion = await FlutterACPAnalytics.extensionVersion;

{% endtab %}

{% tab title="Cordova" %} Cordova

ACPAnalytics.extensionVersion(function(version) {  
   console.log("ACPAnalytics version: " + version);
}, function(error) {  
   console.log(error);  
});

{% endtab %}

{% tab title="Unity" %} C#

string analyticsExtensionVersion = ACPAnalytics.ExtensionVersion();

{% endtab %}

{% tab title="Xamarin" %} C#

string analyticsExtensionVersion = ACPAnalytics.ExtensionVersion();

{% 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. 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

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

{% endtab %}

{% tab title="iOS (AEP 3.x)" %}

getQueueSize

Please use the getQueueSizeWithCompletionHandler API instead. {% endtab %}

{% tab title="iOS (ACP 2.x)" %}

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) {    
    // handle queue size
}];

Swift

ACPAnalytics.getQueueSize { (queueSize) in    
     // handle 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" %}

getQueueSize - Dart

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" %}

getQueueSize - Cordova

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" %}

GetQueueSize - C#

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" %}

GetQueueSize - C#

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 %}

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.

{% tabs %} {% tab title="iOS (AEP 3.x)" %}

getQueueSize

Syntax

static func getQueueSize(completion: @escaping (Int, Error?) -> Void)

Example

The following examples are shown in both Swift and Objective-C.

Swift

Analytics.getQueueSize { (queueSize, error) in
    // Handle error (if non-nil) or use queueSize.
}

Objective-C

[AEPMobileAnalytics getQueueSize:^(NSInteger queueSize, NSError * _Nullable error) {
    // Handle error (if non-nil) or use queueSize.
 }];

{% endtab %}

{% tab title="iOS (ACP 2.x)" %}

getQueueSizeWithCompletionHandler

Syntax

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

The following examples are shown in both Swift and Objective-C.

Swift

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

Objective-C

[ACPAnalytics getQueueSizeWithCompletionHandler: ^(NSUInteger queueSize, NSError * _Nullable error) {    
    // Handle error (if non-nil) or use queueSize.
}];

{% endtab %} {% endtabs %}

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.

{% hint style="warning" %} Starting with v1.2.9 (Android) / v3.0.3(iOS AEPAnalytics) / v2.5.1 (iOS ACPAnalytics) this API does not generate or retrieve a new tracking identifier (AID) for new visitors. For the visitors which have an AID previously generated will continue retrieve the AID value with this API, and new users will use the ECID (MID) value as the primary identity. Before using this API, see the documentation on identifying unique visitors. {% 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. 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

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

{% endtab %}

{% tab title="iOS (AEP 3.x)" %}

getTrackingIdentifier

Retrieves the Analytics tracking identifier. See getTrackingIdentifierWithCompletionHandler {% endtab %}

{% tab title="iOS (ACP 2.x)" %}

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) {
    // check the trackingIdentifier value  
}];

Swift

ACPAnalytics.getTrackingIdentifier { (trackingIdentifier) in
    // check the trackingIdentifier value  
}

{% endtab %}

{% tab title="React Native" %}

getTrackingIdentifier - JavaScript

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" %}

getTrackingIdentifier - Dart

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" %}

getTrackingIdentifier - Cordova

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" %}

GetTrackingIdentifier - C#

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" %}

GetTrackingIdentifier - C#

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 %}

getTrackingIdentifierWithCompletionHandler

{% hint style="warning" %} Before you use this API, please read the documentation on identifying 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. Invoke the callback with NSError if an unexpected error occurs or the request times out.

{% 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="iOS (AEP 3.x)" %}

getTrackingIdentifier

Retrieves the Analytics tracking identifier.

Syntax

static func getTrackingIdentifier(completion: @escaping (String?, Error?) -> Void)

Example

Swift

Analytics.getTrackingIdentifier { (trackingId, error) in
   // Handle the error (if non-nil) or use the trackingIdentifier value
}

Objective-C

AEPMobileAnalytics getTrackingIdentifier:^(NSString * _Nullable trackingIdentifier, NSError * _Nullable error) {
   // Handle the error (if non-nil) or use the trackingIdentifier value
}];

{% endtab %}

{% tab title="iOS (ACP 2.x)" %}

getTrackingIdentifierWithCompletionHandler

Syntax

+ (void) getTrackingIdentifierWithCompletionHandler: (nonnull void (^) (NSString* __nullable trackingIdentifier, NSError* __nullable error)) completionHandler;
  • completionHandler is invoked with the tracking Identifier string value. or an NSError if an unexpected error occurs or the request times out.

Example

Here are examples in Objective-C and Swift:

Objective-C

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

Swift

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

{% 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. 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

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

{% endtab %}

{% tab title="iOS (AEP 3.x)" %}

getVisitorIdentifier

See getVisitorIdentifierWithCompletionHandler {% endtab %}

{% tab title="iOS (ACP 2.x)" %}

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) {
    // check the visitorIdentifier value   
}];

Swift

ACPAnalytics.getVisitorIdentifier { (visitorIdentifier) in
    // check the visitorIdentifier value  
}

{% endtab %}

{% tab title="React Native" %}

getVisitorIdentifier - JavaScript

Syntax

getVisitorIdentifier();

Example

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

{% endtab %}

{% tab title="Flutter" %}

getVisitorIdentifier - Dart

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" %}

getVisitorIdentifier - Cordova

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" %}

GetVisitorIdentifier - C#

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" %}

GetVisitorIdentifier - C#

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 %}

getVisitorIdentifierWithCompletionHandler

{% 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. Callback with NSError if an unexpected error occurs or the request times out.

{% tabs %} {% tab title="iOS (AEP 3.x)" %}

getVisitorIdentifier

Syntax

static func getVisitorIdentifier(completion: @escaping (String?, Error?) -> Void)

Example

Swift

Analytics.getVisitorIdentifier { (visitorIdentifier, error) in
   // Handle the error (if non-nil) or use the visitorIdentifier value
}

Objective-C

[AEPMobileAnalytics getVisitorIdentifier:^(NSString * _Nullable visitorIdentifier, NSError * _Nullable error) {
   // Handle the error (if non-nil) or use the visitorIdentifier value
}];

{% endtab %}

{% tab title="iOS (ACP 2.x)" %}

getVisitorIdentifierWithCompletionHandler

Syntax

+ (void) getVisitorIdentifierWithCompletionHandler: (nonnull void (^) (NSString* __nullable visitorIdentifier, NSError* __nullable error)) completionHandler;
  • completionHandler is invoked with the visitor identifier value or an NSError if an unexpected error occurs or the request times out.

Example

Objective-C

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

Swift

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

{% endtab %} {% endtabs %}

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.

{% hint style="info" %} Support for this API was added in:

  • Android Analytics version 1.2.9

  • iOS AEPAnalytics version 3.0.3

{% endhint %}

See MobileCore.resetIdentities for more details.

sendQueuedHits

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

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

sendQueuedHits

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

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

public static void sendQueuedHits()

Example

Analytics.sendQueuedHits();

{% endtab %}

{% tab title="iOS (AEP 3.x)" %}

sendQueuedHits

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

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

static func sendQueuedHits()

Example

Objective-C

Analytics.sendQueuedHits()

Swift

[AEPMobileAnalytics sendQueueHits];

{% endtab %}

{% tab title="iOS (ACP 2.x)" %}

sendQueuedHits

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

{% hint style="warning" %} Use caution when manually clearing the queue. This operation cannot be reverted. {% endhint %}

Syntax

+ (void) sendQueuedHits;

Example

Objective-C

[ACPAnalytics sendQueuedHits];

Swift

ACPAnalytics.sendQueuedHits()

{% endtab %}

{% tab title="React Native" %}

sendQueuedHits - JavaScript

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

Syntax

sendQueuedHits();

Example

ACPAnalytics.sendQueuedHits();

{% endtab %}

{% tab title="Flutter" %} **Dart

sendQueuedHits

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

Syntax

Future<void> sendQueuedHits();

Example

FlutterACPAnalytics.sendQueuedHits();

{% endtab %}

{% tab title="Cordova" %}

sendQueuedHits - Cordova

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

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" %}

SendQueuedHits - C#

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

Syntax

public static void SendQueuedHits()

Example

ACPAnalytics.SendQueuedHits();

{% endtab %}

{% tab title="Xamarin" %}

SendQueuedHits - C#

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

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 (AEP 3.x)" %}

setVisitorIdentifier

Syntax

static func setVisitorIdentifier(visitorIdentifier: String)
  • visitorIdentifier is the new value for the visitor identifier.

Example

Swift

Analytics.setVisitorIdentifier(visitorIdentifier:"custom_identifier")

Objective-C

[AEPMobileAnalytics setVisitorIdentifier:@"custom_identifier"];

{% endtab %}

{% tab title="iOS (ACP 2.x)" %}

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" %}

setVisitorIdentifier - JavaScript

Syntax

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

Example

ACPAnalytics.setVisitorIdentifier("custom_identifier");

{% endtab %}

{% tab title="Flutter" %}

setVisitorIdentifier - Dart

Syntax

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

Example

FlutterACPAnalytics.setVisitorIdentifier("yourVisitorId");

{% endtab %}

{% tab title="Cordova" %}

setVisitorIdentifier - Cordova

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" %}

SetVisitorIdentifier - C#

Syntax

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

Example

ACPAnalytics.SetVisitorIdentifier("VisitorIdentifier");

{% endtab %}

{% tab title="Xamarin" %}

SetVisitorIdentifier - C#

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 %}