Home > Article > Backend Development > How to determine whether a user enters a page for the first time?
Question:
Something like a small prompt after updating certain functions or a new user prompt
How to judge whether this user has entered this page for the first time
Is there any good method besides cookies
Solution:
1. I think this problem can be stored in a separate table, because some small functions are likely to be updated in the future, and pop-up information can also be stored in this table.
Second, there is usually a way
1. Save it in localstorage. The disadvantage of this is that users will see it multiple times when they change browsers or computers.
2. Store in the cache, and check whether the prompt corresponding to userId has popped up every time the user logs in.
3. Add one more field to the database membership table. The value defaults to 0. Check whether the field is 0 when logging in. If If yes, change it to 1 (1 means it is not the first time to log in)
Related articles:
Use PHP to determine whether the user is logging in for the first time that day
How to use the PHP website to determine whether the user is accessing from a mobile phone
Use php to determine whether the user follows the WeChat public account