Brainstorming, the calculation of the number of effective visits, how do we all do?

Source: Internet
Author: User
For example, a person to the same article constantly refreshed, this can not be counted as effective. My idea is that when the user first browse the article, save a Cookie,cookie in the ID of the article, the validity of one hours, if the same hour, the user access to the article, if the cookie exists is not recorded. I do not know that people do not have more high-end, friendly statistical methods.

Reply content:

For example, a person to the same article constantly refreshed, this can not be counted as effective. My idea is that when the user first browse the article, save a Cookie,cookie in the ID of the article, the validity of one hours, if the same hour, the user access to the article, if the cookie exists is not recorded. I do not know that people do not have more high-end, friendly statistical methods.

Browsing records are best recorded by logging and then analyzed by log, with the benefit of asynchrony.

Log records user Id,url, Access time. Then simply go and redo the statistics.

Login User: User id+log+ time judgment
User not logged in: Client ip+log+ time judgment
Cookie is also good, if you want to save resources directly CNZZ statistics, Baidu statistics

Cookie recording is not appropriate, will cause the request HTTP header is too large, modern browser can be stored on the client with local storage, to determine if there is an article ID and then count the request

This statistic is given to CNZZ, Baidu statistics, Google statistics and other third-party statistical platform Bar.
View volume, single page views, single page views, old visitors, new visitors, etc. can be counted, the presentation is also very friendly.
Data export is also possible.

Can adopt bitmap thought: Each article corresponds to a bitmap, each UID corresponds to an offset in the bitmap, a UID accesses this article, the UID corresponding offset is set to 1. This will not have the problem of duplicate access, and there is a ready-made method to calculate the number of bits with a value of 1. If the amount of website visits is not very large, each article corresponding to the bitmap for 128*128 enough. This is a bit simple, the downside may be that there is a waste of resources.

Make a record of your own events.

Client:
Detects a cookie, does not randomly generate one as the customer ID (UID), and sets the time-out to a very long ....
JS sends a request to the event logging server, Parameters: Timestamp uid eventName eventvalue
EventName is the event name, such as Postvisit
Eventvalue are event values, such as <帖子id>

Service side:
1. Record events to file, can be a file by time such as 10 minutes
2. Write a script timed (10 minutes) Process the event log file, calculate the post traffic according to Eventname,eventvalue, and then update the corresponding field in the database (accumulate)

Free combination Eventname,eventvalue can do a variety of event statistics

Take a look, asynchronous request, with bloomfilter background judgment:
User login with User ID, user not logged in, use Ip+ua or other to generate user ID
There is a collection of bloomfilter in the background to determine if there is already

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.