Google Analytics ITP solutions: how to deal with Apple’s ITP 2.1
During spring 2019, Apple rolled out Intelligent Tracking Prevention (ITP) 2.1 to all Safari browsers. This version is limiting your analytics, here’s what Google Analytics ITP solutions you can use to eliminate the impact of ITP 2.1 on your cookies & find out what pros and cons they’re bringing.
Before ITP 2.1, Google Analytics cookies had a default two-year expiration period. After ITP 2.1, the same cookies already expire after seven days. In other words, your Google Analytics will not recognize a returning visitor after seven days. Instead, the returning visitor will be regarded as a new visitor.
Generally, we are always happy to get more new visitors to our websites. It shows us that we’re doing something right. But when the increase in new visitors doesn’t reflect the real increase in new visitors, it provides a false sense of security. Mapping the customer journey is an important step to improving sales and marketing. If Google Analytics cannot recognize a returning visitor, mapping each interaction with the customer will be impossible and, thus, the customer journey will be corrupted by bad data. Answers to questions like:
- ‘Which campaigns did the customer see?’
- ‘How long is the average customer journey?’ and
- ‘How many and which touchpoints does the customer journey hold?’
will hold little value and only reflect the limited data available. Even more importantly, if your future marketing budget is allocated based on these answers, you risk taking some bad decisions that will make you lose money. Moreover, if you know that you cannot trust your data in Google Analytics, you will start making decisions based on gut feeling, which may be equally bad for business.
So, what Google Analytics ITP solutions are there to eliminate the impact of ITP 2.1 on your cookies and regain trust in your data?
Against a lot of claims, there are different approaches existent to circumvent the ITP 2.1 regulations that help you get accurate insights into Google Analytics. However, some solutions require a certain amount of technical changes and come with different benefits and drawbacks.
In general, there are two categories of solutions: local-storage-based solutions and server-side-solutions. Unlike the widespread client-side solution, these two approaches are not affected by ITP 2.1.
Local Storage for same-domain browsing
A trivial solution to store a cookie is using local storage. To store identifiers used by Google Analytics or other Analytics tools, you can create an object in the local storage with window.localStorage.setItem(). Unfortunately, the simplest solution comes with the biggest drawback, as local storage only works for same-origin domains. This means that none of your subdomains can use the same storage. For example, the storage and the stored unique identifier for www.cookiesaver.io is not available for www.tracking.cookiesaver.io
Local Storage for cross-subdomain browsing
The solution is based on a store that needs to be created on one of the subdomains. Web storage is a more secure way of saving application data that also enable storing larger amounts of data locally than in a cookie. This store must be loaded into an iframe, a simple HTML-element. By using the postMessage API, cookie values, you can get and set cookies on the website. Sites related to the same domain request the client ID from the iframe. If a client ID exists, the ID is sent to the requesting site and stored in the local storage for that subdomain. If there is no client ID yet existent, the request gets a notification and creates a client ID, which is then sent to the iframe and stored there. The big advantage of this method is that it enables cross-domain tracking for pages sharing the same parent domain. The drawback is that it requires a lot of programming skills. Furthermore, this “gap” is likely to be closed by Apple soon.
Set-Cookie headers in a server-side script
This solution relies on setting up cookies server-side instead of client-side. When a client requests a website from a server, the cookie is sent from the server with the HTTP response. The cookie is then stored in a local variable. If the HTTP request from the client also includes the cross-domain link parameter, e.g., if it’s important to track across domains for Google Analytics, the local variable, the set-cookie, is overwritten with the unique client ID. If no cookie is existent or the linker does not work, a new client ID is generated.
This way, the cookie expiration date can be set to two years, circumventing the limitation of 7 days. By implementing a viable software solution, you can painlessly prolong the life of your cookies by following a quick step-by-step guide.
Set-Cookie headers in an edge cache
Shared web service referenced with a CNAME record
This solution is based on hosting your content on a third-party domain and not your own. Basically, sending data content to your domain, but delivering from another source. For this to work, an endpoint must be established in a virtual machine. In addition, you build a CNAME record in your DNS and point the tracker.mydomain.com to that respective virtual machine. When the page is requested from a client, the endpoint in the virtual machine is called. This endpoint fetches the cookies from the HTTP headers and sets cookies server-side on mydomain.com. The issue is that this solution increases efforts and computation for the web service sending the HTTP response.
Reverse proxy to third-party service
This solution works similarly to the CNAME redirect, as a reverse proxy can simply hide the origin server of an HTTP response. Even though the logic on how cookies are set stays the same, the implementation of this solution involves more effort compared to the CNAME redirect. Instead of just changing the DNS record and letting external providers do all the hard work, site owners need to create complex server-side logic for the proxy.
Overall, there are several ways to eliminate the impact of Safari’s ITP 2.1 on your Google Analytics data. The existing solutions differ in complexity and bring both advantages and disadvantages related to costs and implementation depending on your current setup.