Skip to content

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.

consent-form-screenshot


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.

  1. check out this branch and yarn install
  2. edit your /etc/hosts file and set design.gitlab.com to your current address
  3. run GOOGLE_ANALYTICS_ID=G-Q7ZZYS300Y yarn start
  4. wait for nuxt to compile and visit http://design.gitlab.com:2018/ in your browser
  5. open the network tab in the dev tools and observe regular requests sent to www.google-analytics.com/g/collect?... google-analytics-activity
  6. open the cookie consent form via the link at the bottom of the page: consent-banner-trigger
  7. disable "Performance and Analytics Cookies" and select "Confirm My Choices"
  8. observe that the connections to www.google-analytics.com no longer occur while navigating the website
  9. delete the _ga* cookies within the developer console storage tab and observe that they do not come back on subsequent visits
  10. 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

Merge request reports