Articles on: Settings & configurations

Configure cookie consent through GTM

When you're looking to activate external trackers & scripts in your Maglr publications, a cookie consent is often required. Through Google Tag Manager you can 'listen' and activate Tags based on this consent status. Additionally you can use Maglr's default cookie consent, or use third-party consent managers to add your own custom cookie consent to Maglr.

Image: Maglr's default cookie consent

Listening to the Cookie Consent with Google Tag Manager



The live status of the cookie consent is pushed to the DataLayer. With variables, triggers, and tags, you can activate scripts whenever your visitors accept the cookie consent (or when they had already accepted it during a previous visit).

Create a variable


In Google Tag Manager, create a 'Data layer variable' with the name ‘maglrCookieConsented’. This variable can contain the value ‘true’ of ‘false’.

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

Setting up a trigger


Next, add the 'Custom event' trigger and name it 'maglrConsentChanged'. Activate this trigger on 'some custom events', when 'maglrCookieConsented' equals 'true'. Whenever the page is loaded (and the consent has previously been accepted), or whenever your visitor accepts the cookie consent, the event is fired.

Image: setting up the 'maglrConsentChanged' trigger

Adding the trigger to a tag


Now you can create Tags, such as the Google Tag, and configure it to fire whenever the 'maglrCookieConsented' custom event is triggered.

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

Controlling consent through third-party applications


It's also possible to connect third-party applications, such as Cookiebot or CookieFirst, through Google Tag Manager. This adds your very own custom cookie consent in your Maglr publications, allowing you to maintain full control over the consent status.

If you would like to place your custom cookie consent in your Maglr publications, please contact us via info@maglr.com

Updated on: 04/12/2023