Skip to content
PromotEdge International

Home Guides Server-side tracking setup

Guides · Guide

Server-side tracking setup with GA4 and GTM

Server-side tagging sends your measurement data through a server you control before it reaches Google and other tools. This guide follows Google's documentation: what it is, the steps, the hosting and the consent and privacy rules to check.

Reviewed by Benjamin SardarUpdated 12 Nov 20266 min read

The short answer

How do you set up server-side tracking with GA4 and GTM?

Create a server container in Google Tag Manager, host a tagging server (Google documents Cloud Run, App Engine and manual set-up), serve it from your own domain, send data to it from the Google tag on your pages, add tags in the server container, wire in consent mode, then test in preview before going live.

Key takeaways
  • Server-side tagging moves tag firing from the visitor's browser to a server you control.
  • Google documents a preview server and a tagging server, with a minimum of two instances recommended for the live one.
  • Hosting has a cost. Google's own Cloud Run estimate is about $45 a month per server, so check it for your traffic.
  • Server-side tagging does not remove the need for consent where the law requires it.
  • Test in preview, compare numbers with your old setup, and keep a billing alert on.

Need this done for your business? A person reads every message and replies.

Ask for a call back

Server-side tagging: steps and checks

Print it and tick each step off.

Our own checklist. Hosting and consent facts are from Google's documentation, read 12 November 2026. Not legal advice.
StepWhat to doCheck
1. PlanList events, tools and data that must not leave your controlA written event list exists
2. HostCreate the server container; choose Cloud Run, App Engine or manual set-upA preview server and a tagging server with at least two instances
3. DomainServe the container from your own subdomainThe container URL is on your domain
4. SendSend data from the Google tag; allow the URL in your CSPRequests reach the container
5. TagsAdd server tags one at a time; remove browser duplicatesNo event is counted twice
6. ConsentSet consent mode defaults and updates; connect your consent toolData respects each visitor's choice
7. TestPreview, compare, test consent states and failuresNumbers explained; billing alert set

In ordinary tagging, each tool's code runs in the visitor's browser. In server-side tagging, the browser sends one stream of data to your server container, and the container sends it on to the tools you choose.

This guide is general. It says nothing about any site of ours, and it is not legal advice.

What is server-side tagging?

Google's server-side tagging overview describes it as a way to instrument your tags to measure user activity wherever it happens. Server containers use the same tag, trigger and variable model as web containers, and Google lists page speed, privacy controls and data quality among the reasons to use them. It says to reap all the benefits you should set up your own domain for the server. The setup builds on our GA4 setup checklist, which covers the basics first.

Do you need it?

Not every site does. It adds a server to run and pay for, and more to maintain. It can help when you run many tags and want control over what leaves your site, when page speed matters, or when you want to send the same events to several tools. For a small site with a few tags, a clean GA4 setup may be enough. Decide from the problem you are solving, not from a trend.

Step 1: Plan what you measure

List the events you need, such as page views, form submissions, calls and purchases, and the tools that should receive them. Check your current tags and remove the ones you do not use. Decide which data must not leave your control. This plan is the same whether tags run in the browser or on a server. Our analytics page covers tracking plans.

Step 2: Create the server container and host it

In Google Tag Manager, create a server container. Google says you can set up a tagging server using Google Cloud or a platform of your choice, and lists three set-up guides: Cloud Run, App Engine and manual set-up. Its Cloud Run guide says you can provision the service automatically in Tag Manager or manually in Google Cloud, describes a preview server for the preview feature and a tagging server for live traffic, and recommends a minimum of two instances to reduce the risk of data loss in a server outage.

The same guide estimates that each server costs approximately $45 a month in US dollars, for one vCPU and 0.5 GB of memory under always-allocated pricing, links to Cloud Run's pricing page and the Google Cloud pricing calculator, and recommends setting a billing alert. That is Google's own estimate, not a price of ours, and your cost depends on your traffic. Check it before you commit.

Step 3: Serve it from your own domain

Point a subdomain of your own site, such as a name under your domain, at the tagging server, and use that address as the server container URL. Google's overview says setting up your own domain is needed to reap all the benefits. Follow Google's guide for your hosting choice, and keep the certificate and DNS records under your control.

Step 4: Send data to the server container

Google's guide to sending data says you can route data through a server-side implementation via Tag Manager or gtag.js, and recommends using the Google Analytics tag on a web page to send data to the server container. The Google Analytics client is pre-installed in the server container by default. If your site uses a content security policy, allow your server container URL in the img-src and connect-src directives for measurement requests and in frame-src for the service worker, and make sure X-Frame-Options does not block iframes from that URL. Follow Google's guide for the exact tag settings in your version of the tools.

Step 5: Add tags in the server container

In the server container, add the tags that forward events to the tools you chose, with triggers that decide when they fire and variables for the data each needs. Start with Google Analytics, then add others one at a time. Remove duplicate tags from the browser so events are not counted twice. Keep a written list of which events go where.

Step 6: Wire in consent

Server-side tagging does not by itself decide whether you may collect data. Google's consent mode guide says consent mode can be implemented in a basic or advanced way, and names four consent types: ad_storage, analytics_storage, ad_user_data and ad_personalization. You set defaults before measurement runs, with the default command on every page, and call the update command when a visitor makes a choice. The guide says consent mode does not save consent choices, so your consent tool has to, and that if you use a consent management platform, it obtains the consent. The two newer types were added in consent mode v2 in November 2023.

Your consent tool and your tags must agree: if a visitor has not agreed to a purpose, your server container should not send data for it. Test this with a fresh browser.

What do the privacy rules say?

Rules depend on where your visitors are. This is general information, not legal advice. In Canada, the Office of the Privacy Commissioner's guidelines for meaningful consent (date modified 11 August 2025) set out seven guiding principles, including emphasizing key elements, giving people clear options to say yes or no, making consent a dynamic and ongoing process, and being ready to demonstrate compliance. In California, the Attorney General's CCPA page (updated 28 August 2026) lists rights to know, delete, correct, limit use of sensitive information and opt out of the sale or sharing of personal information, and says covered businesses must honor the Global Privacy Control as a valid request to stop sale or sharing.

Other places have their own rules, including the EU. Ask a lawyer which apply to your visitors, and record your decisions.

Step 7: Test before going live

  • Use preview mode to see each request arrive at the server container and each tag fire.
  • Compare numbers with your existing setup for a period, to see differences and explain them.
  • Test consent states: accepted, rejected and no choice yet. Confirm the right data is sent in each.
  • Check speed: page load should not get worse.
  • Check failures: what happens if the tagging server is down? Plan for it.
  • Set a billing alert and review hosting cost after the first month.

What goes wrong?

  • Double counting, because the same event fires from the browser and the server.
  • Missing consent checks, so data flows for purposes a visitor declined.
  • Blocked requests, because a content security policy does not allow the server container URL.
  • An under-provisioned server, which can lose data in an outage. Google recommends at least two instances.
  • Unwatched cost, because nobody set a billing alert.
  • No owner, so nobody updates tags when tools or rules change.

Conclusion

Server-side tagging gives you more control over what leaves your site, at the price of a server to run and a setup to maintain. Plan the events, host and secure the container, send data from the Google tag, add server tags one at a time, wire in consent and test hard.

PromotEdge International is an international strategy, technology, marketing and design company, and our delivery team is in India. This guide is not legal advice. See our analytics page.

Facts we rely on: see our company facts for what we state about ourselves and where each fact comes from.

Common questions

  • Server-side tracking sends measurement data from the visitor's browser to a server container you control, which then forwards it to the tools you choose. Google describes server-side tagging as a way to instrument your tags to measure user activity wherever it happens.

  • Create a server container, host a tagging server, serve it from your own domain, send data from the Google tag on your pages, add tags in the server container, connect consent mode and test in preview. Google documents Cloud Run, App Engine and manual hosting set-up.

  • Google's Cloud Run guide estimates about $45 a month in US dollars per server, for one vCPU and 0.5 GB of memory, and recommends two instances for the live server. That is Google's estimate, so check Cloud Run pricing for your traffic and set a billing alert.

  • No. It changes where tags run, not whether you may collect data. Google's consent mode guide says consent mode does not save consent choices, so your consent tool must. Ask a lawyer which privacy rules apply to your visitors.

  • Google's overview says to reap all the benefits of server-side tagging you should set up your own domain for the server. In practice you point a subdomain of your site at the tagging server and use that address as the server container URL.

  • Use preview mode to watch requests reach the server container and tags fire, compare numbers with your old setup, test accepted, rejected and undecided consent states, check page speed and failure behavior, and keep a billing alert on during the first month.

Brands we have worked with

  • Fine Organics
  • Weichai
  • Novozymes
  • Dozco
  • SANY
  • Prezent
  • Honest AI
  • SCENNE
  • Sara International
  • Vega MPS
  • Desi Machine Pvt. Ltd.

Work delivered from India. Results are shared one to one, under NDA.

See all clients

Talk to us

Tell us what you need

We use these details only to reply to you.

Phone or WhatsApp (optional)
Who is it for? (optional)

Rather talk now?

How we work

  1. 01

    Tell us the goal

    A rough note through the form on what you sell and what needs to change.

  2. 02

    We study your market

    How people find you today, where inquiries get lost, then a call in your working day.

  3. 03

    A written plan

    The work, who does it and how it is measured. Nothing starts until you approve it.

  4. 04

    The work starts

    Our team in India does the work, with calls set in your working hours.

  5. 05

    Reports and visits

    Every number we report shows its source and date range, and we travel to our clients every 3 to 4 months.

Chat with us