we're in process of building a public website(No login) based on Lightning community We're planning to use google analytics(GA) in our website and also try to be GDPR/PECR compliant. As per regulation, it seems we need to provide cookie banner and have to give option to external user to give his/her consent before storing GA Cookies.
But what we know, GA traking id is set in community level(builder) and once it is set, Salesoforce provide no way to stop Google for storing its cookies.
Question is - how can I stop storage of GA cookies, if suppose in community user doesn't give his/her consent?
In our analysis we find, Google provides option for opt-out: https://developers.google.com/analytics/devguides/collection/analyticsjs/user-opt-out
But this works on 'Window' object. As far as I know actual window object is not exposed because of locker service so we can't modify its properties.
Is there any way out ? One option I think- we've to? delete GA cookies on load of every page, if user has not given his/her consent but is that correct approach?