First of all, sessions and cookies have a common role of storing information! This is the cause of my disappointment ...
First of all, a cookie is a file that you have in your browser. There are various types such as chrome and firefox.
For example, login information is also saved in the browser using cookies. Advertising is easy to understand afterwards! !!
I've been reading various Qiita articles about changing jobs recently, so this kind of advertisement is displayed. It uses features such as third-party cookies to display suitable ads from that person's cookie information!
If you feel that your browser is heavy, you may want to review the cookie cache as well, as it can cause chrome to slow down if the cookie cache accumulates too much! https://www.webhack.jp/web-service/google-chrome%E3%81%8C%E9%81%85%E3%81%84%EF%BC%81%E9%87%8D%E3%81%84%EF%BC%81%E5%8E%9F%E5%9B%A0%E3%81%A8%E8%A7%A3%E6%B1%BA%E6%96%B9%E6%B3%95-%E9%AB%98%E9%80%9F%E5%8C%96%E3%81%AE%E8%A3%8F%E6%8A%80/#i-3
Session stores information on the server much more than cookies store information in the browser! Often, login information etc. is saved on the server! Keep information on the server and share it across multiple pages!
For example, if you log in as Mr. A, you can edit Mr. A's data when you access the user edit page, right? This is because the session remembers your login information!
After that, even if the products added to the cart are on other pages, such as shopping sites, the record remains. This also uses session. However, basically session loses its information when the browser is closed.
Compared to cookies, it is more secure because it stores information in the server information.
・ Storage location cookie → browser session → server
・ Storage capacity cookie → There is an upper limit (it also causes the browser to become heavy) session → almost no upper limit
・ Security cookie → dangerous Less dangerous than session → cookie