WooCommerce plugin has been released on WordPress.orgView plugin →

Consent Mode v2 with Server-Side GTM: A Tested Setup

How Consent Mode v2 reaches a server-side GTM container, the order that keeps declined visitors out of your tags, and what our Shopify test showed.

MHMahmudul HasanNov 15, 20267 min read
The short answer

With server-side GTM you set up Consent Mode v2 in the web container only. The browser's Google tag adds the visitor's choice to every request it sends to your server container (the gcs and gcd parameters), and Google's server tags read it from there. What decides whether it actually works is the order on the page: the consent default, then the visitor's real choice, then GTM and your events. In our test, getting that order wrong sent a "granted" page view and a Meta Pixel event for a shopper who had declined.

TagLinc hosts server-side GTM, so we are not neutral. Everything below the theory section comes from a test we ran on 15 November 2026 on our own Shopify development store, with a web GTM container loaded through a TagLinc tracking domain and a TagLinc server container behind it.

Consent Mode is how a page tells Google's tags what the visitor allowed. Version 2 (November 2023) added two signals to the original two, so a full setup sends four:

SignalWhat it controls
analytics_storageAnalytics cookies, for example Google Analytics' _ga
ad_storageAdvertising cookies and device IDs
ad_user_dataSending user data to Google for advertising. Denied means no enhanced conversions and no user_id for ads
ad_personalizationPersonalised ads and remarketing

Each one starts with a default (gtag('consent', 'default', …)) and changes with an update when the visitor answers your cookie banner (gtag('consent', 'update', …)).

Basic or advanced mode

Google describes two ways to run it:

  • Basic: Google tags do not load at all until the visitor agrees. A visitor who declines sends Google nothing, not even the fact that they declined.
  • Advanced: Google tags load with the default (usually denied) and, while consent is denied, send cookieless pings: no _ga cookie written, no ad cookies. Google uses these pings to model the conversions and visits it cannot see.

Advanced mode keeps more of your reporting, basic mode sends less. Which one your business may use is a legal question for your market, not a tracking one.

A server container does not run in the visitor's browser, so it cannot see your cookie banner. It learns the choice from the requests the browser sends it:

  1. The web container's Google tag (GA4) sends each event to your tracking domain, for example /g/collect on track.yourstore.com.
  2. Every request carries the consent state: gcs for ad_storage and analytics_storage, and gcd with the detail of all four signals.
  3. The GA4 client in the server container reads them, and Google's server tags (GA4, Google Ads conversions) are consent-aware: they send less, or nothing, when consent is denied.

Two consequences people miss. First, Google's documentation says you only need to set up Consent Mode in the web container: there is no consent setting to copy into the server container for Google's own tags. Second, non-Google server tags do not read gcs by themselves. A Meta Conversions API or TikTok Events API tag in the server container fires on whatever event reaches it, unless you add a condition that checks consent. If the browser never sends an event for a declined visitor, the problem does not arise; if it does send cookieless pings (advanced mode), check how your Meta and TikTok server tags treat them.

What we saw on a Shopify store

Our Shopify app reads the store's own cookie banner through Shopify's Customer Privacy API and turns it into Consent Mode signals. To test it, we set a shopper's choice to "declined" through that API, reloaded a product page and read the requests in the browser. Then we did the same with "allowed".

Shopper's choiceBefore the fixAfter the fix
DeclinedGA4 page_view sent with gcs=G111 (granted), Meta Pixel loaded and sent PageView, view_item pushed, all before the "declined" update arrivedMeta Pixel never loads; GA4 sends cookieless pings only, gcs=G100
AllowedGA4 gcs=G111, Meta Pixel PageView and ViewContentSame: GA4 gcs=G111, Meta Pixel PageView and ViewContent

The cause was timing. The default was "granted" (most of the store's visitors are outside regions that need a banner), and Shopify's consent API answered only after about 900 ms. GTM had loaded at about 690 ms, so the first page view and the Meta Pixel went out under the default, for a shopper who had already said no. On a slower phone the gap is bigger.

A second trap showed up while fixing it. Google's wait_for_update setting tells Google's tags to wait for the update, but the Meta Pixel in GTM is not a Google tag: it checks consent once, when its trigger fires, and never fires again. With a "denied" default and wait_for_update, the Pixel would have been blocked for shoppers who allowed it. And an ecommerce event pushed to the dataLayer before the consent update was handled under the denied default: our first fix lost the Meta ViewContent event for allowed shoppers until we moved the queued events behind the update.

The order that works

  1. Consent default first, before GTM: all four signals. If you do not know the visitor's choice yet, denied is the only safe default.
  2. Get the real choice (your consent platform, or Shopify's Customer Privacy API) and push it as a consent update.
  3. Then load GTM, so every tag, Google's and Meta's, starts from the real choice. Events pushed while you waited stay in the dataLayer and run after the update.
  4. Keep a fallback. If the consent answer never comes (a blocked script), load GTM after a short time anyway, with the denied default. We use 1.5 seconds.
  5. Listen for later changes on the same page (the shopper clicks the banner) and push another update.

The cost is a short delay before tags start: in our test GTM started about 0.2 seconds later than before. Page content is not delayed.

Region defaults and a first-party loader

Many setups give EEA visitors a denied default with the region option and everyone else a granted one. Google applies that by the visitor's country. When gtm.js is loaded through your own tracking domain (the server container's web container client) instead of from googletagmanager.com, check that this still works on your setup: on ours, on 13 November 2026, a visitor in Bangladesh received the EEA denied default (gcs=G100), which is why our Shopify app now waits for the store's own banner for everyone instead of relying on region.

Check your own site in five minutes

  1. Open your store in a private window, decline cookies in your banner, and open the browser's developer tools → Network.
  2. Reload a product page and filter by collect. Click the GA4 request and look for gcs in the query string. In our test, declined gave G100 and allowed gave G111.
  3. Filter by facebook (or tiktok). With marketing declined, nothing should load there.
  4. In the Console, type dataLayer and check the order: consent default, consent update, then gtm.js, then your events.
  5. Repeat with cookies allowed, and confirm the same events now go out with G111.

When you do not need to change anything

  • Your store gets no traffic from regions that require consent and you show no cookie banner: a granted default is correct.
  • Your consent platform already sets the default and the update before GTM loads (many do, with their own script in <head>). Check the order with the five steps above rather than assuming.
Not sure your tracking is right?

We check your setup for free and send you what to fix.

Free tracking audit

FAQ

Not for Google's own tags: Google says to set it up in the web container, and the server container reads the state from the incoming requests. You do need to decide how your non-Google server tags (Meta, TikTok) treat events from visitors who declined.

No, and it should not. Server-side tracking moves where the tags run; it does not change what the visitor agreed to. Send for a declined visitor only what your consent mode allows.

gcs carries the ad_storage and analytics_storage state. In our tests, both granted gave G111 and both denied gave G100.

For Google's tags, often yes. For tags that are not Google's, such as the Meta Pixel in GTM, no: they check consent when their trigger fires and do not fire again after a later update. Loading GTM after the update avoids the problem for all tags.

Sources

MH
Founder of TagLinc. Mahmudul builds the TagLinc platform, writes its documentation and answers the support email himself.