Digital Communication and Web Technologies · Cambridge syllabus 5.1 · Lesson 1 of 1
Cookies and Web Tracking
Cookies are small pieces of data a website asks the browser to store and send back on later visits. They save personal details, track preferences, hold the items in a shopping cart and store login details. A session cookie is deleted when the browser is closed; a persistent cookie is kept until its expiry date or until the user deletes it.
By the end, you can
- Understand what cookies are used for.
- Explain how cookies can store information about users.
- Discuss benefits and privacy concerns associated with cookies.
- Distinguish session cookies from persistent cookies.
Cookies
A cookie is a small file of data that a website stores on the visitor’s computer through the browser. It is sent back to that site with every later request, which is how a site recognises a returning visitor. Cookies are used to save personal details, track user preferences, hold the items in an online shopping cart and store login details.
Cookies exist because HTTP is stateless: each request is independent and carries no memory of the last. Without something to carry an identity between requests, a shopping basket would empty on every page and a login would have to be repeated constantly. The cookie usually holds nothing more than an identifier, and the real information is held on the server against that identifier.
There are two kinds named in the syllabus. A session cookie is temporary: it is stored only while the browser is open and is deleted when the browser is closed, and it is what keeps a shopping cart or a login while a user moves around a site. A persistent cookie is stored on the computer until its expiry date or until the user deletes it, so it survives the browser being closed, which is how preferences, a language choice or a remembered login are kept between visits.
The benefits are genuine: staying logged in, keeping a basket, remembering settings, and letting a site measure which pages are used.
The concern is privacy. Persistent cookies can record which pages a person visits, so a profile of their interests can be built up and used to target adverts, sometimes by organisations other than the site being visited. That is why websites ask for consent before setting cookies that are not essential, and why users can delete cookies or block them in the browser.
Worth remembering
- A small file of data stored by a site and sent back on every later request.
- Used for personal details, preferences, shopping carts and login details.
- Session cookies are deleted when the browser closes; persistent ones are kept.
- Tracking browsing to build a profile is the privacy concern.
Worked example
A shopping basket that empties when the browser is closed uses a session cookie; a site that still remembers your language choice a month later uses a persistent cookie.
Practice
Warm-up · not marked
Check your understanding
Answer in your own words, then compare with the worked answer. Nothing here is saved or scored.
Worked answer
They can remember preferences or sessions; tracking across visits can build a profile of activity.
Check your method, units and explanation against it.
Marked practice
Set 1 of 4 · easiest first · Checked as you go, with the worked answer. Sign in or create a free account to save your progress.