Google Analytics and Cookies

This article will explain how cookies and Google Analytics work together to make creating loyalty stages possible: and how to make sure they work.

Note: This document relates to Google Analytics Universal, not Google Analytics 4, which tracks information differently than GAU.

 

Overview

Google Analytics tracks your website users by storing a small file called a "cookie" on their devices. Google Analytics uses cookies primarily to distinguish users and to track users across sessions. We recommend modifying the default Google Analytics setting for how long cookies stay active, reducing the period from the 6-month default to just 1 month. This change will enable Metrics for News to track how engaged each user is during 1 month periods.

 

What change do I have to make on my organization's website?

By default, the cookie in Google Analytics that collects session count will expire 6 months after it is created (which was the first time a user on a particular device came to your site before their cookie expired).

To change this setting to 1 month (which we recommend), follow these instructions

 

What does this have to do with loyalty stages in Metrics for News?

Control over cookie expiration dates is integral to all sessions-based segments. Most Metrics for News partners will use sessions-based segments as part of their Path to Conversion dashboard. For example, "Casual Users" may be defined as "Those who came to our website just once in the last month".

In order to ensure that engagement is only measured "in the last month", the cookie expiration date must be set to 1 month. This will ensure that the cookies for each user on each device and browser refresh 1 month after their first session, and the session counter starts over again.

This does not prevent the user from clearing their own cookies before 1 month, but it does ensure that the cookie refreshes at least once a month. 

 

When do cookies expire?

Unless a website actively expires cookies itself, there is no way to know how long a cookie has existed on a user's browser. Users may expire the cookies manually in their browser, or they may be expired by a third-party application, but it is up to an individual website to expire their cookies in a timely manner if that is the desired behavior. 

Google Analytics can expire its own cookies, and by default has different expiration timeframes for each type of cookie that it sets on your website. You can see the expiration timeframes for each cookie type in the GA documentation, but based on how it is set, the default expiration time of a cookie may range from 24 hours to two years.

 

Can you tell me more about cookies?

A cookie, specifically an "HTTP cookie", is a snippet of stored data that a website holds onto when a user leaves their site. Cookies are used across the web for doing any task that requires "remembering" information about a user — log ins, ad preferences, and more. 

By default, cookies are associated with IP addresses -- a unique number attached to a particular device -- which means that they cannot identify the same user on multiple devices or internet browsers (Chrome, IE, Firefox, etc.). 

If your website has an authentication system, like a user log-in, you may use Google's User-ID feature to track users across devices and browsers, but this is a custom implementation.