Skip to main content
All articles
Performance3 min read

Self-hosted server-side tracking: performance, control and operations

Compare managed services, Cloud Run, VPS hosting and custom endpoints for first-party measurement.

By Ralph Heezen

Advertising and analytics scripts add browser work. Their effect depends on tags, page and device. Server-side processing can move part of that work to controlled infrastructure, but it does not eliminate browser collection, consent requirements or all blockers.

Architecture#

In conventional tracking, each provider loads scripts and sends requests. A first-party architecture sends agreed events to an endpoint such as track.your-domain.ch; the server validates and forwards permitted data to relevant destinations.

Potential benefits include fewer third-party scripts, field filtering and consistent event IDs. Measure those benefits rather than assume every conversion will be recovered.

Hosting choices#

These planning ranges are indicative and are not current provider quotes:

OptionPlanning cost/monthEffortSuitable for
Managed SaaSCHF 20–200+LowerMany client sites
Cloud RunCHF 0–10 for small usage, subject to configurationMediumIndividual sites
Existing VPSPotentially no extra server feeMediumAvailable server capacity
Custom endpointPotentially no extra hosting feeHigherA few defined events

Cloud Run#

Create a project, deploy the official tagging image, configure production and preview services as required, establish DNS/routing and TLS, and connect GTM container configuration and web events. Free-tier eligibility depends on requests, compute, region and service configuration; request count alone does not guarantee zero cost.

Existing VPS#

Docker with Traefik or Caddy can operate the tagging service. Verify capacity, TLS, production/preview configuration, updates and backups. A minimal illustrative service:

services:
  sgtm:
    image: gcr.io/cloud-tagging-10302018/gtm-cloud-image
    environment:
      CONTAINER_CONFIG: "${GTM_CONTAINER_CONFIG}"
      RUN_AS_PREVIEW_SERVER: "false"
    restart: unless-stopped

This is an illustration, not a complete production configuration. Networking, secrets, preview routing and access must be configured. Optional platforms such as Coolify, Dokku or CapRover simplify deployment while adding another dependency.

Swiss hosting may support residency needs. Events forwarded to external analytics providers still leave your infrastructure; first-party collection alone does not change this.

Custom application endpoint#

For a limited event set, a Next.js or Node endpoint can validate and forward events without a full tagging container. The conceptual flow is browser event → consent check → schema validation → stable event ID → permitted destination.

navigator.sendBeacon can send non-blocking browser events, including during navigation. Production needs rate limits, validation, secrets, error handling and consent controls; simply forwarding arbitrary JSON is insufficient.

Managed SaaS#

Providers can reduce the operational burden across many sites and supply interfaces for transformations and deduplication. Compare features and actual traffic pricing with the cost of operating your own infrastructure.

The hidden cost: operations#

Self-hosting requires updates, security patches, uptime alerts and server logs. A failed container can silently stop measurement. Compare staff time and response capacity with managed-service fees.

Choosing an approach#

An existing VPS can suit a single SME site with available operations expertise. Managed services can fit agencies operating many containers. Custom endpoints fit narrowly defined events where engineering ownership is available.

Verify after migration#

Compare INP and LCP on representative devices, script weight, event delivery and deduplication, browser/server records, values and currencies, and behaviour before and after consent. Changes in captured events are not automatically additional sales or causal performance gains.

Our attribution, tracking and dashboards service connects measurement events to CRM stages and ERP revenue.

Connect tracking with business data

See how we connect events, lead stages and ERP revenue in a traceable measurement flow.

View attribution & lead tracking

Related articles