GDPR 2.0 - Extend GTM Support
Hi,
I am using BeTheme’s built-in GDPR 2.0 / Google Consent Mode popup together with Google Tag Manager.
The theme appears to handle the Google consent update itself, which is good. From the theme script, I can see that when saved consent exists, BeTheme reads the mfnConsent cookie and calls:
gtag('consent', 'update', consents);
When the visitor accepts all, selects specific categories or denies consent, BeTheme also updates consent through:
gtag('consent', 'update', consents);
then saves the mfnConsent cookie and closes the popup.
However, as far as I can tell, BeTheme does not currently push a GTM-compatible dataLayer event when consent is updated. It does trigger a jQuery event after the popup closes:
$(document).trigger('mfn:gdpr2:close');
but Google Tag Manager cannot use that directly as a Custom Event trigger.
This creates a practical issue for GTM setups.
For example, if a Google Tag or GA4 page_view tag is blocked on the initial page load because analytics consent is denied, the tag does not automatically fire later when the visitor gives consent. On the next page reload, everything works because the mfnConsent cookie has been saved and BeTheme updates the consent state on page load.
The missing scenario is:
- A visitor lands on the site for the first time.
- Consent defaults to denied.
- GTM evaluates the GA4 / Google tags and blocks them because consent has not yet been granted.
- The visitor accepts analytics consent using the BeTheme popup.
- BeTheme correctly updates Google consent, but GTM has no
dataLayerevent to trigger the relevant tags immediately. - The first page view is therefore missed unless the visitor reloads or visits another page.
This can be worked around with a custom script listening for BeTheme’s popup buttons or the mfn:gdpr2:close jQuery event, then pushing a dataLayer event manually. However, it would be cleaner and more reliable if BeTheme exposed this natively.
Would you consider adding a dataLayer.push() event inside the BeTheme consent update flow, ideally inside consent.set() immediately after:
gtag('consent', 'update', consents);
For example:
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
event: 'mfn_consent_update',
mfn_consent: consents,
analytics_storage: consents.analytics_storage,
ad_storage: consents.ad_storage,
ad_user_data: consents.ad_user_data,
ad_personalization: consents.ad_personalization
});
This would allow Google Tag Manager users to create a Custom Event trigger for mfn_consent_update and fire permitted tags immediately after consent is granted, without needing a page reload or custom bridge script.
It would also make BeTheme’s Consent Mode integration much easier to use in a GTM setup, especially now that many Google tags are managed through GTM rather than being placed directly in the theme options.
Thanks.
Comments
Hi,
I have passed it on to the dev team, and I was informed that we will introduce your suggestions in upcoming updates.
Best regards
Brilliant, that's great.
Please support this with a documentation page somewhere that will ensure the correct triggers can be set up in GTM.