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 (with a standard or strict analytics mode)
  • Third-party consent managers — your own CMP (e.g. Cookiebot, CookieFirst, OneTrust) 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 cookies
  • A returning visitor loads the page and a choice was already saved (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 instead of Maglr's default banner. Enable manual consent mode in your interface settings (Activate cookie consent notification → manual / third-party option).


In this mode Maglr does not show its own banner. Your CMP owns the UI; Maglr only receives the resulting choice.


Direction

Event / API

Purpose

Your CMP → Maglr

MaglrCustomCookieConsent

Report the visitor's choice (true or false)

Your CMP → Maglr

window.setMaglrConsent(true \ false)

Same as above, via a global function

Maglr → your CMP

MaglrRequestShowCookieConsent

Maglr asks your CMP to show its banner again (for example when Maglr needs consent for a blocked action)



Whenever your CMP knows the visitor's choice, send it to Maglr — on first choice, on page load if a choice already exists in your CMP, and again when the visitor changes or withdraws consent:


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

// Reject / withdraw
document.dispatchEvent(new CustomEvent("MaglrCustomCookieConsent", {
detail: { consented: false }
}));

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

Updated on: 08/08/2026