Magento 2 · Cookie consent · Google Consent Mode v2
Most cookie banners announce the visitor's choice after the tag container has already started — and by then the first call has gone out with everything granted. This one hands the state over before the container loads, keeps a log that says which text the visitor was actually shown, and ships with 53 cookies already classified so the first screen is not an empty table.
Leave your email and you receive the credentials for our Composer repository. No key to paste: the module activates itself for your domain.
It installs switched off. Until you turn it on there is not one extra byte on your storefront.
Magento 2.4.x, PHP 8.1 to 8.5, any theme. Installed with Composer, from our repository.
The consent state has one moment in which it matters: before the tag container starts. A banner that announces the choice a few lines later is announcing it to a container that has already made its first call — and that call carries the implicit default, which is "granted". With our data layer module installed, this one hands over the state so it is declared in the same script that loads the container, which is the only arrangement in which it is guaranteed to come first. Without that module, it declares the state itself.
Measured on live stores before we built this: the theme banner declared consent on source line 71 while the container started on line 45, and the first call to Google carried gcs=G111 — everything granted, before the visitor had chosen anything. With this module the same first call carries gcs=G100: everything denied, as it should be.
A visitor who allows analytics and refuses advertising should produce exactly that, and nothing more. Here you do not have to take our word for it: open the network panel, allow only analytics, and the request Google receives carries gcs=G101 — analytics granted, advertising denied. Allow everything and it becomes G111. Refuse and it stays G100. The visitor chooses groups in plain language; the seven platform signals are derived from them, because nobody knows what ad_user_data is and everybody knows what advertising is.
Plain HTML and CSS with a class prefix of its own: it renders the same on a modern theme, on the classic one and on a theme built in house. These are real screenshots of our own demo store, not mockups.
This is a property of the structure, not a promise in a brochure: both buttons come out of the same loop with the same class, so there is nothing to style differently. There is no setting that hides the refusal, shrinks it, puts it behind a "learn more" or turns it into a grey link, and there will not be one. There is no X that closes the banner without recording anything, because closing is not a choice. One thing is yours to decide: whether the accept button is filled while the others are outlined. That changes the fill and nothing else.
Measured on both themes: 15488 px² per button, zero difference, same row, same font, and the same 10.75:1 text contrast whichever emphasis you pick. The banner also takes keyboard focus the moment it appears, so the first button is two Tab presses away instead of fifty.
Counting how many people accepted proves nothing. Each row here records the groups allowed and the groups refused, what was actually sent to each platform, and a fingerprint of the exact texts that visitor was shown — so you can open a row and read, word for word, the wording they agreed to. There is a reference the visitor can quote, the address is never kept whole, and everything exports to CSV. The log never leaves your server.
This is the difference between "they accepted" and "they accepted this". Change your texts and the fingerprint changes with them: visitors are asked again, and every older row still resolves to the wording that was in front of them on the day.
The reason most cookie modules get switched off on day one is that they open on an empty table and expect you to fill in forty rows by hand. This one ships with 53 cookies and 4 groups already classified — the ones Magento writes itself, ours, and the common third-party ones — each with who writes it, how long it lasts and a plain-language description. Then the browser reports the names it sees and the catalogue does not list: they land in a queue you classify with one click.
It works: on our own demo store the detector found two payment cookies nobody had declared, on the first run. They are now in the shipped catalogue.
Removing a cookie after it has been written is a cleanup. Not writing it is consent. A modern Magento theme has a first-party cookie gate built in, and this module drives it rather than reimplementing it: it declares its groups to the gate, so a cookie belonging to a group the visitor has not allowed is never written, and reopens them the moment the visitor chooses. On the classic theme, where no such gate exists, the cookies of refused groups are removed by name and by prefix — and the admin says plainly which of the two situations your theme is in, instead of letting you assume.
The visitor's choice never enters the HTML. Two visitors with opposite choices receive byte-identical pages, and the decision is taken in the browser from a single cookie of about 130 bytes. That matters more than it sounds: a consent module that writes the choice into the page either multiplies your cached variants or — worse — serves one visitor's choice to everybody else. The only case where an extra cached copy exists at all is when you configure the country rules, and then there is exactly one.
This module gives you the tools to collect, apply and prove consent. It does not make you compliant — that depends on how you configure it, what you write in your policy, and your own advisor. Three limits worth knowing before you install, rather than after:
If the third-party script blocking is what you came for: switch it on, list your addresses, and then walk through a whole purchase on your own store — both themes if you run two, checkout included — before you leave it on. It is the one feature that can stop a shop from working, which is exactly why it ships switched off.
Every field and every explanation in the configuration is translated, and so is everything your visitors read: the banner, the preferences window, the names of the groups and the description of each of the 53 cookies that come with the module. Leave a text field empty and you get the built-in wording in the language of that store view. Each consent records which version of the texts was shown, so a translation change is visible in the log too.
The store view language is picked up automatically; English is the fallback. Seven languages: English, Italian, German, Spanish, French, Dutch and Portuguese.
Magento 2.4.x (Open Source or Adobe Commerce), PHP 8.1 to 8.5, any theme. Our data layer module is suggested but not required: with it installed, the consent state is declared in the same script that loads your tag container. The server has to reach codingrow.com over HTTPS once a day for the automatic activation.
What changes, version by version.
One hands-on Magento 2 guide per email, only when we publish one. Nothing else.
Articles are written in English. One click to unsubscribe, in every email. · privacy