Stape
Search
Try for free

Cookieless tracking methods: compared and explained

Published
Sep 24, 2024

Previously, Google announced that they would stop supporting third-party cookies in 2024, and some time ago, they changed the strategy - instead, the company plans to present a new solution: a one-time prompt that allows users to set their preferences. Nevertheless, all the hype around cookies made some people look for cookieless tracking solutions to track and store data.

So, we will review and compare the most popular methods of cookieless tracking (server-side tracking, data layer, local and session storage). We will consider what cases each works for, their advantages and disadvantages.

3 reasons to switch to cookieless tracking and stop losing data

Tracking cookies

Three factors cause the need to switch to cookieless tracking from third-party cookies: ad blockers, browser restrictions, and stricter data privacy regulations. All these restrictions affect the quality of data you can gather, and cookieless solutions turn out to be a more effective way to track user behavior.

Ad blockers

Ad blockers aimed at removing annoying ads on the page can also affect the tracking scripts of Google Tag Manager or Google Analytics. That means if a user has an ad blocker turned on, the scripts won't run, the tags won't fire (if you use GTM), and you will lose the user's data.

Browser restrictions

Browsers like Safari and Firefox apply restrictions for the use of third-party cookies. For example, Safari caps cookie lifetimes to 7 days for responses from third-party IP addresses. This leads to a drop in the data collected and a decrease in the number of recorded conversions. As a result, it is difficult to evaluate your marketing efforts.

Data privacy regulations

The General Data Protection Regulation (GDPR) and the California Consumer Privacy Act (CCPA) are privacy regulation laws that are aimed at creating rules on processing data. They give more control over the data users share with website owners. Besides, your website can be hidden from search engines if you don't comply with the regulations.

Cookieless tracking methods explained

Server-side tracking: secure and precise data tracking

The benefit of server-side tracking is that all users' data is sent firstly to the server and then transferred to tracking platforms (like Google Tag Manager) and third-party vendors (e.g., Google Analytics). Such data processing and distribution methods help bypass ad blockers and browser restrictions. Server-side tracking also helps comply with GDPR and CCPA regulations.

How server-side tracking works

Another benefit of server-side tracking is the higher control over collected data, as all the data is processed on your own servers rather than handled on the client side (users' browsers). Unlike client-side methods such as Local and Session storage, this approach offers enhanced security, making it a better choice for managing sensitive information.

How to start using server-side tracking

Firstly, you need to choose a hosting provider for the server GTM container. One popular option is using the Google Cloud Platform. We recommend considering Stape as a hosting provider and solution hub for server GTM. Stape has many advantages over GCP, which businesses of all sizes and types can benefit from.

StapeGoogle Cloud Platform
Free plan  for 10,000 requests per monthPrice starts at $120/month
Wide range of plans for high-traffic websites to avoid overpaying ($20 - $300/month)For websites with higher traffic, the price can increase to $240-$300 per month
No additional costs if you have a paid planLogs will cost an additional $100 for 500,000 requests
Variety of solutions for sGTM (power-ups, tags, variables)

Secondly, you need to create and configure a server-side container. If you have already used web GTM, you probably won’t face difficulties setting it up as the interface and functions are similar.

Then you can add any solutions, and power-ups and set up any tracking you need for your business.

Data layer: effective real-time data storage

The data layer as a cookieless solution works for cases when you need to collect lightweight data (like UTM-parameters data) that doesn't require extra security. Otherwise, we recommend using server-side tracking, which is better for large datasets and sensitive data.

The data layer is a method for temporarily storing real-time data. When a user visits your website, you can capture data from them and temporarily store it in the data layer. This happens before consent is granted. After the user's content (clicking on cookie consent banners), you transfer data to analytics tools like Google Analytics 4.

Using a data layer for cookieless tracking has a disadvantage compared to server-side tracking or local storage - the data is stored as long as the session runs. However, the data gathered can be accessed by tags and scripts you use.

How to start using the data layer

You need to initialize the data layer (if it doesn't exist yet).

Related: End-to-end guide on data layer in Google Tag Manager - you will find this article useful if you haven't worked with the data layer yet.

Then, you need to set up capturing data (let's say, UTM parameters from URL) and temporarily store them in the data layer you created. Once the user grants consent (like a trigger), the script should find the necessary data and transfer it to the analytics tool.

You need to write the script independently or ask a developer to do it.

Session storage: for specific data within a session

Session storage is a good method if you want to collect data that will be stored only for the duration of the session. Such type of data includes page views or button clicks.

One advantage of session storage is high privacy; the data is cleared once the user stops a session. However, this feature prevents you from storing data for a long time, like with server-side tracking or local storage.

How to start using session storage

The web storage API lets you interact with the browser's session storage. To apply this method, you need to use a script. The JavaScript code should first retrieve or initialize the count of some event (e.g., page view or click to a button), then increment the event count and store it in session storage.

Local storage: track persistent data across sessions

Unlike session storage, local storage can track and store data across multiple sessions. However, it is better to use this method for non-sensitive data.

Local storage is usually used to track and store data like page language or layout to determine user preferences on your website, track the number of transactions, or count events (clicks, page views). It is also an effective way to find out the number of returning users (with the help of a User ID); such a feature can be useful if you build brand recognition.

How to start using local storage

Local storage, like session storage, is part of the web storage API, so you can interact with it using the API. The flow is similar to session storage; with local storage, you need to use the script to gather and store data locally.

Comparison of cookieless tracking methods by criteria

For your convenience, we list below the comparison of each method by the most important criteria while choosing a cookieless solution.

Server-side trackingData layerSession storageLocal storage
Use casesStore sensitive data for a long timeReal-time data storageTrack and temporary store events (page views, clicks)Track events persistently
Data durabilityAs long as needed (depends on server configuration)As long as the user is on the pageAs long as a session runsUntil data is cleared manually
Data size limitsNo limitsIt is not fixed, but it is used for small datasets5 MB per origin5 MB per origin
LocationServer-side (a server that you own and control)Client-side (client’s browser)Client-side (client’s browser)Client-side (client’s browser)
SecurityThe most secure compared to other methodsVulnerable to client-side attacks (e.g. Cross-Scripting)Vulnerable to client-side attacks (e.g. Cross-Scripting)Vulnerable to client-side attacks (e.g. Cross-Scripting)

Conclusion

Cookieless tracking offers the ability to bypass numerous restrictions on collecting data and analyzing users' online behavior. These include bypassing ad blockers and browser restrictions and complying with GDPR and CCPA regulations.

There are several methods for setting up cookieless tracking: server-side tracking, using a data layer, session storage, or local storage. Each has advantages and limitations.

Here is a quick recap:

  • Server-side tracking is best for long-term storage of sensitive data. This method is the most secure, and you will have the highest control over stored and gathered data.
  • Data layer stores real-time data (like gathering UTM parameters).
  • Session storage will collect data and store it while the session is running. This method is best if you want to track some events (page views, clicks)
  • Local storage is similar to session storage, but local storage can store data across multiple sessions. It is often used to track returning users.

Host your GTM server at Staperight now!