Consent Mode is a feature by Google that allows websites to adjust how they track users based on their consent choices regarding cookies, advertising, analytics, and other categories of data processing.
Stape created a Consent Parser variable that reads the encoded Consent Mode v2 string from the ‘gcd’ standard parameter of GA4 hit, decodes it, and returns the consent states for various categories (e.g., ad_storage, analytics_storage) in a readable format. This helps determine what data can be collected and processed based on user preferences.
This variable is useful for websites using Consent Mode to manage user privacy preferences, especially in the context of privacy laws like GDPR and CCPA. By decoding the consent string, server-side tags can selectively fire or avoid firing based on the user's consent, ensuring compliance with legal requirements.
2. To use this template in your workspace, open Google Tag Manager → choose Templates in the left menu → click Variables Templates field → press Search Gallery button → select Content Parser by Stape → press Add to workspace button.

3. Go to Variables in the left menu → press New button → click Variable Configuration field → choose Consent Parser → press Save button.

4. Go to Variables → New → Choose ‘Consent Parser’ → Click Save.
The variable works based on the ‘gcd’ parameter that collects GA4 automatically if your consent banner works with Google Consent Mode support.
The variable itself will find ‘gcd’ in the incoming hit and decode all the details in it into separate categories.

In the variable Analytics Debugger OpenAPI is used to decode the consent string.
This is a handy tool for parameter debugging that you can use online:
Here are three benefits of using the Consent Parser variable in server-side Google Tag Manager:
And if you’d like to read more about Consent Mode, here you can find some useful articles:
Stape has lots of tags for server GTM! Click on Try for free to register and check them all.
Comments