Blog

30 Days of E-Commerce - Day Eighteen!

Day 18
What are cookies and how are they commonly used on an ecommerce website?

I thought I’d have a look at the cookies on asos.com (I’m using the “Edit my cookie” extension for Chrome)

Screen Shot 2018-05-27 at 19.21.17.png

A lot of stuff in here!
Some of it’s pretty hard to interpret, but a few cookies like:
browseCountry
browseCurrency
browseLanguage

Are pretty easy to recognise and understand.

 Before

Before

 After

After

As an experiment, I tried changing the browseCountry from NZ to AU…

Now it presents me with the asos AU homepage! (hard to prove, but here's some subtle evidence):

Screen Shot 2018-05-29 at 09.02.15.png
Screen Shot 2018-05-29 at 09.02.22.png

===

My shopping bag has one item in it, and there is a cookie called asosbasket.

Screen Shot 2018-05-29 at 08.07.20.png
Screen Shot 2018-05-27 at 19.31.25.png

I thought maybe I could play with that cookie - and change the basketitemcount - but apparently not.
That information must be getting correctly refreshed from the server side.

Screen Shot 2018-05-29 at 08.13.55.png
Screen Shot 2018-05-29 at 08.15.36.png

But I *can* change this value in local storage - and it updates the UI.
(With no real effect, there’s still only one item in my cart - fun to play with though.

This led into an interesting conversation with my team about cookies v local storage, and when you’d use one or the other.
Cookies should be used when the server needs the value for some reason - cookies are sent to the server as part of the web request.
Local storage doesn’t get sent to the server - it’s just for client side work.
The feedback I got was that Local Storage is preferred when there’s nothing to send to the server, because
- there’s a dictionary to work with - cookies you’re just scanning through a giant string
- local storage can hold much more information than a cookie

So - there you go! Not sure I really completed the task, but I learned something so ¯\_(ツ)_/¯

- JE