Skip to main content

Server-side Tracking with GTM

Server-side tracking sends website events to Positive User through your own server-side Google Tag Manager (GTM) container instead of straight from the browser. The browser hands the event to your container, and a custom tag in the container calls the Positive User API. Your API key stays on the server, and ad blockers and browser restrictions don't drop the request.

This guide is vendor-neutral. It works with any server-side GTM hosting and any e-commerce platform that can push events to the data layer.

How it works​

Every event in this guide follows the same path:

The transport tag, the GA4 Client and the tag template conventions are the same for every event. You set them up once in Container setup. Each event then gets its own client-side parameters and its own custom tag, described on its own page.

Prerequisites​

Before you start, make sure the following is in place:

  • A server-side GTM container reachable on your own subdomain (for example https://sst.yourdomain.com).
  • A client-side GTM container already collecting events from your website's data layer.
  • A Positive User account with API access and a 64-character API key (Workspace Settings, under API keys). For details, see How to create and manage API keys.
  • Your workspace subdomain — the part before .user.com.
  • Products already in Positive User, typically imported from a product feed, if you track product-related events. Product events and deal line items attach to existing products by their identifier.

Key decisions​

Make these two decisions before you build any tag. Every event in this guide depends on them.

Contact identifier​

Every contact in Positive User is addressed by a custom_id. We recommend the lowercase email address as both the custom_id and the email. This gives you stable deduplication: the same email always resolves to the same profile, and guest checkouts still merge correctly.

If your business identifies contacts differently (an internal account ID, for example), use that consistently everywhere. Email is the safe default for most e-commerce setups. See Key decisions → Decide on the User ID for the full reasoning.

Product identifier scheme​

Product events and deal line items reference products by their custom_id. This identifier must match exactly what exists in Positive User (from your feed). If you run multiple stores or regions under one workspace and the same product can exist in several catalogs, a common pattern is to prefix the product ID with a short region code (for example PL + 5900000000001 = PL5900000000001).

The golden rule

The product identifier you send must be byte-for-byte identical to the product's custom_id in Positive User, and identical across all events for the same product (view, add to cart, purchase). Any mismatch means the event silently attaches to nothing.

What this guide covers​

  • Container setup — The shared foundation: client-side transport tag, server-side GA4 Client, tag template conventions and testing
  • Purchase tracking — Contact upsert, a product event per item, and a deal (order) on the correct pipeline and stage

Next steps​

Start with Container setup, then add the events you need.