feat(OneTrust): Implement cookie consent modal
This MR selectively enables or disables the Google Analytics integration on design.gitlab.com based on the users' preference within the "Performance and Analytics Cookies" group in the OneTrust cookie consent modal.
Testing Locally
You will need to provide a Google Analytics ID when running this, and you will also need to spoof your domain name so that OneTrust thinks you're on design.gitlab.com
.
- check out this branch and
yarn install
- edit your
/etc/hosts
file and setdesign.gitlab.com
to your current address - run
GOOGLE_ANALYTICS_ID=G-Q7ZZYS300Y yarn start
- wait for nuxt to compile and visit
http://design.gitlab.com:2018/
in your browser - open the network tab in the dev tools and observe regular requests sent to
www.google-analytics.com/g/collect?...
- open the cookie consent form via the link at the bottom of the page:
- disable "Performance and Analytics Cookies" and select "Confirm My Choices"
- observe that the connections to
www.google-analytics.com
no longer occur while navigating the website - delete the
_ga*
cookies within the developer console storage tab and observe that they do not come back on subsequent visits - re-enable "Performance and Analytics Cookies" and observe that cookies are once again set and google analytics data are sent collected once again
closes gitlab-org/gitlab-services/design.gitlab.com#1220
Edited by Jeremy Elder