What are cookies and third-party cookies?

Source: Internet
Author: User
Tags website server
ArticleDirectory
    • What is the role of cookie in website analysis?
    • Cookie technical details
    • Conclusion

Before reading the specific text description, the following is a brief introduction of cookies from Weibo:

The following describes cookie details:

Cookie is a small piece of data stored on the client. Generally, in order to improve user experience, a website stores historical user information in the client to provide more convenient and targeted services when users access the website again. For example, a website can remember your logon status. You do not need to log on to the website the next time you log on. Shopping Network can remember the products you browsed and keep the items in your shopping cart. All of these are cookies.

What is the role of cookie in website analysis?

Website analysis is based on data, and data collection requires the help of website analysis tools. Mainstream website analysis tools are classified into two types: log and page script. One difference between the two types of tools is that they are very sensitive to unique visitor. When the website has many access records, how can we determine the access to the same user. A log-type analysis tool is generally used to determine the source IP address of the access, and the access through the same IP address is considered to be the same user. Page scripting analysis tools are used to determine whether different accesses come to different users based on cookie records. These tools are stored in cookies to identify unique user IDs. The IDS obtained by each browser are different. During user access, check the ID in the cookie. access with the same ID is considered to be the same user. Otherwise, access is performed by different users.
The judgment of unique visitor is very important for website analysis, so that other information stored by analysis tools in cookies is not so important. Unique visitor is not just a metric. More importantly, unique visitor associates events that span multiple accesses. Imagine a visitor who came to the website through an advertisement did not make any purchase before the visit, but added the website URL to the bookmarks. After a few days, the visitor clicked bookmarks, visited our website, and finally bought some products. At this time, if there is no unique visitor to associate, there is no association between the click advertisement and the purchase of goods. We cannot know the contribution of the advertisement clicked by the visitor to the final purchase. We can see how important cookies are to website analysis. Through cookies, you can concatenate events during multiple accesses.

Cookie technical details
    • How does cookie work?

      For example, we visited a website and came to the login page. On the page, you need to enter the user name and password. At the same time, there is an option called "keep my logon status". If you have entered the user name, password. In order to come to this website next time, we don't need to re-enter it. We have activated the retained status option. Finally, click Submit. At this time, our browser will be connected to the website server through the HTTP protocol, submit the content and selection just entered. After the server receives the message, it will determine whether the user name and password are correct. Because we need to keep the status, we need to set the cookie to record the status. The server will include the setcookie command in the header of the returned HTTP packet to tell the browser the cookie to be saved. The browser encrypts the cookie and stores it on the computer. This cookie record is generally the unique ID of the user on this website. Then, every time we access this website (as long as it is still the domain name), when our browser requests data from this website server, A piece of information containing cookie data will be added to the header of the HTTP request packet. For example, the server will be told: "I am your user and my ID is 9527." When the server receives this message, it will no longer prompt logon, And we are logged on.

    • Cookie Lifecycle

      There are two types of cookie lifecycles: one is the entire session and the other is permanent. That is to say, a temporary cookie. If the user closes the browser, the cookie becomes invalid. One is a permanent cookie that can exist continuously. Generally, the website analysis tool determines that unique visitor uses the latter.

 

Differences between the first and third-party cookies

The first-party cookie and third-party cookie are small pieces of data stored on the client. They are all stored by a domain and can only be accessed by this domain. Their difference is not a technical difference, but a method difference. For example, when you access the website www.a.com, a cookie is set for this website. This cookie can only be read by webpages in the domain www.a.com. This is the first cookie. If you still access the www.a.com website, a picture of www. B .com is used in the webpage. When the browser requests an image from www. B .com, www. B .com sets a cookie, therefore, this cookie can only be accessed by the domain www. B .com, but cannot be accessed by the domain www.a.com, because for us, we actually set a cookie in the domain www. B .com when accessing the website www.a.com, so it is called a third-party cookie.

If you haven't gotten dizzy after reading so many of the above, please continue.

    • Advantages and applications of the First-party cookie

The biggest advantage of the First-party cookie is the high acceptance rate. Generally, mainstream browsers have privacy settings, allowing users to set whether to accept or not cookies. Except for not accepting the cookie setting at all, in other cases, the first-party cookie will be accepted by the user (if not accepted, the small data block cannot be saved ). Therefore, if there are no special requirements, the first-party cookie is more accurate than the third-party cookie.

    • Advantages and Applications of third-party cookies

The acceptance rate of third-party cookies is lower than that of the first-party cookies (however, by default, mainstream browsers accept third-party cookies with p3p protocol. In my experience, the acceptance rate can reach 90%, or even more than 95%), but in some specific circumstances, the first-party cookie can be implemented. For example, when a website with multiple domain names needs to be tracked, we want to know that the user clicks an advertisement to go to the webpage under domain name a, and then may be browsed regardless of the domain name, finally, the website under domain name B is registered. An advertisement can be tracked on the webpage under domain name A, while registration can be tracked on the webpage under domain name B. If we use the first-party cookie, we will create a cookie for domain name a and create another cookie for domain name B. They can associate the behavior on the webpage under their respective domain names, but cannot be associated. When a third-party cookie is used, no matter how many domains, there is only one cookie, a cookie belonging to the third-party domain, which can be shared by all domains on the website, all actions can be associated for analysis.

Conclusion

Obtain data using a script-type website analysis tool

      • Cookies are required. We cannot analyze anything when we leave cookies.
      • The first-party Cookie has a high acceptance rate and is more accurate. It can be used without special requirements.
      • Third-party cookies can be used for cross-origin tracking, and can be used for special purposes.

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.