GA4: gtag about.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 all about.gitlab.com pages.
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-XXXXXX');</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?
- All about.gitlab.com pages
- @dennischarukulvanich to verify that GA4 is running properly on about.gitlab.com
DCI
-
DRI: @laurenbarker @justin.vetter -
Consulted: @dennischarukulvanich -
Informed: @mpreuss22
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 -
Data / Analytics -
UX Design -
Engineering