What is The Role of Cookies in The Ads You Receive on the Web?

This is a post that goes beyond the technical data of cookies. It is intended to clarify the way ads are displayed using cookies on the web using Google as an example.

Image for post
Photo by Negative Space on Pexels

In this post, platform names such as BBC, Google, YouTube, etc. are used as examples. It is not intended to publicize them, nor is there an alliance when creating this post. Website screenshots are also shown for illustrative purposes.

If you are reading this post, surely you have already come across commercial advertisements for the pages you visited before entering another. For example, if you went to see what the Adobe company offers on its website, then seeing YouTube content, you will undoubtedly see a banner or a promotional video from Adobe. The same will happen if, after YouTube, you go to see a post on the British Broadcasting Corporation (BBC) platform. These platforms have spaces where commercial ads will be published. These sites work as ad incubators. If you are wondering, what do these platforms need to select the right ad for you? Here is where cookies come into play. Beyond knowing them as something edible, cookies are computer pieces.

Before describing how cookies work in ads, let me tell you some of their characteristics. Cookies are made up of a name, a content, the domain, and the path where it will live. The name is the unique identifier; the content is sometimes encrypted. Content is the saved value. The domain is the website’s Internet address that hosts the cookie, and the path is the directory within the domain name where the cookie will be allowed. All the information in the cookies is stored in the web browser you use.

Now a little more information for those with a more technical profile. Cookies receive as arguments the name, the value or content, the domain, the path, and lifetime. The only required argument is the name of the cookie. By default, the URL of the website you visit is taken as the domain. The path of the cookie, by default, is the root of the directory. By the way, the cookie has a maximum capacity of 4,096 bytes; therefore, do not try to store a good-quality-image in this one.

At this time, you already have the context to advance in the discovery of cookies.

Cookies can be classified in different ways, but this time the focus will be on third-party cookies for advertising purposes. Third-party cookies are those that are allowed on websites other than the creator of the cookie.

Let me exemplify the above. The BBC website has its cookies to its functionalities are proper and customized; however, it can have cookies from some of Google’s advertising products. If you check the section on allowed cookies for the website, you will find cookies belonging to DoubleClick.net. See the screenshot of my browser that I provide below.

Image for post
Screenchot by the author using Microsoft Edge Browser

Just as the BBC website has Google cookies, other websites contain cookies from Facebook, Microsoft, or any other tool created for advertising purposes.

Now, the cookies are already stored, but what information do they collect to display the ads? Cookies can obtain data on the type of product that you were reviewing, your search criteria in internet search engines, which ad you clicked on, incomplete purchases, the duration of your stay in front of a video, and many more.

Cookies that websites store in web browsers have to be read by the platform that distributes the ads. It doesn’t do much good if they stay in the browser. Now, how are these cookies read? In principle, one website cannot access the cookies of another. So, how is it done? There are agreements between the advertising platforms and partners to allow the reading of cookies and display advertisements when visiting any partner website. This information collection is possible through the use of analytical tools, APIs, or embedded content.

When a website associated with the advertising platform sends a cookie to the browser, the advertising tools read the information sent and match it with information previously collected from your visits to other websites. This information allows it to create a profile with your’s preferences, which is used to show you the most relevant ads.

Let me create an example of the cookie cycle in advertising. If you enter the JetBrains website and check the prices and features of one of your favorite tools but leave it without making the purchase, JetBrains will send a cookie with the information of your actions on its website to Google. Then, when you go to see content on YouTube (this is a Google product), it will be able to access the information of the cookies previously sent by JetBrains, and it will look for the most relevant ads to show you. It is highly likely that some of the first ads you see are from JetBrains.

I followed the cycle that I described above, and the third ad YouTube showed me was one from JetBrains showing me its PhpStorm product. Indeed, the Internet Address I visited was www.jetbrains.com/phpstorm/.

By now, you already know, in general terms, how cookies work on the Internet and the advertisements you see on each website. If you want to learn more about the operation of cookies, stay tuned for my next publications, or consult the Google page only as a general reference for cookies treatment.

Note that many advertising platforms, advertisers, and partners go into action to sell you their products or services. Cookies facilitate the transfer of valuable and sensitive information.

I want to finish this post by inviting you to pay attention to the information you provide when you use any tool to surf the Internet.


Written by

I am photography passionate. I write fiction about the interaction between humans, animals, and objects. My impossible love is programming. | IG: eva_perlop

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store