A few years ago installing Google Analytics was simple: one script on the page and every visit showed up in reports. Today the picture is different. Many people use ad blockers, Safari and Firefox shorten the life of tracking cookies, and some browsers refuse to contact well-known analytics domains at all. As a result, reported visits and sales are noticeably lower than reality. Server-side tracking is an approach that closes part of that gap.
Why browser-based tracking loses data
In the classic setup the visitor's browser sends every event directly to google-analytics.com, googletagmanager.com or an ad network. Blockers know these domains and drop the requests. Cookies written by JavaScript may also be deleted after a few days in some browsers, so a customer who returns a week later counts as a new visitor. Flaky mobile connections and pages closed too quickly lose events as well. For a Tashkent electronics store spending heavily on Google Ads, this means the algorithm sees only part of the conversions and optimises campaigns on incomplete signals.
How server-side tracking works
Instead of a third-party domain, the browser sends data to a subdomain of the site itself, for example sgtm.example.uz, running on a server you control. That server receives the request, strips unnecessary or sensitive fields and forwards the data to GA4, Google Ads, Meta and other platforms. To the browser it is a first-party request, so most blockers ignore it. The most common tool is the Google Tag Manager server container, which can run in Google Cloud or on your own server with Docker.
- More events arrive: first-party requests are blocked less often, though never with a full guarantee.
- Data control: IP addresses, phone numbers or emails can be removed or hashed before reaching third parties.
- Cost: you need a server, updates, monitoring and specialist time.
Running the server container on a VPS
Create a container of type "Server" in Tag Manager, choose manual provisioning and copy the container config string. Google recommends a tagging server plus a separate preview server:
docker run -d --name sgtm-preview -p 8081:8080 \
-e CONTAINER_CONFIG='CONFIG_STRING' \
-e RUN_AS_PREVIEW_SERVER=true \
gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
docker run -d --name sgtm -p 8080:8080 \
-e CONTAINER_CONFIG='CONFIG_STRING' \
-e PREVIEW_SERVER_URL='https://preview.example.uz' \
gcr.io/cloud-tagging-10302018/gtm-cloud-image:stable
Point A records for both subdomains to the VPS (in the sayt.uz cabinet this is done in the domain's DNS section), then put Nginx in front as a reverse proxy:
server {
listen 443 ssl;
server_name sgtm.example.uz;
ssl_certificate /etc/letsencrypt/live/sgtm.example.uz/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/sgtm.example.uz/privkey.pem;
location / {
proxy_pass http://127.0.0.1:8080;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
Get certificates with certbot --nginx -d sgtm.example.uz -d preview.example.uz, add a similar block for preview on port 8081, set the "Tagging server URL" in the container settings and point the GA4 tag in the web container to it.
Sending a purchase event when payment is confirmed
The most reliable conversion data comes from your backend, not the browser. When Click or Payme confirms a payment, your server receives a callback, and that is the moment to send a purchase event through the GA4 Measurement Protocol. The conversion is recorded even if the buyer closed the payment page:
curl -X POST "https://www.google-analytics.com/mp/collect?measurement_id=G-XXXXXXX&api_secret=SECRET_KEY" \
-H "Content-Type: application/json" \
-d '{"client_id":"1234567.7654321","events":[{"name":"purchase","params":{"transaction_id":"T-1001","value":250000,"currency":"UZS"}}]}'
Read the client_id from the _ga cookie during the visit and store it with the order, so the server event links back to the original session and ad source. Create the api_secret in the GA4 data stream settings and never expose it in browser code.
Consent still applies
Server-side tracking gets past blockers, but it is not a way around user choice. If a visitor declined analytics in the cookie banner, the server must not forward their data either; a properly built setup passes consent state from the web container to the server container. Uzbekistan has personal data legislation, and European rules may apply if you serve EU customers, so confirm specific obligations with a lawyer. Also remember that no method gives perfect numbers: the goal is data reliable enough for decisions.
Who needs it now
A small business card site or a low-traffic blog does not need a server container; standard GA4 and Search Console are enough. Businesses that pay for ads every month and take online payments benefit quickly. The easiest first step is sending purchase events from the server on payment confirmation, then moving to a full server container on a VPS once traffic grows.