Custom ranking of social media posts

How to build a custom post ranking algorithm

Italo Orihuela
Italo Orihuela
Aug 28, 2023

In the dynamic landscape of social media, displaying the most engaging posts is crucial for maintaining and enhancing user engagement. This tutorial will guide you through the complexities of custom post-ranking algorithms, specifically using Amity Social Cloud. We will delve into a smarter ranking system that factors in user engagement, post timing, and updates, thereby improving the visibility and interaction of posts significantly. Additionally, we'll discuss how to tailor this ranking logic to meet your specific needs.

However, we will also highlight the current limitations of this system and provide guidance on navigating them. Prepare for an enlightening exploration into the world of custom post-ranking algorithms.


Before we dive into the details, it’s important to understand the basic requirements for implementing a custom post-ranking algorithm:

  • Familiarity with the concept of post ranking and its importance in social media platforms.
  • Basic understanding of mathematical formulas and how they can be used to calculate post scores.
  • Access to an Amity App instance.

Understanding Global Feed

Before entering into the details of custom post-ranking algorithms, it’s important to understand what a Global Feed is. In the context of Amity Social Cloud SDK, a Global Feed aggregates both User and Community feeds, providing a comprehensive view of all relevant content in the user’s network. This feed ensures that users can stay up-to-date with all the latest content and conversations in their network, promoting engagement and participation in the community.

Step 1: Understanding the Factors

The first step in understanding custom post-ranking algorithms is understanding the factors that influence post-ranking. These include:

  • Engagement rate: Posts with more comments and reactions will rank higher than those with less.
  • Time of posting: Newer posts will rank higher than older ones. A time decay is applied where the score decreases as the post gets older.
  • Updates: Any updates or edits to a post will give it a score boost. This includes new comments and reactions.

Step 2: The Mathematical Formulas

The next step is understanding how these factors are quantified using mathematical formulas. The properties used in these formulas include:

  • `commentsCount`: The number of comments on the post.
  • `reactionsCount`: The number of reactions to the post.
  • `createdAt`: The date/time the post was created.
  • `updatedAt`: The date/time the post was updated.
  • `editedAt`: The date/time the post was edited.

To illustrate how these factors might change the ranking, consider the following scenarios:

  • A post with a high number of comments and reactions will rank higher than a post with fewer interactions, even if the latter is newer.
  • A post that is frequently updated or edited will maintain a higher ranking over time, compared to a post that remains static.
  • A post with a high engagement rate but older creation time may still rank higher than a newer post with less engagement.

Step 3: Configuring the Ranking Logic

Once you understand the factors and how they’re quantified, you can configure the ranking logic to suit your specific needs. This could include adding more factors such as post type, post creator, etc. To do this, you would need to contact Amity Social Cloud Support to review the ranking logic and apply it to the code accordingly.

Step 4: Navigating the Limitations

While the custom post-ranking algorithm offers many benefits, it’s important to be aware of its limitations. These include:

  • There may be a momentary delay in the appearance of newly created posts on the Global Feed.
  • The inability to update the ranking formula via the Amity Social Cloud console.
  • See up to 20 posts from each user or community that you are following in the global feed.
  • The fact that old post data will not be migrated, meaning only posts using version 5.10 will show in the global feed.

Final Thoughts

Understanding how custom post-ranking algorithms work can significantly enhance user engagement on your social media platform. By considering the factors that influence post ranking and how to configure the ranking logic, you can create a more engaging and interactive user experience. However, it’s important to be aware of the current limitations and to stay updated on future developments in this area. With the right knowledge and tools, Amity’s custom post-ranking algorithm will help you drive user engagement and growth on your platform.