Home >Backend Development >PHP Tutorial >javascript - How to set fake page views? And you can't let people see it?
I want to make a fake pageview and display it on the page. The database randomly generates a fake data field, and all randomness is fine. But if what was just uploaded cannot be random, that would be too fake. Currently, it is delayed by one day based on time. But if there are many uploads in one day, and the number of views is all in single digits, how can we reasonably solve this problem? The problem? Suggestions for better solutions are welcome?
I want to make a fake pageview and display it on the page. The database randomly generates a fake data field, and all randomness is fine. But if what was just uploaded cannot be random, that would be too fake. Currently, it is postponed by one day based on time. But if there are many uploads in one day, and the views are all in single digits, how can we reasonably solve this problem? The problem? Any suggestions for better solutions are welcome?
Write a random increment function script. For example, the number of views is 1 at the beginning, and then add a rand within 20 at a certain time (in hours), and loop.
Normal situation:
One click -> One click
Basic cheating:
Click -> A certain number of clicks within the [a, b] range
Intermediate cheating:
[a, b] is a dynamic range, linked to the current total clicks and release time
I once did something similar. The nature of the work was that the website I was on posted some things for the leaders to see for publicity. For performance evaluation, the simplest way is to attract clicks and readings.
But how to make the fake look real? First of all, the most basic point is that the number of clicks follows the law of communication. It is not high at the beginning, but the change will be steeper later.
I wrote a script to record the IDs of recently published articles. Because the date is inherently increasing, I used the date as the base and added some seed, and the formula came out.
Of course, we also need to limit the number of days. I made it 7 days, otherwise the long report and dozens of days of visits would be too hot.
Since we don’t have the function to filter daily growth, there is only a total number, so it’s quite easy to do it.
If you must do this, the random incrementing number will be generated in the background, and the front desk will just display it
Now that the random number field has been designed, it’s no big deal to generate random views when publishing an article! As long as the value you set is not too high, it doesn't matter. You still worry about browsing users seeing it. You have to believe that I am in charge of my website and I will do whatever I want.
Every time a user clicks and the page views +1 is needed, just add a random number, as long as it’s not too exaggerated
In fact, there are two variables, one is the real number of views, and the other is the number of days. As long as these two are combined, a reasonable weight is given.
I don’t understand what this sentence means
Currently, it is postponed by one day according to time, but if there are many uploads in one day, the number of views will be single digits
Give me two suggestions
First, add them randomly when the user browses. This method will look fake when the user refreshes the page multiple times.
2. Create a scheduled task and run the code to increase the number of views every once in a while.
You can increase it more according to the probability, such as 1/10 probability of increasing 100 visits.
You can judge based on the creation time, after how many minutes
|hours
|days
have exceeded the creation time, the God mode will be turned on. As for how to make the numbers beautiful, that is a mathematical problem.
PS: There are many execution methods, such as scheduled tasks, message mechanisms, judging execution in requests, etc.
Just "p" is the fastest