Skip to content

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

  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. Enable the relevant feature flags
    Feature.enable(:ecomm_instrumentation)
    Feature.enable(:gtm_nonce)
    Feature.enable(:gitlab_gtm_datalayer)
  3. In gitlab.yml, add 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. Open the Google Tag Assistant and point it to http://localhost:3000/users/sign_up
  5. Walk through the sign up flow until you get to http://localhost:3000/users/sign_up/projects/new
  6. Click the Import tab.
  7. Go to the tag assistant window and make sure you're looking at the Data Layer tab
  8. Click the GitLab export button
  9. 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.

Merge request reports

Loading