How to enable personalised feed?
Introduction
In this guide, you'll learn how to enable and configure a personalized feed for users in your Android app using the LikeMinds Feed Android SDK. A personalized feed helps enhance user engagement by tailoring the content they see based on their preferences, interactions, and other metrics.
Prerequisites
Before you begin, ensure the following
- LikeMinds Feed Android SDK: The SDK must be properly installed and initialized in your Android project. Refer to the Installation Guide.
- Basic knowledge of Postman or equivalent API testing tools.
Steps to enable Personalised Feed
Step 1: Enable Personalised Feed Setting
- Open your LikeMinds Admin Dashboard.
- Navigate to Feed Settings
- Enable "Personalised Feed" Settings.
Step 2: Set weigths for different metrics
- Initiate a user session: Authenticated API calls to the LikeMinds backend require an authorization token. This token can be generated using this Getting Started Guide. Make sure to log in with the Community Manager's credentials.
- Configure weights on different metrics: The personalized feed relies on various metrics such as likes, comments, recency, and user interactions. Set the weights for these metrics using the following cURL request:
curl --location --request PATCH 'https://auth.likeminds.community/community/configurations' \
--header 'Content-Type: application/json' \
--header 'Authorization: {cm_access_token}' \
--data '{
"description": "Personalised feed weights metadata for the community",
"type": "personalised_feed_weights",
"value": {
"comments_metrics": {
"max_threshold": 200,
"weight": 10
},
"likes_metrics": {
"max_threshold": 100,
"weight": 5
},
"post_dampening_metrics": {
"max_threshold": 100,
"weight": 5
},
"recency_metrics": {
"max_threshold": 100,
"weight": 5
},
"user_groups_metrics": {
"max_threshold": 50,
"weight": 2
},
"user_topics_metrics": {
"max_threshold": 100,
"weight": 5
},
"user_connection_metrics": {
"max_threshold": 100,
"weight": 5
}
}
}'
info
The sample values in the cURL are subjective in nature, please change it as per your user group.
Step 3: Configure in Android Feed SDK
In the last step of Getting Started Guide, send feedType
as LMFeedType.PERSONALISED_FEED
in getInstance()
functions of the Fragments.
- Social Feed
- Video Feed
- QnA Feed
- Kotlin
- Java
// pass this successCallback to LMFeedCore.showFeed()
val successCallback = { response : UserResponse? ->
// inflate social feed fragment in your activity
val containerViewId = R.id.frame_layout
val fragment = LMFeedSocialFeedFragment.getInstance(LMFeedType.PERSONALISED_FEED)
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(containerViewId, fragment, containerViewId.toString())
transaction.commit()
Unit
} // callback triggered when the initiate user call is successful
// pass this callback to LMFeedCore.showFeed()
(UserResponse response) -> {
// callback triggered when the initiate user call is successful
try {
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout, new LMFeedSocialFeedFragment.getInstance(LMFeedType.PERSONALISED_FEED))).commit();
} catch (Exception e) {
throw new RuntimeException(e);
}
// callback triggered when the initiate user call is successful, write your logic here
return null;
}
- Kotlin
- Java
// pass this successCallback to LMFeedCore.showFeed()
val successCallback = { response : UserResponse? ->
// inflate video feed fragment in your activity
val containerViewId = R.id.frame_layout
val fragment = LMFeedVideoFeedFragment.getInstance(LMFeedType.PERSONALISED_FEED)
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(containerViewId, fragment, containerViewId.toString())
transaction.commit()
Unit
} // callback triggered when the initiate user call is successful
// pass this callback to LMFeedCore.showFeed()
(UserResponse response) -> {
// callback triggered when the initiate user call is successful
try {
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout, new LMFeedVideoFeedFragment.getInstance(LMFeedType.PERSONALISED_FEED, null)).commit();
} catch (Exception e) {
throw new RuntimeException(e);
}
// callback triggered when the initiate user call is successful, write your logic here
return null;
}
- Kotlin
- Java
// pass this successCallback to LMFeedCore.showFeed()
val successCallback = { response : UserResponse? ->
// inflate qna feed fragment in your activity
val containerViewId = R.id.frame_layout
val fragment = LMFeedQnAFeedFragment.getInstance(LMFeedType.PERSONALISED_FEED)
val transaction = supportFragmentManager.beginTransaction()
transaction.replace(containerViewId, fragment, containerViewId.toString())
transaction.commit()
Unit
} // callback triggered when the initiate user call is successful
// pass this callback to LMFeedCore.showFeed()
(UserResponse response) -> {
// callback triggered when the initiate user call is successful
try {
getSupportFragmentManager().beginTransaction().replace(R.id.frame_layout, new LMFeedQnAFeedFragment.getInstance(LMFeedType.PERSONALISED_FEED)).commit();
} catch (Exception e) {
throw new RuntimeException(e);
}
// callback triggered when the initiate user call is successful, write your logic here
return null;
}