Hello <@U8X7E86M6>, we noticed that our custom Coo...
# suitecommerce
r
Hello @Steve Goldberg, we noticed that our custom Cookie Consent breaks the SuiteCommerce Analytics so we moved to using SC Cookie Consent, however, I noticed that it still does not support Google Cookie Consent v2. I also don't see a documentation about it until now... can you confirm if this is really the case and we need to build an extension to implement v2 and friendly to SuiteCommerce Analytics? Since v2 was released late 2023-March 2024, and SC Cookie Consent was released 2021, I am not sure when it was last updated.
s
I don't know anything about Google Cookie Consent v2
m
Hi Roj, we have the same issue, we build a new cookie consent extension and sent the correct values to the data layer to manage Google Consent v2.
r
@Martin, thank you! We are moving back to our custom Cookie Consent extension now, and I will just figure out why the SC Analytics is not working here. It's made by another dev so I need review it first. @Steve Goldberg, thank you! I think that will be helpful for me for the SC Analytics concern. For the v2, https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced. Google actually requires new parameters and SC extension does not have those.
m
We tried using the SC Cookie Consent for Google Consent v2 but was not returing the correct values, that is why we used a custom solution, you should override the mountToApp of GoogleTagManager to init the consent correctly for GTM
For a strange reason google ask to define a function before pushing the consent for GTM it doesnt work just using dataLayer.push
Copy code
function gtag() {
    window[Configuration.get('tracking.googleTagManager').dataLayerName].push(arguments);
}
Copy code
gtag('consent', 'default', {
    ad_storage: consentSettings.google_ads ? 'granted' : 'denied',
    ad_user_data: consentSettings.google_ads ? 'granted' : 'denied',
    ad_personalization: consentSettings.google_ads ? 'granted' : 'denied',
    analytics_storage: 'granted',
    functionality_storage: 'granted',
    personalization_storage: 'granted',
    security_storage: 'granted'
});
this need to run right before this
Copy code
window[this.configuration.dataLayerName].push({
    'gtm.start': new Date().getTime(),
    'event': 'gtm.js'
});
I hope this works! šŸ™‚
@Steve Goldberg the issue with the functions that you share is that they return the values the first time, if you refresh the page in the checkout for example the function only retun the consent last update and you can't update the GTM consent:
āœ… 1
Also this "This method only affects the cookie preferences of website visitors who are logged in. If the visitor is not logged in, it returns
null
." You can have cookie consent value without been logged in
r
Thank you @Martin! These are allo helpful