Skip to content

Draft: "add to cart" event to GTM dataLayer for usage tab

Lauren Barker requested to merge gitlab-com/buyer-experience#233 into master

What does this MR do and why?

Closes: gitlab-com/marketing/digital-experience/buyer-experience#233 (closed)

This MR adds the specified Google Tag Manager "add to cart" dataLayer event outlined by Empirical Path to the to the view at https://gitlab.com/-/profile/usage_quotas#pipelines-quota-tab so we can gather analytics in GTM enhanced ecommerce. The events are gated behind an ops flag so we can enable it on GitLab.com specifically.

This is a continuation of

Based on the approval guidelines, I believe I need the following:

  1. Approval by a backend maintainer since this MR makes changes to some controllers.
  2. Approval by a frontend maintainer, since this MR makes changes to views and JavaScript.
  3. Approval by a Product Intelligence engineer, since this MR includes analytics changes.
  4. Approval by a Quality maintainer or Quality reviewer since this MR includes additional feature specs.

Screenshots or screen recordings

Watch the local verification video

How to set up and validate locally

Manual verification

  1. 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.
  2. In gitlab.yml, add a your GTM ID in the extra block for both the google_tag_manager_id, google_tag_manager_nonce_id, and one_trust_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'
  3. Enable the following feature flags
    Feature.enable(:gitlab_gtm_datalayer)
    Feature.enable(:ecomm_instrumentation)
    Feature.enable(:gtm_nonce)
  4. Open the Google Tag Assistant and point it to http://localhost:3000/-/profile/usage_quotas#pipelines-quota-tab
  5. Click "Buy Additional Minutes"
  6. Check the dataLayer tag in the tag assistant and verify the ecommerce event is firing. Watch the local verification video to see how to check that.

MR acceptance checklist

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

I have informed the Infrastructure department of a default setting or new setting change per definition of done, or decided that this is unnecessary.

Edited by Lauren Barker

Merge request reports