Commit c5c6155b authored by Alex Buijs's avatar Alex Buijs

Track event for onboarding issues experiment

Event tracked: popover_dismissed
parent 03310695
import $ from 'jquery'; import $ from 'jquery';
import { parseBoolean, getCookie, setCookie, removeCookie } from '~/lib/utils/common_utils'; import { parseBoolean, getCookie, setCookie, removeCookie } from '~/lib/utils/common_utils';
import { __ } from '~/locale'; import { __ } from '~/locale';
import Tracking from '~/tracking';
const COOKIE_NAME = 'onboarding_issues_settings'; const COOKIE_NAME = 'onboarding_issues_settings';
...@@ -18,6 +19,7 @@ function disposePopover(event) { ...@@ -18,6 +19,7 @@ function disposePopover(event) {
event.preventDefault(); event.preventDefault();
this.popover('dispose'); this.popover('dispose');
removeLearnGitLabCookie(); removeLearnGitLabCookie();
Tracking.event('Growth::Conversion::Experiment::OnboardingIssues', 'dismiss_popover');
} }
const showPopover = (el, path, footer, options) => { const showPopover = (el, path, footer, options) => {
......
...@@ -2,6 +2,7 @@ import $ from 'jquery'; ...@@ -2,6 +2,7 @@ import $ from 'jquery';
import { showLearnGitLabIssuesPopover } from '~/onboarding_issues'; import { showLearnGitLabIssuesPopover } from '~/onboarding_issues';
import { getCookie, setCookie, removeCookie } from '~/lib/utils/common_utils'; import { getCookie, setCookie, removeCookie } from '~/lib/utils/common_utils';
import setWindowLocation from 'helpers/set_window_location_helper'; import setWindowLocation from 'helpers/set_window_location_helper';
import Tracking from '~/tracking';
describe('Onboarding Issues Popovers', () => { describe('Onboarding Issues Popovers', () => {
const COOKIE_NAME = 'onboarding_issues_settings'; const COOKIE_NAME = 'onboarding_issues_settings';
...@@ -116,12 +117,20 @@ describe('Onboarding Issues Popovers', () => { ...@@ -116,12 +117,20 @@ describe('Onboarding Issues Popovers', () => {
describe('when dismissing the popover', () => { describe('when dismissing the popover', () => {
beforeEach(() => { beforeEach(() => {
jest.spyOn(Tracking, 'event');
document.querySelector('.learn-gitlab.popover .close').click(); document.querySelector('.learn-gitlab.popover .close').click();
}); });
it('deletes the cookie', () => { it('deletes the cookie', () => {
expect(getCookie(COOKIE_NAME)).toBe(undefined); expect(getCookie(COOKIE_NAME)).toBe(undefined);
}); });
it('sends a tracking event', () => {
expect(Tracking.event).toHaveBeenCalledWith(
'Growth::Conversion::Experiment::OnboardingIssues',
'dismiss_popover',
);
});
}); });
}); });
}); });
......
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