Commit 80e26017 authored by Natalia Tepluhina's avatar Natalia Tepluhina

Merge branch 'rkuba-master-patch-62787' into 'master'

Updated tracking keys based on product feedback

See merge request gitlab-org/gitlab!31629
parents e9500f28 82d6ae29
...@@ -259,8 +259,10 @@ export default { ...@@ -259,8 +259,10 @@ export default {
}); });
}, },
trackEvent() { trackEvent() {
// TODO: This needs to be made aware of referers, or if it's rendered in a different context than a Issue
trackDesignDetailView( trackDesignDetailView(
'issue-design-collection', 'issue-design-collection',
'issue',
this.$route.query.version || this.latestVersionId, this.$route.query.version || this.latestVersionId,
this.isLatestVersion, this.isLatestVersion,
); );
......
...@@ -4,8 +4,9 @@ function assembleDesignPayload(payloadArr) { ...@@ -4,8 +4,9 @@ function assembleDesignPayload(payloadArr) {
return { return {
value: { value: {
'internal-object-refrerer': payloadArr[0], 'internal-object-refrerer': payloadArr[0],
'version-number': payloadArr[1], 'design-collection-owner': payloadArr[1],
'current-version': payloadArr[2], 'design-version-number': payloadArr[2],
'design-is-current-version': payloadArr[3],
}, },
}; };
} }
...@@ -14,9 +15,14 @@ function assembleDesignPayload(payloadArr) { ...@@ -14,9 +15,14 @@ function assembleDesignPayload(payloadArr) {
const DESIGN_TRACKING_PAGE_NAME = 'projects:issues:design'; const DESIGN_TRACKING_PAGE_NAME = 'projects:issues:design';
// eslint-disable-next-line import/prefer-default-export // eslint-disable-next-line import/prefer-default-export
export function trackDesignDetailView(refrerer = '', designVersion = 1, latestVersion = false) { export function trackDesignDetailView(
referer = '',
owner = '',
designVersion = 1,
latestVersion = false,
) {
Tracking.event(DESIGN_TRACKING_PAGE_NAME, 'design_viewed', { Tracking.event(DESIGN_TRACKING_PAGE_NAME, 'design_viewed', {
label: 'design_viewed', label: 'design_viewed',
...assembleDesignPayload([refrerer, designVersion, latestVersion]), ...assembleDesignPayload([referer, owner, designVersion, latestVersion]),
}); });
} }
...@@ -22,8 +22,9 @@ describe('Tracking Events', () => { ...@@ -22,8 +22,9 @@ describe('Tracking Events', () => {
label: eventName, label: eventName,
value: { value: {
'internal-object-refrerer': '', 'internal-object-refrerer': '',
'version-number': 1, 'design-collection-owner': '',
'current-version': false, 'design-version-number': 1,
'design-is-current-version': false,
}, },
}), }),
); );
...@@ -32,7 +33,7 @@ describe('Tracking Events', () => { ...@@ -32,7 +33,7 @@ describe('Tracking Events', () => {
it('trackDesignDetailView allows to customize the value payload', () => { it('trackDesignDetailView allows to customize the value payload', () => {
const trackingSpy = getTrackingSpy(eventKey); const trackingSpy = getTrackingSpy(eventKey);
trackDesignDetailView('from-a-test', 100, true); trackDesignDetailView('from-a-test', 'test', 100, true);
expect(trackingSpy).toHaveBeenCalledWith( expect(trackingSpy).toHaveBeenCalledWith(
eventKey, eventKey,
...@@ -41,8 +42,9 @@ describe('Tracking Events', () => { ...@@ -41,8 +42,9 @@ describe('Tracking Events', () => {
label: eventName, label: eventName,
value: { value: {
'internal-object-refrerer': 'from-a-test', 'internal-object-refrerer': 'from-a-test',
'version-number': 100, 'design-collection-owner': 'test',
'current-version': true, 'design-version-number': 100,
'design-is-current-version': true,
}, },
}), }),
); );
......
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