Commit 78508215 authored by David O'Regan's avatar David O'Regan

Merge branch 'feature/add-import-project-gtm-events-to-combined-form' into 'master'

Add import project GTM events to combined form

See merge request gitlab-org/gitlab!81176
parents 1b74e49d d360a3c8
......@@ -150,7 +150,7 @@ export const trackSaasTrialProject = () => {
});
};
export const trackSaasTrialProjectImport = () => {
export const trackProjectImport = () => {
if (!isSupported()) {
return;
}
......@@ -159,7 +159,7 @@ export const trackSaasTrialProjectImport = () => {
importButtons.forEach((button) => {
button.addEventListener('click', () => {
const { platform } = button.dataset;
pushEvent('saasTrialProjectImport', { saasProjectImport: platform });
pushEvent('projectImport', { platform });
});
});
};
......
......@@ -2,8 +2,9 @@
import mountComponents from 'ee/registrations/groups_projects/new';
import Group from '~/group';
import { trackCombinedGroupProjectForm } from '~/google_tag_manager';
import { trackCombinedGroupProjectForm, trackProjectImport } from '~/google_tag_manager';
new Group();
mountComponents();
trackCombinedGroupProjectForm();
trackProjectImport();
import initProjectVisibilitySelector from '~/projects/project_visibility';
import initProjectNew from '~/projects/project_new';
import { trackSaasTrialProject, trackSaasTrialProjectImport } from '~/google_tag_manager';
import { trackSaasTrialProject, trackProjectImport } from '~/google_tag_manager';
initProjectVisibilitySelector();
initProjectNew.bindEvents();
trackSaasTrialProject();
trackSaasTrialProjectImport();
trackProjectImport();
......@@ -3,12 +3,12 @@ import { v4 as uuidv4 } from 'uuid';
import {
trackCombinedGroupProjectForm,
trackFreeTrialAccountSubmissions,
trackProjectImport,
trackNewRegistrations,
trackSaasTrialSubmit,
trackSaasTrialSkip,
trackSaasTrialGroup,
trackSaasTrialProject,
trackSaasTrialProjectImport,
trackSaasTrialGetStarted,
trackCheckout,
trackTransaction,
......@@ -150,20 +150,20 @@ describe('~/google_tag_manager/index', () => {
createTestCase(trackSaasTrialProject, {
forms: [{ id: 'new_project', expectation: { event: 'saasTrialProject' } }],
}),
createTestCase(trackSaasTrialProjectImport, {
createTestCase(trackProjectImport, {
links: [
{
id: 'js-test-btn-0',
cls: 'js-import-project-btn',
attributes: { 'data-platform': 'bitbucket' },
expectation: { event: 'saasTrialProjectImport', saasProjectImport: 'bitbucket' },
expectation: { event: 'projectImport', platform: 'bitbucket' },
},
{
// id is neeeded so we trigger the right element in the test
id: 'js-test-btn-1',
cls: 'js-import-project-btn',
attributes: { 'data-platform': 'github' },
expectation: { event: 'saasTrialProjectImport', saasProjectImport: 'github' },
expectation: { event: 'projectImport', platform: 'github' },
},
],
}),
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment