Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
9694b8b3
Commit
9694b8b3
authored
Dec 07, 2020
by
Tom Quirk
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Export tracking constants for design management
parent
3638b00f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
23 additions
and
12 deletions
+23
-12
app/assets/javascripts/design_management/utils/tracking.js
app/assets/javascripts/design_management/utils/tracking.js
+11
-9
spec/frontend/design_management/pages/index_spec.js
spec/frontend/design_management/pages/index_spec.js
+12
-3
No files found.
app/assets/javascripts/design_management/utils/tracking.js
View file @
9694b8b3
...
...
@@ -5,16 +5,18 @@ import api from '~/api';
const
DESIGN_TRACKING_CONTEXT_SCHEMAS
=
{
VIEW_DESIGN_SCHEMA
:
'
iglu:com.gitlab/design_management_context/jsonschema/1-0-0
'
,
};
const
DESIGN_TRACKING_EVENTS
=
{
export
const
DESIGN_TRACKING_PAGE_NAME
=
'
projects:issues:design
'
;
export
const
DESIGN_SNOWPLOW_EVENT_TYPES
=
{
VIEW_DESIGN
:
'
view_design
'
,
CREATE_DESIGN
:
'
create_design
'
,
UPDATE_DESIGN
:
'
update_design
'
,
};
// Usage ping tracking constants
const
DESIGN_ACTION
=
'
design_action
'
;
export
const
DESIGN_TRACKING_PAGE_NAME
=
'
projects:issues:design
'
;
export
const
DESIGN_USAGE_PING_EVENT_TYPES
=
{
DESIGN_ACTION
:
'
design_action
'
,
};
/**
* Track "design detail" view in Snowplow
...
...
@@ -25,7 +27,7 @@ export function trackDesignDetailView(
designVersion
=
1
,
latestVersion
=
false
,
)
{
const
eventName
=
DESIGN_
TRACKING_EVENT
S
.
VIEW_DESIGN
;
const
eventName
=
DESIGN_
SNOWPLOW_EVENT_TYPE
S
.
VIEW_DESIGN
;
Tracking
.
event
(
DESIGN_TRACKING_PAGE_NAME
,
eventName
,
{
label
:
eventName
,
...
...
@@ -42,16 +44,16 @@ export function trackDesignDetailView(
}
export
function
trackDesignCreate
()
{
return
Tracking
.
event
(
DESIGN_TRACKING_PAGE_NAME
,
DESIGN_
TRACKING_EVENT
S
.
CREATE_DESIGN
);
return
Tracking
.
event
(
DESIGN_TRACKING_PAGE_NAME
,
DESIGN_
SNOWPLOW_EVENT_TYPE
S
.
CREATE_DESIGN
);
}
export
function
trackDesignUpdate
()
{
return
Tracking
.
event
(
DESIGN_TRACKING_PAGE_NAME
,
DESIGN_
TRACKING_EVENT
S
.
UPDATE_DESIGN
);
return
Tracking
.
event
(
DESIGN_TRACKING_PAGE_NAME
,
DESIGN_
SNOWPLOW_EVENT_TYPE
S
.
UPDATE_DESIGN
);
}
/**
* Track "design detail" view via usage ping
*/
export
function
usagePingDesignDetailView
()
{
api
.
trackRedisHllUserEvent
(
DESIGN_ACTION
);
api
.
trackRedisHllUserEvent
(
DESIGN_
USAGE_PING_EVENT_TYPES
.
DESIGN_
ACTION
);
}
spec/frontend/design_management/pages/index_spec.js
View file @
9694b8b3
...
...
@@ -31,7 +31,10 @@ import {
moveDesignMutationResponseWithErrors
,
}
from
'
../mock_data/apollo_mock
'
;
import
moveDesignMutation
from
'
~/design_management/graphql/mutations/move_design.mutation.graphql
'
;
import
{
DESIGN_TRACKING_PAGE_NAME
}
from
'
~/design_management/utils/tracking
'
;
import
{
DESIGN_TRACKING_PAGE_NAME
,
DESIGN_SNOWPLOW_EVENT_TYPES
,
}
from
'
~/design_management/utils/tracking
'
;
jest
.
mock
(
'
~/flash.js
'
);
const
mockPageEl
=
{
...
...
@@ -509,14 +512,20 @@ describe('Design management index page', () => {
wrapper
.
vm
.
onUploadDesignDone
(
designUploadMutationCreatedResponse
);
expect
(
trackingSpy
).
toHaveBeenCalledTimes
(
1
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
DESIGN_TRACKING_PAGE_NAME
,
'
create_design
'
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
DESIGN_TRACKING_PAGE_NAME
,
DESIGN_SNOWPLOW_EVENT_TYPES
.
CREATE_DESIGN
,
);
});
it
(
'
tracks design modification
'
,
()
=>
{
wrapper
.
vm
.
onUploadDesignDone
(
designUploadMutationUpdatedResponse
);
expect
(
trackingSpy
).
toHaveBeenCalledTimes
(
1
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
DESIGN_TRACKING_PAGE_NAME
,
'
update_design
'
);
expect
(
trackingSpy
).
toHaveBeenCalledWith
(
DESIGN_TRACKING_PAGE_NAME
,
DESIGN_SNOWPLOW_EVENT_TYPES
.
UPDATE_DESIGN
,
);
});
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment