Stape
Contact salesTry for free

How to set up GA4 server-side tracking

Ira Holubovska

Ira Holubovska

Author
Updated
Sep 19, 2025
Published
Nov 12, 2020
Also available in

In this blog post, you will explore some advanced features of Google Analytics 4 and compare two methods to configure server-side GA4 - using Google Tag Manager and Stape Gateway. You will learn how to make it resistant to AdBlockers and tracking restrictions with the help of Stape Custom Loader power-up.

Introduction to server-side tracking

Server-side tracking collects data from a website or app by sending it to a server. The server processes and sends the data to Google Analytics. This approach offers several benefits, including improved data accuracy, enhanced data protection, and better performance. Businesses that want to reduce the impact of client-side tracking on page loading speed while still collecting valuable data benefit from server-side tracking.

Unlike client-side tracking, where data is collected and processed directly on the user’s device, server-side tracking shifts the data collection and processing to a server. This improves data security and ensures that the data collected is more accurate.

By implementing server-side tracking, businesses can gain deeper insights into user behavior, optimize their marketing strategies, and comply with data privacy regulations. 

How server-side tracking works
How server-side tracking works

Server-side tracking has many benefits, including a prolonged cookie lifetime, increased tracking accuracy, improved page speed, better data security, bypassing ad blockers and ITPs, and many more. 

Overview of Stape Gateway and server GTM container

Server GTM container is a tool used to set up server-side tracking. With its help, you can configure tracking for Google Analytics 4, server-side Google Ads tracking, and various other platforms on the server side.

Stape Gateway is another data tracking tool that eases the setup of server-side tracking for GA4 and Google Ads. How does it work? It captures data from the user's browser and sends it to a server.

How Stape Gateway works
How Stape Gateway works

What's in common for both?

Both the server GTM container and the Stape Gateway are used to track and collect data on the server side. Each of them provides enhanced data quality and protection. Each approach includes setting up a custom domain and a Custom Loader that help achieve the following benefits:

  • More accurate data collection compared to client-side tracking;
  • Higher data security and control;
  • Lower impact of ad blockers and browser restrictions on data quality.

What's the difference between Stape Gateway and server GTM container setup?

Verstability

Stape Gateway can be used for Google Analytics and/or Google Ads (for conversion tracking and remarketing), while the server GTM container is more versatile and can be set up for a wide range of platforms.

Setup prerequisites

To start using Stape Gateway, you only need a configured web Google Tag Manager container. For server GTM, the setup prerequisites are a bit more complicated - besides the web GTM container, you will also need to set up a server Google Tag Manager container.

Configuration complexity

Stape Gateway is easier to set up as it consists of three steps:

Given the greater flexibility of server GTM, it requires more technical skills to set up. Besides registration, adding a custom domain and Custom Loader, you will also need to create a server GTM container and do additional configurations based on the platforms you use. 

Stape offers a wide range of power-ups, tags, variables, and clients to make configuration easier for you.

Stape Gateway vs. Server GTM container setup: comparison table

For your convenience, we provide a comparison table to highlight the main differences between the two ways of setting up server-side tracking:

Stape GatewayServer GTM container
Setup complexityEasier to set up; you only need to have a web GTM containerMore complex configuration, you need web and server GTM containers
Ability to set up server-side tracking for other platformsSetup is possible only for GA4 and Google AdsMore flexible, enabling setup for various platforms
Price10$/month for each domain or 100$/month for up to 20 domainsDepends on the number of requests, check the calculator to see the price for your website

What tracking method should I choose?

Although the final result is similar for Stape Gateway and the GTM server container, each may work better for different cases.

Choose the server GTM implementation if you:

✅ Want to improve data quality for Google Analytics, Google Ads, and/or any other platform;

✅ Need to set up complicated tracking infrastructure that involves various platforms and analytics tools;

✅ Have a higher marketing budget and can invest in high-quality data tracking.*

*Please note: If your website doesn't have high traffic volume, you can use Stape for server-side tagging for free. To see whether it's your case, check our pricing page.

Choose Stape Gateway if you:

✅ Need to enhance data quality for Google Analytics and/or Google Ads;

✅ Look for a quick and hassle-free way to improve the data you get;

✅ Have a lower marketing budget and need a cheaper solution.

If the Stape Gateway looks like a great option for you, check our setup guide to start using it. In this article, we focus on the configuration process for the server GTM.

If you want to reduce reliance on browser cookies while keeping the server-side benefits, consider GA4 cookieless methods alongside the step-by-step server GTM setup below.

How to set up GA4 server-side tracking using server GTM

Advanced GA4 Features

1. Event-driven data model

The event-driven data model allows you to create an event for any website activity you want to record inside GA4. You can also use parameters that add more value and description to each event. Google prepared the list of recommended event names to use inside GA4, but you can also create custom events and custom parameters.

2. Cross-device reporting

When it comes to traffic and sales analysis, cross-device user/conversion tracking is the main point. Let’s say a user saw your Adwords ad on the mobile and clicked on it. For some reason, they decided to proceed with the checkout on the desktop. The user, however, did not log into any of the Google services. So, Google cannot recognize them and give credit to that particular Adwords click. As a result, the conversion source is lost, and the information for Adwords optimization is incomplete.

To solve this problem, Google released Signals. Google integrated Signals functionality into GA4 and added machine learning. It is designed to identify users who are not logged into any Google services. Machine learning fills all the gaps if a user is not logged into the Google services or their device cannot be identified via fingerprinting. 

By default, Google signals data collection is not enabled inside GA4. You need to enable it manually by going into Settings → click Data SettingsData Collection.

Another essential setting (and a new one) that you should consider checking is how GA4 identifies users.

They have two options:

  • by device only
  • by user-id, Google Signals, then device

3. Predefined events

Google identified the most commonly used events that marketers and business owners track inside Google Analytics and GTM and added them to the enhanced measurement functionality. 

Now, page views, scrolls, outbound link clicks, site searches, video engagement, and file downloads are tracked by default. 

This feature is typically enabled for all GA4 properties. But you need to ensure it’s turned on for your account. To do that, go to Data Streams → choose Webstream details, and check if all events are enabled.

4. Analysis Hub and integration with BigQuery 

Google completely redesigned the analytics/reporting hub inside GA4. It allows users to create pivots, tables, and filters easily. There is also a template gallery, similar to what they have in DataStudio. So you will be able to analyze data more efficiently and spend less time creating custom reports.

BigQuery export is available to all GA4 users. In a nutshell, you can export GA4 data to BigQuery, which can be integrated with other sources like your CRM.

5. Limit of Custom dimension and Custom metric

In GA4, the limit of custom dimensions and metrics increased. Google Analytics 4 allows to have 25 user scoped, and 50 events scoped custom dimensions. Custom metrics increased to 50. An increased number of custom metrics and dimensions gives more flexibility for the customization of GA4.

6. GA4 debug view

The GA4 debugger is extremely helpful for people setting up Google Analytics 4. The enabled preview lets you see what events, event properties, and user data GA4 processes. It makes configuring GA4 much faster and easier.

In addition, for smoother GA4 property management, you can use the GA4 MCP Server from Stape. It lets you write requests in simple, natural language while your AI agent handles the work for you.

7. Other advantages

You might be already tired of reading about why GA4 is so cool. So here’s a quick round-up of other benefits: audience evaluation based on their probability of buying in the next several days, a combination of web and app analytics, and lots more.

GA4 server-side tracking: real Stape users' problems solved

1. In this thread, a user setting up GA4 server-side tracking for a multilingual SPA wasn’t sure whether to keep multiple GA4 properties or move to a single one with market parameters. The clarification was that from a GTM server-side perspective, both approaches work the same - the server container simply inherits what comes from the client-side setup. The decision should be based on reporting and maintenance needs, since custom dimensions don’t appear in all GA4 reports. The takeaway: choose the GA4 property structure that best fits your analytics strategy, not server-side limitations.

2. In this thread, a user tried to send GA4 events only from the server, without using client-side GA4 or cookies. The problem was that GA4 relies heavily on client-side data (like client_id and browser signals collected by gtag.js), so full server-only tracking isn’t practical. The conclusion was that GA4 works best with a hybrid setup - client-side GA4 for core data and server-side tracking for selected events - while fully server-side analytics is better handled by tools built for it, like Matomo or Piwik.

3. In this thread, a user compared GA4 server-side tracking with client-side GA4 and noticed large data gaps in events and revenue. The issue wasn’t a tracking error, but a misleading comparison - GA4 isn’t designed to run multiple properties in parallel (client-side and server-side). Server-side GA4 acts as a proxy and doesn’t change the data by default, so comparing properties leads to inconsistent results. The recommended solution was to use a proper migration approach (JS-managed cookies → server-managed cookies) or GA4 roll-up properties, instead of running parallel setups.

4. A user noticed that running GA4 server-side tracking alongside the client-side setup caused inflated “direct/none” and “not set” metrics, even with identical GA4 property settings. In the full thread, the explanation was that parallel use of server-side and client-side GA4 often leads to discrepancies, as server-side acts as a proxy. The recommended approach is to use server-side tracking carefully, avoiding parallel properties, or consider GA4 Rollup properties for proper aggregation.

5. A common question when implementing GA4 server-side tracking is whether data is being sent twice and if separate streams or properties are needed. In this case, the issue came from confusion around parallel client-side and server-side GA4 setup. The clarification: GA4 server-side tagging works as a proxy - data should be sent once from the browser to the server container, and then forwarded to GA4.

You should not send events directly from both browser and server in parallel, as GA4 does not handle deduplication. If events appear to fire twice, it usually means there’s an extra gtag snippet or duplicate setup in the web container. The fix is to use a single GA4 web tag with server_container_urlcorrectly configured, remove duplicate tags, and let the server container forward data to GA4.

Conclusion

GA4 and GTM server tagging was created to fit current world tracking rules, web technologies, restrictions, and data security. You’ll need time to get used to the new interface and features and understand how they can better suit your website and business needs. In the long run, server-side tracking in Google Analytics 4 can significantly improve data accuracy and give you greater control over what data is collected and how it's shared with third-party platforms.

If migrating to the GA4 and GTM server containers is complex or you realize that you need assistance, feel free to contact us. We can answer your questions and help you make sure your Google Analytics 4 server-side tracking is implemented correctly, efficiently, and is aligned with your goals.

author

Ira Holubovska

Author

Ira has 10+ years of digital marketing experience, with the last 5 focused on server-side tracking. She understands how and when it works across various digital marketing scenarios.

Comments

Try Stape for all things server-side