Stape
Search
Try for free

Google’s first-party mode vs. server-side tracking

Published
Dec 18, 2024

After Google released its new feature called first-party mode, a lot of questions arose about its advantages and differences compared to server-side tracking. At first glance, both look pretty similar. So, in this article, we will review the first-party mode as a tracking method, explain how it works, and whether you will benefit from such a setup.

What is first-party mode?

The first-part mode is the feature released by Google that allows you to deploy Google tags using your infrastructure. Your infrastructure is servers/systems supporting data rerouting that belongs to you. Below, we consider what own infrastructure means in the context of first-party mode.

This way, you can avoid interacting with Google’s domains (such as https://www.googletagmanager.com/) when fetching measurement libraries and tracking users’ behavior on your website. First-party mode allows website owners to interact with Google's services through their own domain.

How does it work?

While setting up first-party mode, you specify the URL path, aka a subfolder (e.g., https://www.yourdomain.com/tracking) to load the Google tag. When someone interacts with your website (clicks a button, scrolls, etc.), the request will be made to that path.

Then, your Content Delivery Network (CDN), loader balancer, or web server forwards this request to Google services like GA4.

Difference between standard, first-party mode, and first-party serving setup

The difference lies in how the requests are proceeded:

  • With the standard Google tag setups, when a user interacts with your websites (https://www.yourdomain.com/), the requests are sent to Google Tag Manager (https://www.googletagmanager.com/). With such a setup, the tracking scripts are run in the user's browser, with drawbacks such as lower data security and less effective data collection affected by browsers and ad blockers.
  • First-party mode uses a kind of subfolder within your website's domain. So, instead of sending requests to Google Tag Manager (https://www.googletagmanager.com/), they are routed to this subfolder (let's say the subfolder is "/tracking", so it looks like https://www.yourdomain.com/tracking).
  • Unlike first-party mode, first-party serving uses a custom domain instead of a subfolder. In this way, the requests are sent to your custom domain, for example, https://www.load.gtm.yourdomain.com/.

First-party mode vs server-side tracking

First-party mode isn't an innovative solution for data tracking. If you use server-side tracking and have configured it with the same-origin custom domain in server GTM, you already use a similar to first-party mode setup. Let's dive into detail to see the difference between tracking methods.

Reduction of ad blockers impact

At first glance, it looks like both first-party mode and server-side tracking are equally effective in reducing the impact of ad blockers, as both send the requests to the tag serving path (in the case with first-party mode) or the custom domain (in the case with server-side tracking).

However, the first-party mode's ability to deal with the ad blockers' impact is lower since the ad blockers are constantly improving, and some of them can already block the requests if the path or query parameters contain specific values that point out data tracking.

Find out more on how you can avoid blocking GTM in our another article.

Control over data

Forwarding traffic through a service you control (CDN, load balancer) as in first-party mode provides additional control. You can set up removing some data from the request, such as the user's IP address, but unlike with server-side tracking, you can't set up some conditions for such removal.

Server-side tracking provides a higher level of control in this matter. You can configure the setup to help comply with data protection regulations.

Scaling

First-party mode is a suitable solution if you use only GA4 and Google Ads for tracking. But in case you also use other platforms like Meta, TikTok, Snapchat, Klaviyo, etc., it is better to choose a server-side tracking setup to get precise data. After switching to server GTM, you can have a signal from GA4 and use it to send data to any other platforms or set up server tracking for each platform in the future.

Price

First-party mode is the cheaper option, as you can continue with your web GTM setup that doesn't cost a dollar. But it has some pitfalls. For example, if you set up first-party mode with the help of Cloudflare, you need to have an expensive Enterprise subscription.

Server-side tracking may seem expensive; however, if you have fewer than 10,000 requests per month, you can have it for free with Stape. In addition, hosting on Stape is cheaper than directly on the Google Cloud Platform, which can save you money.

What do you need to set up Google's first-party mode?

You need to have the following for the setup:

  • Configured Google tag or Tag Manager container.
  • Website infrastructure that can reroute requests and modify their headers. It can be a CDN, load balancer, or proxy server.

How to set up Google first-party mode?

Google documentation provides detailed instructions on setting up first-party mode using Google Cloud, Cloudflare, or other CDN/load balancers. Below, we consider the setup in a nutshell and take Cloudflare as an example.

Step 1. Come up with a tag serving path

Choose the specific URL path that will load the Google Tag. It can be "/tracking", "/metrics", "/analytics" or any other word.

!

Note

To avoid conflicts, make sure the path isn't used for any other purpose on your website.

Step 2. Set up data routing

!

Note

To use Cloudflare for this setup, you must have an Enterprise subscription.

In the example with Cloudflare, you need to:

2.1 Go to DNS section → Records → Add record. Add the following configurations:

Type: CNAME

Name: fps

Target: <your GTM ID>.fps.goog

Add record

2.2 In the tab Origin → Origin rules, create a rule and name it "Route measurement" to make sure that the request is routed to Google after it comes to your tag serving path.

Add rule

Step 3: Update Google Tag scripts

Replace the scripts with new ones on every website page to enable loading Google tags from your serving path instead of from https://www.googletagmanager.com/.

Step 4: Test the setup

To test whether everything works, run preview mode and trigger events on your website. If everything works correctly in the "Hit Details", you should see the tag serving path you created in the first step.

Preview mode in GTM

Conclusion

First-party mode isn't a new solution in the world of data tracking; you could have a similar one with the help of a same-origin custom domain in server GTM. The main benefit of first-party mode setup is its price (if you use Google Cloud instead of Cloudflare, which requires an Enterprise subscription). However, in other criteria (such as resistance against ad blockers, data security, and control over data), server-side tracking is a winner.

Try Stape for all things server-sideright now!