Commit 3b56ecf8 authored by Illya Klymov's avatar Illya Klymov

Merge branch 'onboarding-experiment-frontend-tracking' into 'master'

Onboarding experiment frontend tracking

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