Skip to content
ceaksan
PREMIUM gtm

T-Soft Cookie Law and Google Consent Mode V2 Incompatibility: Analysis and Solution

Logic errors in T-Soft's cookie law structure, Google Consent Mode V2 incompatibility, and a GTM Custom HTML solution using monkey-patching.

Jan 16, 2026 Updated: Apr 8, 2026
TL;DR

T-Soft's cookie law structure loses consent state on page reload and doesn't support Google Consent Mode V2 parameters. The code solution presented here reads the cookie directly via theme JavaScript or GTM Custom HTML to manage consent state properly.

Membership Required

You need to sign in and have a Premium subscription to access this content.

Key Takeaways
  • 01 T-Soft COOKIE_LAW init() function does an early return when existing consent is found, skipping updateConsentMode
  • 02 Google Consent Mode V2 requires ad_user_data and ad_personalization parameters, but T-Soft doesn't support them
  • 03 GTM Consent Initialization trigger is the earliest execution point for consent management
  • 04 Monkey-patching enables consent update flow without modifying provider code
  • 05 ES5 compatibility is mandatory for GTM Custom HTML
Frequently Asked Questions (FAQ)
+ Why is T-Soft's cookie law structure incompatible with Google Consent Mode V2?

T-Soft's COOKIE_LAW structure uses plain dataLayer.push with events instead of gtag('consent', 'default/update'). It also lacks the ad_user_data and ad_personalization parameters. Due to early return in init(), consent state can be lost on page reloads.

+ What can I do if I can't modify the provider's code?

You can use a GTM Custom HTML tag with a Consent Initialization trigger to manage the missing default and update states yourself. By monkey-patching the savePreferences function, you can capture user preferences instantly.

+ Why use ES5 in GTM Custom HTML?

GTM's Custom HTML field uses an older JavaScript validator by default. ES6+ features like const, let, and arrow functions are flagged as errors. Therefore, var and function syntax should be preferred.

+ What's the difference between Consent Initialization and Initialization triggers?

Consent Initialization is GTM's earliest-firing trigger, specifically designed for Google Consent Mode. It ensures consent state is determined before all other tags (GA4, Ads, etc.) fire. Initialization runs immediately after but may briefly have undetermined consent.

+ Which T-Soft versions does the solution script work with?

The script works with all T-Soft versions that use the SNIPPET_JS['COOKIE_LAW'] object. The cookie name (t-cookie-law or t-cookie-consent) may vary by store configuration; this value should be checked in the script.