Analytics
The LikeMinds SDK provides a set of predefined user events that you might want to track for your feed application.
Refer to Analytics Events to see the list of events that are being tracked.
Callback
To receive these analytics events and handle them according to your requirements implement LMFeedCoreCallback
.
While setting up LikeMinds Feed SDK in onCreate()
method of the Application class, extend LMFeedCoreCallback
and pass the instance of the same in LMFeedCore.setup()
.
interface LMFeedCoreCallback{
fun trackEvent(eventName: String, eventProperties: Map<String, String?> = mapOf()) // will be triggered when an event is called.
}
eventName
: Name of the event triggered.eventProperties
: All the properties associated with that particular event.
Example Implementation
- Kotlin
- Java
val application = this
val enablePushNotifications = false
val deviceId = null
val domain = "ENTER YOUR DOMAIN NAME HERE"
val lmFeedCoreCallback = object : LMFeedCoreCallback {
override fun trackEvent(eventName: String, eventProperties: Map<String, String?>) {
// your implementation for analytics
}
}
LMFeedCore.setup(
application = application,
enablePushNotifications = enablePushNotifications,
deviceId = deviceId,
domain = domain,
lmFeedCoreCallback = lmFeedCoreCallback
)
Application application = this; // instance of the application
LMFeedSetThemeRequest feedTheme = null; // instance of the theme
String domain = "ENTER YOUR DOMAIN NAME"; // domain of the app
boolean enablePushNotifications = false; // enable or disable push notifications
String deviceId = null; // device id of the user
LMFeedCoreCallback lmFeedCoreCallback = new LMFeedCoreCallback() {
@Override
public void trackEvent(@NonNull String eventName, @NonNull Map<String, String> eventProperties) {
// your implementation for analytics
}
};
LMFeedCore.INSTANCE.setup(
application,
lmFeedCoreCallback,
feedTheme,
domain,
enablePushNotifications,
deviceId
);