Ad Measurement

GA4 Consent Mode v2 and Meta Conversions API: how to set up server-side conversion tracking for e-commerce

Step-by-step setup to recover conversions lost to cookie restrictions and consent management: Consent Mode v2 signals, GTM configuration, Meta CAPI with event_id deduplication, Shopify Customer Events, testing and quality metrics.

Short answer

In 2026 browser-based tracking alone is not enough: Safari and Firefox block third-party cookies, in-app browsers on iOS cut off the Pixel, and a user who rejects the consent banner is invisible. The solution has two layers. Consent Mode v2 passes the user’s consent state to Google tags through four signals (analytics_storage, ad_storage, ad_user_data, ad_personalization); without consent it sends cookieless pings, and GA4 and Google Ads can model the missing conversions. The Meta Conversions API (CAPI) sends purchase, add-to-cart and similar events from your server directly to Meta; when it shares the same event_id with the browser Pixel, Meta deduplicates them.

If you run Shopify, the official Facebook & Instagram and Google & YouTube apps handle CAPI and conversion upload automatically; server-side GTM (sGTM) is added for custom needs. Success criteria: Event Match Quality above 6 in Meta Events Manager, a deduplication rate near 100%, and Consent Mode showing “active” in GA4.

Why browser-based tracking is no longer enough

Conversion data gets lost for four different reasons, and each one is fixed by a different tool.

Cause of lossWhat happensSolution layer
Safari ITP, Firefox ETPThird-party cookies are blocked; script-set first-party cookies are capped at 7 days, in some cases 24 hours. A customer returning after 7 days counts as “new”.Server-side tagging, first-party cookies
Ad blockersPixel and gtag.js never load. Noticeable on a meaningful share of desktop traffic.CAPI / server-side delivery
iOS ATT and in-app browsersOn pages opened inside Instagram/Facebook the Pixel signal weakens; attribution breaks.CAPI + fbc/fbp parameters
Consent rejection (GDPR, ePrivacy)No cookies can be set for a user who rejects the banner; nothing is measured.Consent Mode v2 modelling

Meta reports an average 13% improvement in cost per result for advertisers using the Pixel together with CAPI. Google documents that Consent Mode modelling recovers a significant share of conversions lost to consent rejection, depending on the consent rate. Under GDPR and the ePrivacy rules, non-essential cookies require explicit consent, so consent management is a technical requirement in every EU market, Germany included.

13%Cost-per-result improvement with Pixel + CAPI (Meta)
7 daysMaximum lifetime of script-set cookies in Safari (ITP)
4Consent signals in Consent Mode v2

Consent Mode is an API that passes the user’s consent choice to Google tags (GA4, Google Ads, Floodlight). The tags change their behaviour accordingly: with consent they set cookies; without it they send cookieless, anonymous pings. “v2” refers to the two additional signals (ad_user_data, ad_personalization) that became mandatory for the European Economic Area in March 2024.

SignalControlsIf denied
analytics_storageGA4 cookies (_ga)GA4 sends cookieless pings; sessions and users are modelled
ad_storageAdvertising cookies (_gcl_*)Click IDs are not stored; conversions are modelled
ad_user_dataSending user data to Google for advertisingEnhanced conversions and audience data are not sent
ad_personalizationPersonalised ads / remarketingUser is not added to remarketing lists

Basic mode: no Google tag loads until consent is given; no data arrives from users who reject, and modelling relies on general rates. Advanced mode: tags always load but send cookieless pings without consent; modelling is based on those pings and is more accurate. We recommend advanced mode for e-commerce; if your legal team considers the cookieless ping to be data processing, stay in basic mode.

Implementation: default to denied, update on choice

The critical rule: the consent default command must run before gtag or GTM loads, at the very top of the page. Otherwise the first hit counts as consented.

<script>
window.dataLayer = window.dataLayer || [];
function gtag(){ dataLayer.push(arguments); }
gtag('consent', 'default', {
  analytics_storage: 'denied',
  ad_storage: 'denied',
  ad_user_data: 'denied',
  ad_personalization: 'denied',
  wait_for_update: 500          // wait up to 500 ms for the CMP
});
</script>
<!-- GTM / gtag.js loads after this -->

// When the user makes a choice in the banner:
gtag('consent', 'update', {
  analytics_storage: 'granted',
  ad_storage: 'granted',
  ad_user_data: 'granted',
  ad_personalization: 'granted'
});

If you use GTM, use your consent platform’s (CMP) template bound to the “Consent Initialization” trigger; tools on Google’s certified CMP list do this out of the box. Every tag must declare which signal it requires under its “Consent settings”.

Thresholds for modelling to work in GA4

Behavioural modelling does not switch on automatically. Google’s conditions: Consent Mode must be set up correctly, the property must receive at least 1,000 events per day with analytics_storage: denied for at least 7 days, and have at least 1,000 consented daily users on at least 7 of the previous 28 days. Small stores will not reach this; then only consented data is reported, which is normal.

Meta Conversions API: send events from the server

The Conversions API (CAPI) is the interface that sends web events (PageView, ViewContent, AddToCart, InitiateCheckout, Purchase) from your server to Meta’s Graph API instead of from the browser. It is unaffected by ad blockers, cookie restrictions and connection drops, and runs as a second channel alongside the Pixel.

Deduplication: not counting the same event twice

The Pixel and CAPI report the same purchase through two separate routes. To merge them into one event Meta looks for the same event_name and the same event_id; the second arrival within 48 hours is discarded. The event_id must be deterministic, such as the order number, never randomly generated.

// Browser (Pixel)
fbq('track', 'Purchase',
    { value: 129.90, currency: 'EUR', content_ids: ['HON-PINE-450'], content_type: 'product' },
    { eventID: 'order_104233' });

// Server (CAPI) – POST https://graph.facebook.com/v22.0/{PIXEL_ID}/events
{
  "data": [{
    "event_name": "Purchase",
    "event_time": 1760700000,
    "event_id": "order_104233",
    "event_source_url": "https://www.example-store.com/checkout/thank-you",
    "action_source": "website",
    "user_data": {
      "em": ["<sha256(lowercase email)>"],
      "ph": ["<sha256(E.164 phone, no + or spaces)>"],
      "client_ip_address": "203.0.113.4",
      "client_user_agent": "Mozilla/5.0 ...",
      "fbp": "fb.1.1760699000000.123456789",
      "fbc": "fb.1.1760699000000.IwAR0..."
    },
    "custom_data": { "value": 129.90, "currency": "EUR", "content_ids": ["HON-PINE-450"], "content_type": "product", "order_id": "104233" }
  }]
}

Event Match Quality (EMQ): how well your events match

For every event, Meta scores from 1 to 10 how well the user parameters you send (email, phone, name, city, postcode, fbp, fbc, IP, user agent) match real accounts. The practical target is 6 or above; 8+ is achievable on Purchase because you hold email and phone at checkout. All personal fields must be sent SHA-256 hashed, lower-cased and trimmed; fbp, fbc, IP and user agent are not hashed.

Architecture options: which one is right for you?

OptionHow it worksProsConsBest for
The platform’s built-in integration (Shopify Facebook & Instagram, Google & YouTube apps)The platform manages Pixel + CAPI and conversion upload itself, checkout events includedMinutes to set up, deduplication built in, complete checkout dataCustom events and parameters are limitedMost stores on Shopify, WooCommerce and similar platforms
Server-side GTM (sGTM)Browser GTM → sGTM container on your own subdomain → GA4, Meta CAPI, Google AdsFirst-party cookies, full control, consent managed in one place, data enrichmentHosting cost (Cloud Run or a managed service), maintenanceMulti-channel stores with a meaningful monthly ad budget
Direct backend integrationThe application server POSTs to the Graph API when an order is createdOffline/CRM events (returns, repeat orders) can be sentNeeds a developer, does not cover browser eventsCustom software, B2B portals, CRM connections

Shopify note: checkout.liquid was removed on 13 August 2024 for the information, shipping and payment steps and on 28 August 2025 for the thank-you and order-status pages. The only ways to capture checkout events now are a custom pixel running in the sandbox of Customer Events (Web Pixels API) or the official channel apps. In a custom pixel you take the order ID from the analytics.subscribe('checkout_completed', ...) event and pass it as event_id to both the Pixel and CAPI; consent comes from Shopify’s Customer Privacy API (init.customerPrivacy).

Step-by-step setup (GTM + sGTM scenario)

  1. Choose a CMP and set up the banner. Localised copy, a “Reject” button as visible as “Accept”; the choice can be stored for up to 180 days. A Google-certified CMP generates Consent Mode v2 signals automatically.
  2. Put the consent default at the top of the page (code above). The GTM container must load after it.
  3. Enable consent settings in GTM: Admin → Container settings → Enable consent overview. Require analytics_storage on the GA4 tag and ad_storage + ad_user_data on Google Ads and Meta tags.
  4. Set up the sGTM container on Google Cloud Run or a managed provider, on a first-party subdomain such as gtm.yourstore.com. Put that address in the server_container_url field of the browser GA4 tag.
  5. Create the GA4 client and tag in sGTM. sGTM receives the GA4 requests from the browser and forwards them to GA4; cookies are now first-party.
  6. Add the Meta CAPI tag in sGTM (Meta’s official “Conversions API Tag” template). Use the same variable for event_id as the browser Pixel; fill user_data from the data layer (hashed). Fire the CAPI tag only on hits with ad_storage and ad_user_data granted.
  7. Standardise the data layer. Send view_item, add_to_cart, begin_checkout and purchase in the GA4 e-commerce schema; map them to Meta event names in sGTM (ViewContent, AddToCart, InitiateCheckout, Purchase).
  8. Test. GA4 DebugView, Tag Assistant (both web and server preview), Meta Events Manager → Test events. In the test event, the “Browser” and “Server” rows must show the same event_id as “Deduplicated”.
  9. Monitor. EMQ and deduplication rate in Meta Events Manager; Consent Mode status under GA4 Admin → Data collection; the conversion “Diagnostics” tab in Google Ads.

Quality checklist

CheckTargetWhere to look
Consent default runs before GTMFirst hit carries “denied” signalsTag Assistant → Consent tab
All four signals updateAll “granted” on acceptTag Assistant / dataLayer
Pixel and CAPI deduplication95–100% matched eventsEvents Manager → event → Deduplication
Event Match Quality (Purchase)≥ 6, ideally 8+Events Manager → event → EMQ
Purchase value and currencyOrder total, correct currencyGA4 DebugView, Test events
Gap between GA4 and platform order counts< 10%GA4 Monetization report ↔ store admin
First-party cookie_ga set by the serverDevTools → Application → Cookies

Common mistakes

  • Running consent default after GTM. The first page view goes out as consented; it is the first thing an audit checks.
  • Random event_id. Browser and server generate different IDs, Meta counts both; purchases look doubled and ROAS is inflated.
  • Unhashed email/phone. Meta rejects raw data and EMQ drops. Phone must be in E.164 format (4915112345678) and hashed.
  • Firing CAPI even when consent is denied. Being server-side does not remove the need for consent; it is a GDPR risk. Bind the CAPI tag to the consent signal as well.
  • Relying on old checkout scripts. On Shopify, checkout.liquid is gone; old Pixel code placed on the thank-you page no longer runs.
  • Looking at a single source. GA4, Meta and the store admin never match exactly; differences within 10% are normal, anything above is investigated.

Measurement infrastructure should be planned together with site speed and structured data: the Shopify Core Web Vitals guide and the Schema.org JSON-LD guide for e-commerce complement this article.

Key takeaways

  • Conversions are lost for four reasons (ITP/ETP, ad blockers, iOS/in-app browsers, consent rejection); Consent Mode v2 and CAPI together address all of them.
  • Consent Mode v2 has four signals; consent default must run before GTM, start as “denied” and be followed by an “update” on choice.
  • GA4 modelling needs 1,000 denied events and 1,000 consented users per day; small stores will not get modelling, which is normal.
  • In Meta CAPI, deduplication uses the same event_name plus a deterministic event_id; personal fields are SHA-256 hashed, target EMQ 6+.
  • On Shopify, checkout.liquid is gone; checkout events are captured only by the official channel apps or a Customer Events custom pixel.
  • Verify with Tag Assistant (consent), GA4 DebugView, Meta Test events (Deduplicated), and keep the GA4 vs. store order gap under 10%.

Frequently asked questions

Is Consent Mode v2 mandatory for an online store in Germany?

Google’s requirement applies to users in the European Economic Area, the UK and Switzerland, so a German store is fully covered. GDPR and the German TTDSG require explicit consent for non-essential cookies, and Consent Mode is the standard way of passing that consent to Google tags technically. In short: the banner is a legal requirement, Consent Mode a technical one.

I already have the Meta Pixel. Do I really need the Conversions API?

Yes. The Pixel misses a share of events because of ad blockers, Safari cookie limits and in-app browsers. CAPI sends the same events from the server, and Meta reports an average 13% improvement in cost per result when it is used alongside the Pixel. The two must run together with the same event_id.

How should event_id be generated?

Deterministically: the order number for Purchase, or session ID + product ID + timestamp for AddToCart. The same value goes into eventID in the browser Pixel call and event_id in the server CAPI request. Random IDs break deduplication and double your conversions.

What does server-side GTM cost?

On Google Cloud Run, a low-traffic store pays a few to a few dozen euros per month; managed providers offer fixed monthly plans. The real cost is setup and maintenance effort. If your monthly ad budget is small, the platform’s built-in integration (Shopify’s official Meta and Google apps) covers most needs at no cost.

How do I measure checkout conversions on Shopify?

Two ways: Shopify’s official Facebook & Instagram and Google & YouTube apps send checkout events via Pixel and CAPI automatically; or you write a custom pixel under Settings → Customer events and subscribe to checkout_completed. Adding a script to the thank-you page by hand has not been possible since 28 August 2025.

My Event Match Quality is low. What should I do?

On the Purchase event, send email and phone SHA-256 hashed, add the fbp and fbc cookie values, IP and user agent, and where possible name, city and postcode, also hashed. Convert the phone to E.164 and lower-case the email. Each of these fields raises the score; above 6 is good, 8 and above is very good.

Why did my GA4 reports change after enabling Consent Mode?

Users who reject consent now send cookieless pings; if you meet the thresholds GA4 models these users into the reports, otherwise only consented traffic is shown. In both cases a like-for-like comparison with the previous period is misleading; check Consent Mode status and whether modelling is active under Admin → Data collection.

Sources

  1. Google Tag Platform – Consent Mode setup and signals
  2. Google Analytics Help – Requirements for behavioural modelling
  3. Google Ads Help – Conversion modelling with Consent Mode
  4. Meta for Developers – Conversions API
  5. Meta for Developers – Deduplicating Pixel and server events
  6. Meta for Developers – Customer information parameters and hashing
  7. Meta Business Help – Event Match Quality
  8. Meta for Business – Using CAPI with the Pixel (13% cost per result)
  9. Shopify.dev – checkout.liquid deprecation timeline
  10. Shopify.dev – Web Pixels API and Customer Events
  11. Google Tag Manager – Server-side tagging
  12. WebKit – Intelligent Tracking Prevention (cookie lifetime)