Add OneTrust installation script to non-product pages

Merged Axel García requested to merge 341430-onetrust-implementation-gitlab-com into master

What does this MR do and why?

As part of #341430, this MR adds the setup code for OneTrust, for the following pages:

  • Login page (app/views/devise/sessions/new.html.haml)
  • Sign up page (app/views/devise/registrations/new.html.haml)
  • Trial registration page (ee/app/views/trial_registrations/new.html.haml)

OneTrust would only run if the one_trust_id config value is provided, and there is no current_user. This is also behind the long-lived ecomm_instrumentation feature flag, which will be turned on for gitlab.com only. In the related issue, there are more details about the reasoning behind adding this script.

How to set up and validate locally

Validate OneTrust not running
  1. In rails console, make sure the feature flag is off
    Feature.disable(:ecomm_instrumentation)
  2. Optionally add the one_trust_id config value to your gitlab.yml file
    ## OneTrust
    one_trust_id: '_your_one_trust_id'
  3. Visit any of the listed pages above, such as http://127.0.0.1:3000/users/sign_in
  4. Check that OneTrust is not installed/invoked. Running OneTrust in the Javascript console to get an undefined error or checking the network requests.
Validate OneTrust running properly
  1. In rails console, make sure the feature flag is enabled
    Feature.enable(:ecomm_instrumentation)
  2. Add the one_trust_id config value to your gitlab.yml file
    ## OneTrust
    one_trust_id: '7f944245-c5cd-4eed-a90e-dd955adfdd08-test'
  3. Visit any of the listed pages above, such as http://127.0.0.1:3000/users/sign_in
  4. Check that OneTrust is installed and running. Running OneTrust in the Javascript console to get an object or checking the network requests.

MR acceptance checklist

This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.

Edited by Axel García