Lessons in this module
Lesson 10 of 16
Wire The Banner
① Connect your GTM container
Paste your container ID to load it into this page. It only ever runs here.
Advanced: use a specific environment
A consent banner's buttons are not magic. Each one does exactly two things: it calls gtag('consent', 'update', ...) so Consent Mode knows the visitor's choice, and it pushes a dataLayer event, here consent_update, so GTM can react to the choice. The first half gates tags; the second half lets you fire them the moment consent arrives.
The banner below is already wired that way (open the dataLayer log and press its buttons to see both pushes). Your job is the GTM side: a Custom Event trigger listening for consent_update, and a tag that fires on it. On a real site this is how you send the events you were holding back, the visit is not lost just because consent arrived late.
Goal
Build a Custom Event trigger on consent_update and fire a tag the moment the banner reports a choice.
Build it in GTM
Know what the banner pushes
Every button pushes{ event: "consent_update", consent: {...}, granted_signals: [...] }right after itsgtag('consent', 'update', ...)call. The event name is the hook; the payload tells you what was granted.Trigger: Custom Event - Consent Update
Go to Triggers → New → Custom Event and set the event name toconsent_update, exactly as pushed, lowercase with the underscore. Save it asCustom Event - Consent Update.Tag: fire on the choice
Create a GA4 Event tag (event nameconsent_update) or theCustom HTML - Teststand-in with<script></script>, and setCustom Event - Consent Updateas its firing trigger.
Debug in Tag Assistant
Copy this lesson's live URL and paste it into GTM Preview, that is the page Tag Assistant connects to. It has the clickable elements, so this page stays clean for reading.
- In your GTM, click Preview.
- Paste the live URL above and click Connect.
- Interact with the live page and watch your tag fire in Tag Assistant.
What you should expect to see
consent_update message in the left rail with your tag under Tags Fired, and the Consent tab flips the granted signals from denied to granted at that same moment.Verify your container
Built it? Export your container, Admin → Export Container, choose your workspace, then drop the JSON here to check it against this lesson.
Drop your container .json here
or browse · checked in your browser, nothing is uploaded