Articles on: Settings & configurations

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

Maglr's cookie consent tells Google Tag Manager (GTM) and your own scripts whether a visitor of your publication accepted cookies. You can collect that choice in two ways:


  • Maglr's cookie consent banner: a built-in banner with an accept and a reject button, set with Light mode or Strict mode.
  • Your own consent management platform (CMP): a tool such as Cookiebot, CookieFirst or OneTrust shows the banner and reports the choice to Maglr, set with Manual mode.


Light mode, Strict mode and Manual mode are the options of the Consent mode setting. Cookie consent is set per domain, so it applies to every publication on that domain.




To show Maglr's own cookie consent banner on the publications of a domain:


  1. In the dashboard, open Settings → Domain names.
  2. Click the pencil button next to the domain your publication is on.
  3. In the Statistics & integration section, turn on Activate cookie consent notification.
  4. Under Consent mode, choose Light mode or Strict mode.
  5. Click Save changes.


Only Super admins see Domain names in Settings.


Image: Maglr's default cookie consent


The two banner modes differ in what runs before the visitor accepts:


  • Light mode: Maglr's privacy-friendly statistics run, and a directly connected Google Analytics runs anonymously. After the visitor accepts, YouTube and Vimeo videos can play, and a directly connected Google Analytics also runs without anonymisation, unless Activate Google Analytics in anonymous mode is on.
  • Strict mode: Maglr's statistics, a directly connected Google Analytics, and YouTube and Vimeo videos only run after the visitor accepts.


In both modes, the contact and registration forms in the publication's menu can only be sent after the visitor accepts, because they use reCAPTCHA.


For what each mode does in detail, see Configure cookie consent.




Maglr pushes the visitor's cookie consent choice to the GTM dataLayer, so you can fire GTM tags only when a visitor accepts cookies, or when they accepted during a previous visit. This needs two settings in the domain's Statistics & integration section:


  • Google Tag Manager is connected: Google Analytics or GTM is on, Integration type is Google Tag Manager, and your GTM code is filled in.
  • Activate cookie consent notification is on, in any Consent mode. Without cookie consent turned on, Maglr doesn't push the consent event.


Maglr always loads your GTM container, whatever the visitor chose and in every Consent mode, including Strict mode. Maglr doesn't block GTM tags. Each GTM tag that needs consent must use the consent trigger described in Creating the consent trigger in GTM.


The maglrConsentChanged data layer event


When the visitor's cookie consent choice is known, Maglr pushes a custom event to the GTM data layer:


Key

Value

event

maglrConsentChanged

maglrCookieConsented

true or false


Maglr pushes this event when:


  • A visitor accepts or rejects cookies.
  • A returning visitor loads the page and a choice was already saved in Maglr's MaglrCookieConsent cookie.


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


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



The consent variable reads the visitor's choice (true or false) from Maglr's maglrConsentChanged data layer event. To create it in Google Tag Manager:


  1. Go to Variables.
  2. Under User-Defined Variables, click New.
  3. Click Variable Configuration and choose Data Layer Variable.
  4. In Data Layer Variable Name, enter maglrCookieConsented.


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


  1. Name the variable maglrCookieConsented.
  2. Click Save.


The variable now contains true or false.



The consent trigger fires on Maglr's maglrConsentChanged data layer event when the visitor accepted cookies. It uses the maglrCookieConsented variable (see Creating the consent variable in GTM). To create it in Google Tag Manager:


  1. Go to Triggers and click New.
  2. Click Trigger Configuration and choose Custom Event.
  3. In Event name, enter maglrConsentChanged.
  4. Under This trigger fires on, choose Some Custom Events.
  5. Set the condition to maglrCookieConsented equals true.
  6. Name the trigger maglrConsentChanged.
  7. Click Save.


Image: setting up the 'maglrConsentChanged' trigger


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



To make a GTM tag (such as the Google Tag) run only after a visitor accepts cookies, attach the maglrConsentChanged consent trigger to it in Google Tag Manager:


  1. Open the tag.
  2. Click Triggering.
  3. Choose the maglrConsentChanged trigger.


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


  1. Remove any other firing trigger from the tag, such as All Pages or Initialization - All Pages. Otherwise the tag also fires without consent.
  2. Click Save.
  3. Click Submit to publish your GTM container. The change takes effect on your publication only after you publish the container.


Choose the maglrConsentChanged trigger, and don't use maglrCookieConsented as an event name. maglrCookieConsented is the data layer variable, not the event, so a trigger with that event name never fires.




You can use your own consent management platform (CMP), such as Cookiebot, CookieFirst or OneTrust, instead of Maglr's cookie consent banner. With Manual mode, Maglr doesn't show its own banner. Your CMP shows the consent banner; Maglr only receives the visitor's choice.


Your CMP and Maglr communicate through these events and this function:


Direction

Event / API

Purpose

Your CMP → Maglr

MaglrCustomCookieConsent

Report the visitor's choice (true or false)

Your CMP → Maglr

window.setMaglrConsent(true) or window.setMaglrConsent(false)

Report the visitor's choice through a global function, including a withdrawal after an accept

Maglr → your CMP

MaglrRequestShowCookieConsent

Maglr asks your CMP to show its banner again, when a visitor clicks a YouTube or Vimeo video or opens the contact or registration form in the publication's menu (these forms use reCAPTCHA)

Maglr → GTM

maglrConsentRequested

The same request, pushed to the GTM data layer as an event


In Manual mode, Maglr holds back its own statistics until the visitor accepts, but it doesn't hold back a directly connected Google Analytics. Connect Google Analytics through Google Tag Manager instead, and fire it on your CMP's consent.


Turning on Manual mode


Manual mode hides Maglr's cookie consent banner, so your own CMP can collect the visitor's choice. To turn it on:


  1. In the dashboard, open Settings → Domain names.
  2. Click the pencil button next to the domain your publication is on.
  3. In the Statistics & integration section, turn on Activate cookie consent notification.
  4. Under Consent mode, choose Manual mode.
  5. Click Save changes.


Only Super admins see Domain names in Settings.


Reporting the visitor's choice to Maglr


In Manual mode, your CMP reports the visitor's cookie consent choice to Maglr with the MaglrCustomCookieConsent event or the window.setMaglrConsent function:


  • First choice: send the MaglrCustomCookieConsent event, or call window.setMaglrConsent(true) or window.setMaglrConsent(false).
  • Withdrawal after an accept, on the same page visit: call window.setMaglrConsent(false). After a visitor accepts, Maglr stops listening to the MaglrCustomCookieConsent event, so a consented: false event sent after an accept is ignored.
  • Before calling the function: check that it exists with if (window.setMaglrConsent).


Maglr saves the visitor's choice in its own MaglrCookieConsent cookie for 365 days. When a page loads with this cookie set, Maglr uses the saved choice. At that point it doesn't listen to the MaglrCustomCookieConsent event and doesn't define window.setMaglrConsent. On such a page, a choice your CMP reports, including a withdrawal, doesn't reach Maglr until Maglr asks for consent on that page (see Showing your banner when Maglr asks for consent). Calling window.setMaglrConsent before then, without the check, causes a JavaScript error.


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

// First choice: reject
document.dispatchEvent(new CustomEvent("MaglrCustomCookieConsent", {
detail: { consented: false }
}));

// Withdrawal after an accept: use the global function
if (window.setMaglrConsent) {
window.setMaglrConsent(false);
}
</script>



In Manual mode, Maglr asks your CMP to show its consent banner again when a visitor who hasn't accepted cookies clicks a YouTube or Vimeo video, or opens the contact or registration form in the publication's menu (these forms use reCAPTCHA and can't be sent until the visitor accepts). Maglr then dispatches the MaglrRequestShowCookieConsent event on document. To open your CMP's banner, listen for it:


document.addEventListener("MaglrRequestShowCookieConsent", function () {
// open your CMP's consent banner here
});


At the same moment, Maglr pushes {event: "maglrConsentRequested"} to the GTM data layer. If your CMP runs through Google Tag Manager, you can use a Custom Event trigger on maglrConsentRequested instead.


If the visitor arrived with a choice already saved in Maglr's MaglrCookieConsent cookie, the first such click or form opening on that page doesn't dispatch MaglrRequestShowCookieConsent. It makes Maglr start listening to the MaglrCustomCookieConsent event and define window.setMaglrConsent, so your CMP can report the choice from then on. Maglr dispatches MaglrRequestShowCookieConsent from the next request on that page.



Frequently asked questions


Does Maglr block my Google Tag Manager tags until a visitor accepts cookies?


No. Maglr always loads your Google Tag Manager container, whatever the visitor chose and in every Consent mode, including Strict mode. To run a tag only after consent, fire it on a Custom Event trigger for Maglr's maglrConsentChanged event with the condition maglrCookieConsented equals true.



Maglr remembers the choice for 365 days. It saves the choice in the MaglrCookieConsent cookie on the publication's domain and uses it on the visitor's later visits.



No. Consent mode is one setting per domain: Light mode and Strict mode show Maglr's cookie consent banner, and Manual mode hides it so your own consent management platform (CMP) can collect the choice.

Updated on: 19/10/2026