Skip to content

Add Google Tag Manager to /users/sign_in/ on SaaS

Tyler Williams requested to merge feature/add-google-tag-manager-to-sign-in into master

What does this MR do and why?

This MR is a part of gitlab-com/marketing/digital-experience/buyer-experience#990 (moved), specifically, we are adding Google Tag Manager to the /users/sign_in/ path on GitLab.com. It follows the conventions and uses tools set up in !38395 (merged).

I updated the spec for this view to check for the changes as well.

Screenshots or screen recordings

This is a screenshot of my local GDK working with gitlab_gtm_enabled and the Google Tag Manager config set up:

Screen_Shot_2022-07-08_at_11.49.58_AM

How to set up and validate locally

Numbered steps to set up and validate the change are strongly suggested.

  1. Set GITLAB_SIMULATE_SAAS=1 in your environment to make GDK act as SaaS, since this change only affects SaaS and requires it to render Google Tag manager.
  2. Create a Google Tag Manager account and container ID. You should just need to follow the step 1 of the instructions. The GTM container can be empty - it just needs to exist.
  3. In gitlab.yml, add a your GTM ID in the extra block for both the google_tag_manager_id and google_tag_manager_nonce_id values. Make sure to restart GDK (or do this step prior to starting GDK) for settings to take effect.
    extra:
     google_tag_manager_id: 'GTM-YOURIDHERE'
     google_tag_manager_nonce_id: 'GTM-YOURIDHERE'
  4. Start or restart your GDK
  5. bundle exec rails c to open the Rails console and enable a feature flag:
  6. Turn on Feature.enable(:gitlab_gtm_datalayer)
  7. Open the Google Tag Assistant
  8. Visit http://localhost:3000/users/sign_in/ from the Tag Assistant
  9. You should see the tag assistant connect, it'll look similar to the screenshot posted above.

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 Tyler Williams

Merge request reports