Back

get number of views

  • 0
  • Databases
  • Flutter
  • Realtime
  • Cloud
Zionnite
4 Mar, 2024, 08:42

Hey guys, I just build a social app where users can post videos, share image and text, users can like, share and comment on post, but I want a situation to show the numbers of view on a post.

Please how do I achieve this?

TL;DR
Developers are discussing the best way to track views on a post without inflating the count due to duplicity. Options include adding an array attribute in the post document or creating a relation with a separate collection. Managing a growing array size might become challenging. Solution: Consider creating a separate collection for views, ensuring accurate tracking without duplicates.
darShan
4 Mar, 2024, 09:00

Everytime the post comes in to view, check if the currenr user has already "seen" it. If not, add a new item. Incrementing count on every seen would inflate the view count exponentially due to duplicity.

Maybe add an array attribute in the same post document, or create a relation with a collection or a complete separate collection for the same.

An array based attribute could get harder to manage though if the size grows substantially.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more