In a consent-gated market, a large share of visitors reject tracking before a single analytics event fires. If your measurement depends on a browser tag that only runs after opt-in, you are seeing a fraction of reality, and the missing part is not random. You measure the rest with consented first-party data, you count the sale from your own backend where it is a fact regardless of marketing consent, and you model the gap honestly. You never fabricate the opted-out.
I run this setup for a regulated multi-brand European client, where opt-in is a minority of traffic. Here is the approach, the real constraints, and where most setups quietly break.
Quick answer
- Browser analytics (GA4, pixels) fire only after consent, so in regulated categories they miss most conversions.
- The sale is a first-party business fact. Capture it server-side from your commerce backend, not the browser.
- Measure consented users fully, model the opted-out share, and always label modeled numbers as modeled.
- Use PostHog with capture gated on consent, not GA4 firing by default.
- The deliverable in this niche is an honest number a CTO can defend, not a confident wrong one.
Why consent gating breaks standard analytics
Standard web analytics assumes the tag runs on page load. Under a consent manager like Usercentrics, the analytics and marketing tags stay dormant until the visitor opts in. In pharma, health, and adjacent categories, a lot of people never do.
So two things happen at once. Your conversion count drops to whatever slice consented, and that slice is biased, because the people who accept tracking are not a random sample of buyers. Every ratio built on top of that data inherits the bias: conversion rate, cost per acquisition, channel attribution. You are not just missing volume. You are making decisions on a skewed sample and calling it the truth.
The fix is not a clever tag. It is moving the source of truth off the browser.
Move the source of truth to your server
The sale is a fact your server already knows. An order exists in WooCommerce. A payment settled in Stripe. Neither of those depends on whether the visitor accepted a marketing cookie. That is the number to build on.
Instead of relying on a browser conversion pixel, emit a server-side event from the commerce backend when the order is created. A webhook from Stripe or WooCommerce hits your server, and your server records the conversion and revenue as first-party data.
// Server route: a Stripe webhook records the sale as a first-party event.
// This is a business record of a completed order, not browser tracking.
export async function handleStripeWebhook(event) {
if (event.type !== "checkout.session.completed") return;
const session = event.data.object;
await posthog.capture({
distinctId: session.client_reference_id ?? `order_${session.id}`,
event: "order_completed",
properties: {
revenue: session.amount_total / 100,
currency: session.currency,
brand: session.metadata?.brand, // which brand site
consented: session.metadata?.consented === "true",
},
});
}Now your revenue total is complete, because it comes from orders, not from a tag that half your visitors blocked. What you lose without consent is the marketing context around that sale: the campaign, the click path, the identifiers. That is the line consent actually governs, and you respect it. Confirm the lawful basis for anything you attach to a person with your DPO, because analytics is a separate question from processing an order you were paid for.
Measure the consented, model the rest, label everything
For the visitors who did opt in, you can measure the full journey with PostHog: entry, funnel, click-out, and the order event tied back to the session. That is your measured, defensible layer.
For the opted-out share, you do not invent journeys. You estimate the total by scaling the consented data against the known consent rate, and you present it as a modeled figure, clearly labeled.
A clean report for a consent-gated business has three parts, and it says which is which:
| Layer | Source | Honesty |
|---|---|---|
| Measured revenue | Server-side order events, all sales | Fact |
| Measured journeys | PostHog, consented sessions only | Fact, biased sample |
| Modeled total | Consented data scaled by consent rate | Estimate, labeled |
Why PostHog and not GA4 here
GA4 is built to fire early and send data to Google by default. That is the opposite of what a consent-gated setup needs, and it puts you in a weaker position on data residency the moment a regulator or a client's legal team asks where the data lives.
PostHog lets you gate capture on consent, keep the instance in the EU or self-host it, and own the event stream outright. For a regulated, multi-brand client, "we control when capture starts and where the data sits" is not a nice-to-have. It is often the reason the measurement is allowed to exist at all.
GA4 still has a place. Plenty of US prospects run it, and you work with what they have. But you do not build a new consent-gated measurement layer on a tool designed to phone home before anyone said yes.
Multiple brands, one picture
When the same group runs several brand sites on one stack, tag each server-side event with its brand, as in the snippet above. One PostHog project, one query, revenue per brand with consent gating in place across all of them. The alternative, a separate analytics account per site that nobody reconciles, is how a group ends up unable to say which brand actually made money.
What good looks like
You end up with a number you can defend on a call. Complete measured revenue from the server. A clearly labeled modeled total for the opted-out share. Consent rate tracked over time, because when it moves, your modeled layer moves with it and you want to see that coming.
That is the whole point. In a regulated category you cannot have the perfect, fully-tracked funnel, and pretending otherwise is how measurement quietly breaks. Honest and smaller beats confident and wrong, every time a real decision rides on it.
If you are running ad spend into a consent-gated site and cannot prove what it produced, that is the exact problem I build measurement for. See how I set up conversion tracking under consent constraints.
Tags
Frequently asked questions
Can you track conversions if most visitors reject cookies?
Yes, but not the way most setups try to. You measure consented users fully with first-party server-side events, count the sale from your commerce backend where it is a fact regardless of marketing consent, and model the opted-out gap transparently. You never present a modeled number as if it were measured.
Why does GA4 undercount so badly under consent gating?
GA4 and browser pixels fire only after a visitor opts in. In regulated categories the opt-in rate is often well under half, so the dashboard shows a fraction of reality, and the missing part is not random. That skews every downstream decision built on it.
Is server-side tracking a way around consent?
No, and do not treat it as one. Server-side tracking is how you reliably capture what you are lawfully allowed to process, mainly the sale itself as a first-party business record. Consent still governs marketing and analytics identifiers. Confirm the lawful basis with your DPO.
Should I use PostHog or GA4 for a consent-gated site?
PostHog, in most regulated cases. You control when capture starts, you can keep data in the EU or self-host, and you own the event stream. GA4 is built to fire early and phone home, which is the opposite of what a consent-gated setup needs.
Need something like this built?
Free 15-min discovery call. I'll listen, ask honest questions, and tell you if I can help.