How to track that a user visited the site each day for X days?

后端 未结 5 945
情深已故
情深已故 2021-02-04 16:41

There is a new badge on Stack Overflow. The \"woot\" badge is awarded to users visited the site each day for 30 days. How can you implement a feature like this? How can you trac

5条回答
  •  太阳男子
    2021-02-04 17:21

    If this is the only thing you want to log, then maybe that's a good solution. However, I like to keep logic and the logging separate, both to increase the amount of raw information at my disposal, as well as allow tweaking of logic without breaking existing data.

    In this case, I would log every visit or every action (depending on requirements/space/etc), and then write a sproc or a method somewhere which inspected the data and returned true (matches criteria for badge) or false (doesn't match criteria).

    The only case where I would create a specific schema to hold information like that was if the calculations required took far too long, either because of the amount of data or the complexity thereof.

提交回复
热议问题