Does Google work with Cookies and Web Storage?

Print Friendly, PDF & Email
Cookies are small fractions of space that sites use to store user-specific info in user browsers. So that servers would know that a returning user is not a new one. That's how you remain logged in after you leave a website and come back later. Cookies is the link between your previous and next sessions. Web storage is cookies evolved. Cookies have lots of tecnical issues we're not gonna discuss now, but Web storage aims to fix them.

Why would it matter in SEO?

As you may know, developers tend to choose the shortest way to implement the functionality ordered by business. Even though employers now tend to look for developers who know about SEO, it doesn't help. They still wouldn't consider SEO during the development. Cookie-based redirection. A french user hits the site, the site determines the IP geolocation and redirects the user to the /fr/ version, setting something like "loc=fr" in cookies. Now if this user tries to hit any non /fr/ page, they will be redirected to the proper /fr/ page unless they change the language manually, in which case their cookie will be overwritten with the new value. And the redirections continue. Doesn't look very well from the UX/UI perspective, but it works ok. The problems start when Google hits the site. Since Google uses cookies, it gets all the effect normal users do. And so when Google tries to index other language pages, it gets redirected to the previous page, indicating non existence of other pages to Google. But does Google use cookies or doesn't? Let's experiment.

Does Google use Cookies?

To test it we will have a simple JS snippet that sets a cookie and then checks if the cookie is set. If it's set, the code will inject some hardly related text in a span below (if you use cookies, you will see it): I know, I know. Conducting such an experiment on only one page is not enough and I partially agree. Yes, it is interesting how Google carries cookies from one page to another. It's just I watch G webmastertools hangouts And they discussed it recently, revealing the fact that G carries cookies through one crawling session, but not between the sessions, which is exactly what you would expect from G. Okay, now that we left the cookie-based output in that h3, we can experiment with the web storage a little.

Does Google use Web Storage?

The approach will be similar: we'll have a tiny bit of JS that sets it on the fly and then checks if it's set. Below: Okay, I must say working with web storage is a lot more pleasant than parsing through cookies. I want to express my gratitude to those who came up with the technology and implemented it. Looks like we're done. We set the cookies and webstorage. Now let's check if Google sees the related text. Okay, I couldn't wait so I fetched and rendered. Looks like Google does see both. Screenshot of Google's fetch and render results to check if it uses cookies and webstorage We'll wait till it's indexed though. Ok, now it's indexed and ranking. As expected. A screenshot of Google's SERP proving that Google uses Cookies A screenshot of Google's SERP proving that G uses Web-Storage


Googlebot uses both cookies and web-storage.

Leave a Reply

Notify of