One of the primary reasons why an organization might decide to include a scrollable feed is to increase social engagement or the availability of certain data on a website or mobile application.
What is Ranking?
By default, activities in a Stream Feed are going to be returned in FILO order. That is to say, it is like a stack. However, using Ranking, you can re-order the activities so they are returned from the API in an order that matches the algorithm passed with the GET request.
Documentation can be found here.
Here's a blog post with some common Ranking algorithms.
Ranked feeds are only available on paid plans. Contact support after upgrading your account to enable ranked feeds for your organization.
How to set up a Ranking Algorithm?
Ranking algorithms must be added from the Stream dashboard for a Feed Group.
Now that the algorithm has been added to the Feed Group, you can fetch the feed with the algorithm.
const feed = streamClient.feed("timeline", "steve");
const results = await feed.get({ranking: "popularity"});
A/B Testing with Stream Activity Feeds
Because the same feed type can be fetched with one of any saved ranking algorithm for that feed group (or none at all), it makes it possible to test the engagement of various algorithms and tweak the weights of different algorithms.
Given two different algorithms, Trending and Popularity, we might want to give some of our users one, and some the other.
const user = {
name: "Stephen",
occupation: "Junior Software Engineer",
rankingAlgorithm: "popularity"
}
await streamClient.user("steve").getOrCreate(user);
const feed = streamClient.feed("timeline", "steve");
const results = await feed.get({ranking: user.rankingAlgorithm});
Comments
0 comments
Please sign in to leave a comment.