Update GTM to capture trial form saasTrialGroup event
What does this MR do and why?
This MR resolves the first item in gitlab-com/marketing/digital-experience/buyer-experience#259 (closed).
It updates the trackSaasTrialGroup
Google Tag Manager function to track saasTrialGroup
events with the js-saas-trial-group
selector, which allows us to track these events across https://gitlab.com/-/trials/select
and https://gitlab.com/users/sign_up/groups/new
This is part of a broader effort to instrument GitLab with Google Tag Manager, tracked in gitlab-com/marketing/digital-experience&43 (closed).
How to set up and validate locally
- 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.
- Enable the relevant feature flags
Feature.enable(:ecomm_instrumentation) Feature.enable(:gtm_nonce) Feature.enable(:gitlab_gtm_datalayer)
- In
gitlab.yml
, add 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'
- Open the Google Tag Assistant and point it to
http://localhost:3000/-/trial_registrations/new
- Walk through the trial flow until you get to
/-/trials/select
- Create a group or use an existing group for your user
- Click "start your free trial" and check that the Google Tag Assistant registers the
saasTrialGroup
in thedataLayer
I also added a feature spec and Jest spec to verify the behavior.
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.
Edited by Tyler Williams