The Internet and the World Wide Web: Question 4

Syllabus 5.1

Structured 7 marks

A customer browsing the online shop "Camptrail Outdoors" adds a tent and two camping chairs to their basket while looking through several pages of the site, then closes the web browser without buying anything. Two days later, they revisit the site on the same laptop: the basket is now empty, but the site greets them by name and has already selected their preferred tent size from before.

(a) State the type of cookie that would normally be used to keep the tent and chairs in the basket while the customer continued browsing during that first visit. [1]

(b) Explain why this type of cookie no longer has any effect once the customer returns two days later. [2]

(c) State the type of cookie responsible for the site remembering the customer's name and preferred tent size two days later. [1]

(d) Explain how this second type of cookie is able to do this across two separate visits, several days apart. [2]

(e) State one other function, used by websites generally, that this second type of cookie could also be used for at this shop. [1]

Show worked solution Hide worked solution

Worked solution

Keeping items in a basket while a customer moves between pages during one visit is exactly the role of a session cookie: a cookie that exists only for the current browsing session.

Part (b): Why it has no effect two days later

A session cookie is designed to last only as long as the current visit; it is normally deleted automatically once the web browser itself is closed. Because the customer closed the browser after adding the tent and chairs, that session cookie (and the record of what was in the basket) was removed at that point. When the customer returns two days later, there is no session cookie left for the website to read, so the basket appears empty again, as if the visit were starting fresh.

Remembering the customer’s name and preferred tent size across two separate visits, days apart, is the role of a persistent cookie: a cookie that is deliberately kept beyond the end of a single session.

Unlike a session cookie, a persistent cookie is saved as a small file directly on the customer’s own device and is set to stay there for a chosen length of time, rather than being deleted when the browser closes. Each time the customer visits Camptrail Outdoors again within that time, the website can read this stored file and retrieve the information saved in it, in this case the customer’s name and their preferred tent size, allowing the site to display them without the customer having to enter them again.

Part (e): Another function of persistent cookies at this shop

Persistent cookies are also commonly used to store a customer’s login details, so that they can stay signed in on a return visit without having to type their username and password again. (An equally valid answer would be tracking the customer’s general browsing preferences across visits.)

Final answers

  • (a) Session cookie.
  • (b) A session cookie only lasts for the current visit and is deleted when the browser closes, so it no longer exists two days later.
  • (c) Persistent cookie.
  • (d) A persistent cookie is saved as a file on the device and kept beyond the session, so the website can read it again on a later visit.
  • (e) Storing the customer’s login details (or tracking wider browsing preferences).