Add gtm tracking for GitLab export project imports
What does this MR do and why?
This MR resolves the second item in gitlab-com/marketing/digital-experience/buyer-experience#259 (closed).
It adds the data-platform
attribute to the GitLab export link in app/views/projects/_import_project_pane.html.haml
, which allows us to track saasTrialProject
events through Google Tag Manager, passing in the gitlab_export
value to saasProjectImport
.
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/users/sign_up
- Walk through the sign up flow until you get to
http://localhost:3000/users/sign_up/projects/new
- Click the Import tab.
- Go to the tag assistant window and make sure you're looking at the Data Layer tab
- Click the GitLab export button
- Verify tag assistant captured the event. It should look something like this:
{
event: "saasTrialProjectImport",
gtm: {uniqueEventId: 6, start: 1641850855608},
saasProjectImport: "gitlab_export"
}
The uniqueEventId
and start
values will likely be different. The rest should be the same.
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.