Unit 7: Online data security · User data tracking

Article

Search history, cookies and tracking

8 min read

You search for "football boots" once. For the next hour, every site you visit shows football boots. Did the sites talk to each other? In a way, yes. To see how, you need two ideas: your history is recorded, and small files called cookies help sites recognise you.

Your history is recorded

Search engines and websites keep a record of what you do on them.

  • A search history is the list of what you searched for and which results you clicked.
  • A browsing history is the list of pages you visited. Your browser keeps this one on your device, so you can find a page again.
  • A website or search engine also keeps its own records on its own computers. You cannot see all of them, and clearing your browser does not clear them.
BenefitCost
Better suggestions while you typeA record of your interests, worries and habits
Results that match your language and placeTargeted adverts that follow you around
Recommendations you likeData that can be shared, sold or leaked
"Continue where you left off"A profile of you, including private things

What you search for can say a lot about you: your health, your money, your feelings. That is why a history linked to you is personal data.

Check your understanding

Which is a benefit of a search engine keeping your search history?

Cookies

The Web has a problem. In Unit 2 you saw that a browser sends a request and the server sends a reply. Each request stands alone, so the server does not remember who asked before. A cookie fixes that.

A cookie is a small text file that a website asks your browser to store. It holds a short piece of data, often just an ID code. The browser sends it back to the same site on every later request.

How a site remembers you

  1. 1

    Browser → Shop website

    Please send the home page

  2. 2

    Shop website → Browser

    The page, and please store cookie id=7K2

  3. The browser saves the cookie in a small file.
  4. 3

    Browser → Shop website

    Please send my basket, here is cookie id=7K2

  5. The shop looks up id=7K2 and finds your basket.
  6. 4

    Shop website → Browser

    Here is your basket with 2 items

The cookie holds only the ID. Your basket is kept on the shop's computer.

Cookies are useful:

  • staying logged in while you move between pages
  • keeping items in a shopping basket
  • remembering settings, such as language or dark mode

A cookie is text, not a program. By itself it cannot run code or carry a virus.

Cookies that track you across sites

A first-party cookie is set by the site you are visiting. A third-party cookie is set by another company whose content is built into the page, such as an advert or a counter.

One ad company, two sites

Your browserNews siteBoot shopAd company
Both pages contain an advert from the same ad company. Your browser contacts it each time and sends the same cookie, so the company sees that one browser visited both sites.

The ad company learns which sites you visit and builds a profile. This is why you see boots on a news site. Some browsers now block third-party cookies, and sites have other ways to recognise a visitor, such as a login. Many sites show a cookie banner that asks you to accept or refuse non-essential cookies.

Private browsing and clearing cookies

ActionWhat it doesWhat it does not do
Private browsing windowWhen you close it, the browser forgets that session's history and cookies. Someone else using the device cannot see where you went.It does not hide you from the websites you visit, your Internet provider, or the school or work network. Logging in still tells a site who you are. Downloads and bookmarks stay.
Clearing cookiesDeletes the cookie files from your browser. Sites forget you, so you are logged out and baskets are empty.It does not delete what a site already saved on its own computers, or a search history saved in your account.

Check your understanding

Which statement about a private browsing window is true?

Worked example

Ana visited a boot shop yesterday and put two boots in her basket. Today the site says "Welcome back" and the basket still has them. Why?

  1. On her first visit the shop sent her browser a cookie with an ID.
  2. The browser stored it.
  3. Today the browser sent the cookie with its request.
  4. The shop looked up the ID and found Ana's basket.

If she clears her cookies and visits again, her browser has no ID to send, so the shop treats her as a new visitor.

Common mistakes

  • Thinking cookies are viruses or programs. They are small text files.
  • Thinking all cookies are bad. Logins and baskets need them. The worry is tracking across sites.
  • Thinking private browsing makes you invisible. It only stops your own device keeping a record.
  • Thinking clearing cookies deletes all data about you. The sites keep what they recorded.
  • Thinking that deleting your browser history deletes the search engine's record. Those are two different records.
  • Thinking a cookie holds your whole profile. It usually holds just an ID. The profile is on the company's computers.

On the exam

A typical question asks you to match a benefit and a risk of cookies or history. Benefit: remembered settings, staying logged in, personalised results. Risk: tracking, profiles, targeted adverts, data shared or leaked. You may also see "Which statement about private browsing is true?" The safe answer is about your own device keeping no record. Any answer that says it hides you from the website or the Internet provider is wrong.

Key words

Search history: a record of what you searched for and clicked.

Browsing history: the list of pages your browser has visited.

Cookie: a small text file a website stores in your browser to recognise you later.

First-party cookie: a cookie set by the site you are visiting.

Third-party cookie: a cookie set by another company whose content is on that page.

Tracking: following what a person does across pages or sites.

Private browsing: a browser mode that does not keep history or cookies on your device after you close it.

AP® is a trademark registered by the College Board, which is not affiliated with, and does not endorse, this site. All lessons and questions here are written by JrCodex.