About how to determine whether the user focus on public methods, wrote an article before WeChat determine whether in small programs focus on the public, this method is very simple, but the product manager to think this way the user experience is very poor, optimization, when heard him say so, the in the mind in the pentium ten thousand grass mud horse, but again how, still want to hold up the code to change.

Later want to a kind of method, is to enable the public server configuration, listening attention or take off events, storage database, listening to the users, the database tag the user has concerned, listening to the user to take off, the database field to mark whether the user attention did not concern, so check this field to the front, The front end can know whether the current login user is concerned about the public number, pop up to guide the user to pay attention to the prompt. This implementation is also quite troublesome, but it is better than the previous experience, but also more real-time monitoring of the user’s attention to take off the action. Well, after using this for a period of time, the product manager came to me again and said that the function should be optimized. Hearing this, I almost threw the water I just drank in his face. In fact, I didn’t accidentally spit the water in his face on purpose.

What is the rationale for this optimization? Product manager said, the current approach only to this function after going to come in the user attention to take off effective, that before those users, clearly already concerned about the old, now into our application will pop out prompt to pay attention to the public number, and have to take off again, and then pay attention to it will take effect, so not good.

How to say, before the change and he said when I was in before the user will have the problem, have to take a close attention to again, because the code is added after listening to the event, that before this that have focused on the user didn’t listen to what they like, naturally can not be in the database tag is concerned. Anyway, the product manager often cheat, this is no exception, threw down two words, “continue to optimize”, and walked.

Next, the point comes, after observation, there is actually a simpler way to solve the problem of poor experience, and historical data does not monitor whether to pay attention to the problem. That is the initialization of the time to see whether the user has a unionID, if there is, that is concerned, if not, that is not concerned or take off. This is very real-time, no matter when you are concerned about it, or after paying attention to take off, the difference is there is no unionId. Check if the user has a unionId and it has a value in the initialized interface. Will wechat return the unionId field? The premise is that the small program and the public number are bound to the same wechat open platform. If there is a better way welcome to give advice oh, say it together.