Articles on: Settings & configurations

Cookie consent: Maglr banner, GTM, and third-party CMPs

Cookie consent in Maglr publications


When you're looking to activate external trackers and scripts in your Maglr publications, a cookie consent is often required. Through Google Tag Manager you can listen to consent status and activate tags based on that status.


Maglr supports two approaches:


  • Maglr's default cookie consent — a built-in accept/reject banner in your publication
  • Third-party consent managers — your own CMP (e.g. Cookiebot, CookieFirst) connected via Maglr's manual consent mode


Image: Maglr's default cookie consent




Maglr pushes the live consent status to the dataLayer. With variables, triggers, and tags you can activate scripts when a visitor accepts cookies — or when they already accepted during a previous visit.


How it works


When consent is known, Maglr pushes a custom event to the data layer:


Key

Value

event

maglrConsentChanged

maglrCookieConsented

true or false


This event fires when:


  • A visitor accepts or rejects the cookie banner
  • A returning visitor loads the page and a choice was saved previously (cookie MaglrCookieConsent)


It does not fire on a first visit before the visitor has made a choice.


Note: On other Maglr data layer events (such as maglrPageView), the same value is available under MaglrCookieConsented (with a capital M). For the setup below, use maglrCookieConsented on the maglrConsentChanged event.


Create a variable


In Google Tag Manager, create a Data Layer Variable:


  • Variable name: maglrCookieConsented
  • Data Layer Variable Name: maglrCookieConsented


This variable contains true or false.


Image: creating a 'Data layer variable' in Google Tag Manager


Set up a trigger


Add a Custom Event trigger:


  • Trigger name: maglrConsentChanged
  • Event name: maglrConsentChanged
  • Fire on Some Custom Events
  • Condition: maglrCookieConsented equals true


This trigger fires when a visitor accepts cookies, or when a returning visitor already accepted during a previous visit.


Image: setting up the 'maglrConsentChanged' trigger


Add the trigger to a tag


Create tags (such as the Google Tag) and configure them to fire on the maglrConsentChanged custom event trigger.


Do not use maglrCookieConsented as the event name — that is the data layer variable, not the event.


Image: firing the Google Tag when the cookie consent has been accepted




You can use your own cookie consent manager (such as Cookiebot or CookieFirst) instead of Maglr's default banner. This requires manual consent mode, which Maglr enables on request.


In this mode Maglr does not show its own banner. Instead, it communicates with your CMP through browser events:


Direction

Event / API

Purpose

Maglr → your CMP

MaglrRequestShowCookieConsent

Maglr asks your CMP to show its banner

Your CMP → Maglr

MaglrCustomCookieConsent

Your CMP reports the visitor's choice

Your CMP → Maglr

window.setMaglrConsent()

Alternative direct API — pass true or false



When your CMP knows the visitor's choice (including on page load if consent was already given), send it to Maglr:


<script>
document.dispatchEvent(new CustomEvent("MaglrCustomCookieConsent", {
detail: { consented: true }
}));

// Or use the global function:
// window.setMaglrConsent(true);
// window.setMaglrConsent(false);
</script>


Show your banner when Maglr requests it


<script>
document.addEventListener("MaglrRequestShowCookieConsent", function () {
// Trigger your CMP to show its cookie banner
});
</script>


After Maglr receives the choice, it saves the consent cookie, updates window.MaglrCookieConsented, and pushes maglrConsentChanged to the data layer — so your existing GTM setup continues to work.


Google Tag Manager can act as the bridge between Maglr and your CMP (e.g. via Custom HTML tags that listen to and dispatch these events).



To use a third-party consent manager in your Maglr publications, contact us at info@maglr.com. We will enable manual consent mode for your publication or domain.

Updated on: 22/06/2026