GA4: gtag gitlab.com

## Goal
Google Consent Mode enables the machine learning modeling features within GA4, Google Ads, and Campaign Manager to fill in the data gap for users who opt out via OneTrust cookie consent.

Step by step implementation guide: https://community.cookiepro.com/s/article/UUID-d81787f6-685c-2262-36c3-5f1f3369e2a7?language=en_US

Place the default `gtag` script *before* the Google Tag Manager and OneTrust scripts across **gitlab.com** pages. See list of page below, as not all pages on this subdomain is tracked. 

Gtag script logic: By default, deny cookie storage for users from the EU, UK, Peru, and Russia; grant cookie storage for all other geolocation. Later on, Google Consent Mode will be enabled on OneTrust, which will dynamically update the values to "denied" or "granted" based on the user's preference. 

```
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}

  gtag('consent', 'default', {
    'analytics_storage': 'granted',
    'ad_storage': 'granted',
    'functionality_storage': 'granted',
    'wait_for_update': 500
  });

  gtag('consent', 'default', {
    'analytics_storage': 'denied',
    'ad_storage': 'denied',
    'functionality_storage': 'denied',
    'region': ['AT', 'BE', 'BG', 'HR', 'CY', 'CZ', 'DK', 'EE', 'FI', 'FR', 'DE', 'GR', 'HU', 'IE', 'IT', 'LV', 'LT', 'LU', 'MT', 'NL', 'PL', 'PT', 'RO', 'SK', 'SI', 'ES', 'SE', 'IS', 'LI', 'NO', 'GB', 'PE', 'RU'],
    'wait_for_update': 500
  });
</script>

<!-- Google Tag Manager -->
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-NJXWQL');</script>
<!-- End Google Tag Manager -->

<!-- OneTrust Cookies Consent Notice start -->
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"  type="text/javascript" charset="UTF-8" data-domain-script="XXXXXX" ></script>
<script type="text/javascript">
function OptanonWrapper() { }
</script>
<!-- OneTrust Cookies Consent Notice end -->
```


## Page(s)
Which page(s) are involved in this request?
- **gitlab.com/users/sign_in** (Please add the GTM Snippet. This is the only page missing GTM.) 
- gitlab.com/-/profile/usage_quotas
- gitlab.com/-/subscriptions/buy_minutes
- gitlab.com/-/subscriptions/new
- gitlab.com/-/trial_registrations
- gitlab.com/-/trial_registrations/new
- gitlab.com/-/trials/apply
- gitlab.com/-/trials/create_lead
- gitlab.com/-/trials/new
- gitlab.com/-/trials/select
- gitlab.com/-/users/terms
- gitlab.com/groups/ForgottenDream/-/usage_quotas
- gitlab.com/users
- gitlab.com/users/almost_there
- gitlab.com/users/sign_up
- gitlab.com/users/sign_up/groups_projects
- gitlab.com/users/sign_up/groups_projects/import
- gitlab.com/users/sign_up/groups_projects/new
- gitlab.com/users/sign_up/groups/new
- gitlab.com/users/sign_up/welcome



## DCI
[DRI, Consulted, Informed](https://about.gitlab.com/handbook/people-group/directly-responsible-individuals/#dri-consulted-informed-dci)

- [ ] DRI: @laurenbarker @justin.vetter 
- [ ] Consulted: @dennischarukulvanich 
- [ ] Informed: @mpreuss22 
- [ ] [MR](https://gitlab.com/gitlab-org/gitlab-development-kit/-/merge_requests/2646)

## Requirements
What are the requirements for this request? Checklist below is an example of common requirements, please check all that apply and adjust as necessary:

- [ ] Copy writing
- [ ] Illustration
- [ ] Custom Graphics
- [ ] Research
- [x] Data / Analytics
- [ ] UX Design
- [x] Engineering

Story points: 1.0