Web Development

Cookie Consent Banner Implementation With Real Tag Gating

iJurug Soft2026-11-145 min read

A cookie banner that does not block anything is decoration. Real cookie consent banner implementation has two halves: a banner that asks clearly and records the answer, and tag gating that keeps analytics, advertising and session-recording scripts from loading until the matching category is granted. Most sites get the first half and skip the second.

Open your browser's developer tools on your own store, clear cookies, load the home page without touching the banner, and look at the cookie list and network tab. If you see analytics or ad pixel cookies already, the banner is not doing its job. That five-minute test is where every engagement should start, and if it fails, we can scope the fix.

Step one: an honest inventory of tags and cookies

You cannot gate what you have not found. Build a register that lists every script, pixel and cookie, where it loads from and who asked for it.

Assign each item a category (strictly necessary, functional, analytics, advertising) and an owner. This register also becomes the cookie table in your policy, so it has to stay current.

Designing the banner itself

Categories people can understand

Keep the category list short and the descriptions plain. "Analytics: helps us understand which pages are useful" beats a list of vendor names. Strictly necessary items, such as the cart, login session, fraud prevention and the consent cookie itself, do not need a toggle.

Choices that are genuinely equal

European regulators have repeatedly criticized banners where "Accept all" is a bright button and rejecting takes three clicks. Offer accept and reject at the same level, with a link to granular settings, and keep a persistent link (often in the footer) to change preferences later.

Language and regional behavior

For Indian audiences, the DPDP framework expects notices to be available in English or a language listed in the Eighth Schedule, so plan for translated banner text rather than English only. For US visitors, decide how you handle the Global Privacy Control browser signal, which California's rules treat as an opt-out of sale or sharing. Geo-specific behavior is fine as long as it is deliberate.

Gating must happen at the point a script loads, and it must react to changes without a page reload.

Inside Google Tag Manager

Set a Consent Initialization tag that applies default states before anything else, then use built-in consent checks for Google tags and "additional consent required" settings for everything else. Wire the banner to Google Consent Mode v2 so the four Google signals update with each choice; our article on GA4 setup covers the measurement side.

Scripts outside the tag manager

Hard-coded scripts are the biggest leak source.

The text/plain pattern

Change the script's type attribute to text/plain and add a data attribute naming its category. The browser ignores it until your consent script swaps the type and re-inserts the element after the category is granted. Most commercial CMPs support this pattern; if you build it yourself, handle scripts that inject further scripts.

Iframes and embeds

Replace embedded players with a lightweight placeholder that loads the real iframe on click or after functional consent, or use privacy-enhanced embed domains where the provider offers them.

Server-side tagging

A server container reduces browser scripts but does not remove the consent obligation. Pass the consent state with each request and make sure the server only forwards events to vendors whose category was granted.

What changes for e-commerce stores

Online stores have more scripts and more money riding on measurement, so a few extra rules apply.

iJurug Soft handles this as combined web engineering and analytics work: inventory, banner integration with the CMP you choose, GTM and code-level gating, server-side container rules and performance checks. If you are still selecting a platform, our checklist for configuring a CMP before go-live covers the selection side.

A launch checklist

  1. With no choice made, no analytics, advertising or session-recording cookies are set and no requests reach those vendors.
  2. Reject all: same result, and it persists across pages and visits.
  3. Accept a single category: only that category's tags load, without a reload.
  4. Withdraw consent from the preferences link: tags stop, and non-essential cookies your domain set are removed where possible.
  5. Checkout, login and payments work in every state.
  6. Consent records store the choice, timestamp and banner version.

Frequently asked questions

Can we just use a WordPress or Shopify plugin?

Often, yes, for the banner. The plugin still needs configuring, and it will not catch scripts hard-coded in themes or loaded by other apps. The inventory and testing work remains.

You will see fewer tracked sessions from visitors who decline. Consent Mode v2 in advanced mode and server-side tagging can recover some modeled insight for Google products, within what visitors allowed.

Review whenever marketing adds a tool or the site is redesigned, and on a regular schedule otherwise. Automated scans help, but a human should confirm categories.

Run the five-minute test from the top of this article first. If cookies or vendor requests appear before anyone clicks the banner, tell us your platform and the CMP you use via the contact form or at info@ijurugsoft.com, and we will map which scripts are leaking and how to gate them.