As a website owner, you certainly use Google Analytics to learn more about the user’s behavior on your website. Probably you are familiar with the different Google Analytics reports and you consult them on a daily basis. But do you know how exactly Google Analytics collects data?
You have probably heard that Google Analytics relies on cookies to remember and to record a users’ behavior on a website. But what are cookies?
Continue reading this article to learn how exactly Google Analytics works and collects its data.
What is Google Analytics?
In other words, almost all the data you see in your GA account comes from the cookies.
What is a cookie?
A cookie is a small text file that a website places on a visitor’s browser. It’s a string of text characters (not bigger than 4 KB) that might look like the following:
“max-age=60; path=/; domain=velizaratellalyan.com”
Cookies are used by websites to remember and store the information about your visit. Each cookie contains the following data:
- A name-value pairs containing the actual data
- An expiry date after which the cookies will no longer be valid
- The domain and path of the server it should be sent to
For example, the below-mentioned cookie has 3 variables and one value for each variable:
- max-age, which is set to 60 – that’s the time in seconds the cookie will last;
- path, which is set to the “/”, – that’s the web page directory for which the cookie is valid. In this example, the cookie is set to the root of the web directory (“/”), which means that it is valid for the entire website.
- domain, which is set to “velizaratellalyan.com”, – this is the sub-domain for which the cookie is valid.
But a cookie can have many more variables (including user name, password,
language) which store different user preferences.
And every cookie has its own ID (a combination of letters and numbers) that allows its identification.
As soon as you request a page from a server to which a cookie should be sent, the cookie is added to the HTTP header.
Server-side programs can then read out the information and apply the setting from the cookie to the page you’ve requested.
So every time you visit the website the cookie comes from, information about you is already available: you won’t have to re-type your password or to set up your preferred language again. Most of the cookies, however, don’t store personal information (name, phone number).
So that’s how cookies are used by websites (and search engines) to improve user’s experience and to simplify your navigation on the Web.
What different types of cookies websites use?
There are two different types of cookies.
- First party cookies are issued by the website being visited and the web browser. They allow the communication between this website and the browser back and forward. Only the website which issued the first party cookie can read it.
- Third-party cookies are sent to your browser by third-party websites (different from the website being visited). These websites are usually ad serving companies that use third-party cookies to remember what ads have already appeared on your browser. The cookies allow the ad serving website to deliver your ads relevant to your interests and to control the number of times you visualized a specific ad on your browser.
Why Google Analytics needs cookies?
Google Analytics also uses a set of cookies to collect information about
website users’ behavior and to report website usage statistics.
What types of cookies does Google Analytics use?
The only third-party cookie that it uses is the DoubleClick cookie.
This cookie is set up by modifying the GA’s tracking code and it is used by websites that run re-marketing and display advertising campaigns. Thanks to the DoubleClick cookie the website is able to serve its ads on different Google properties (like Google Search) and across the web.
Throughout this yummy article, you learned what cookies are and how GA uses them to collect information. If you want to learn more about the exact type of cookies that Google Analytics sets, you can read my next entry to learn which first-party cookies are set by Google Analytics.
I am a digital marketing consultant and SEO expert based in Hong Kong. With a track record spanning over 11 years, I have helped numerous clients from China, Europe, and around the globe achieve results. In my blog, I share my experience and proven methods in SEO, PPC, and digital marketing strategies.