Blog

Run GA4 server-side without a client-side container

Possible but rarely advisable. Three scenarios where it makes sense.

The standard architecture is: page-side gtag, client GTM container, forward to sGTM. You can skip client GTM in three scenarios.

Scenario 1: backend-only events

Events from server-side systems have no browser involved. Send directly to your sGTM webhook endpoint. Example: a Stripe webhook posting purchase events.

Scenario 2: SPA with hand-coded tagging

If your app already constructs the right requests, client GTM is mostly a passthrough. Configure the gtag transport_url to point at your sGTM custom path.

Scenario 3: stripped-down landing pages

For minimum JavaScript pages, skipping client GTM saves the gtm.js download (about 80KB compressed). Hand-roll a fetch call directly to sGTM. Trade-off: tag changes require code deploys.

Why client GTM is usually still worth keeping

  • Built-in triggers (form submissions, scroll, video, click).
  • Tag changes go live without code deploys.
  • Marketing teams can manage tags without engineering involvement.

A hybrid approach: client GTM where the GTM model adds value, direct sGTM webhooks for backend events. The migration post covers how they relate.