Skip to content

Add google tag manager nonce config to gitlab chart

Nicolas Dular requested to merge add-google-tag-manager-id into master

What does this MR do?

Enabled to add GTM ID to our config. Adding this ID is part of a customer-critical-merge-request: gitlab-org/gitlab!58494 (comment 740556436)

How to Test

  1. Install overriding the site URL:
$ h upgrade --install gitlab . \
   --set global.hosts.domain=<local_ip>.nip.io \ 
   --set global.appConfig.extra.googleTagManagerNonceId='GTM-NJXWQL' \
   --set global.hosts.gitlab.name=gitlab.com  \
   -f examples/kind/values-base.yaml -f examples/kind/values-ssl.yaml
  1. Override host name:
echo "gitlab.com <local_ip>" >> /etc/hosts
  1. turn on feature flag:
/srv/gitlab/bin/rails console
Feature.enable(:gtm_nonce)
  1. use curl to confirm (we have to ignore SSL cert issues completely and browsers are not quite willing to do that):
$ curl -s -k -L https://gitlab.com/users/sign_up | grep google
'https://www.googletagmanager.com/gtm.js?id='+i+dl;var n=d.querySelector('[nonce]');
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-NJXWQL"

Related issues

Checklist

See Definition of done.

For anything in this list which will not be completed, please provide a reason in the MR discussion.

Required

  • Merge Request Title and Description are up to date, accurate, and descriptive
  • MR targeting the appropriate branch
  • MR has a green pipeline on GitLab.com

Expected (please provide an explanation if not completing)

Edited by Nicolas Dular

Merge request reports