Hi Klaro team,
while implementing the Google Tag Manager integration as described in the Klaro tutorial
https://klaro.org/docs/tutorials/google_tag_manager
I noticed a potential ordering / race condition in the current example setup.
In my tests, the onAccept callback of the google-tag-manager service — which pushes custom events like klaro-google-ads-accepted — appears to fire before the onAccept callbacks of the google-ads and google-analytics services.
As a result, the klaro-google-ads-accepted event may trigger GTM to load or fire Google Ads–related tags before ad_storage, ad_user_data, etc. are updated to granted. In such a case, Google Ads or Analytics tags could potentially execute while consent is still in denied mode, leading to cookieless / denied-mode pings.
I might be missing something here, but I wanted to point this out for discussion, as Consent Mode v2 is sensitive to the exact consent state at the moment a tag or event fires.
Warm regards
