Event tracking lets you track user activities in your application and tie them to the corresponding engagement campaigns or to trigger an in-app notification.

All Analytics/Events related API's are part of WebEngage Android SDK's Analytics Object.

You get an instance of WebEngage Analytics object as follows:

// import WebEngage 'Analytics'
import com.webengage.sdk.android.Analytics;

// Get an instance of `Analytics` object
Analytics weAnalytics = WebEngage.get().analytics();

After WebEngage has been successfully initialized you can track an event by using following apis on Analytics Object:

Event Tracking API

weAnalytics.track(String eventName)

weAnalytics.track(String eventName, Map<String,Object> attributes)
// Allowed data types for map values: `String`, `Integer`, `Long`, `Double`, `Boolean`, `Date`,`List`.
// The `List` itself can contain one of these data types: `String`, `Integer`, `Long`, `Double`, `Boolean`,`Date`

IMPORTANT : None of the event name should start with we_,else they will be ignored. Event name starting with we_ are reserved for WebEngage internal uses.

The upper bounds on attribute name and value(in case of String) are 50 and 1000 chars respectively.Anything beyond that will be truncated.

Events