Add to cart event for Google Tag Manager
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
Screenshots or screen recordings
Watch the local verification video
How to set up and validate locally
Manual verification
- 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.
- In
gitlab.yml
, add a your GTM ID in theextra
block for both thegoogle_tag_manager_id
andgoogle_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'
- Enable the following feature flags
Feature.enable(:gitlab_gtm_datalayer) Feature.enable(:ecomm_instrumentation) Feature.enable(:gtm_nonce)
- Open the Google Tag Assistant and point it to http://localhost:3000/-/profile/usage_quotas#pipelines-quota-tab
- Click "Buy Additional Minutes"
- Check the
dataLayer
tag in the tag assistant and verify theecommerce
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 evaluated the MR acceptance checklist for this MR.
I have informed the Infrastructure department of a default setting or new setting change per definition of done, or decided that this is unnecessary.