A business needed a custom Consent Mode V2 implementation that respected user privacy choices while still allowing GA4 and Google Ads to receive the correct consent signals.
The challenge
The cookie banner was functioning and sending cookieless pings, but the consent state was not updating immediately after the user accepted cookies or saved preferences.
This created a tracking risk: the user could accept cookies, but GTM and Google tags would still behave as if consent had not been updated until the next page load.
In some cases, this also affected traffic-source attribution because the
gclid parameter could be lost before consent was properly updated.
What I investigated
- Cookie banner behavior
- GTM consent state
- GA4 and Google Ads requests
gcsandgcdparametersad_storage,ad_user_dataandad_personalizationsignalsEM.cookie_policy.cookiesconsent objectsgclidpersistence after consent
The solution
I adjusted the Consent Mode V2 flow so the user’s choice was passed to GTM immediately after they interacted with the cookie banner, without waiting for another page load.
- Update the
EM.cookie_policy.cookiesobject in real time. - Push a
consent_updateevent into thedataLayer. - Use the
consent_updateevent as a GTM trigger. - Update Consent Mode signals through GTM.
- Separate Google Ads consent from Google Ads personalized advertising consent.
- Validate
ad_storage,ad_user_dataandad_personalizationindependently. - Confirm that
gclidvalues are preserved after cookie acceptance and navigation.
Result
After the update, GTM, GA4 and Google Ads received the correct consent state at the right moment, making the tracking setup more reliable.
It improved the accuracy of Google Ads conversion and remarketing tracking while keeping the setup aligned with privacy and consent requirements.