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
105ac604
Commit
105ac604
authored
Feb 25, 2020
by
Alper Akgun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use snowplow for user error reporting in trial
Notifies about errors user's face through snowplow events
parent
ed7ae583
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
87 additions
and
1 deletion
+87
-1
app/assets/javascripts/tracking.js
app/assets/javascripts/tracking.js
+2
-0
ee/app/assets/javascripts/pages/trials/apply/index.js
ee/app/assets/javascripts/pages/trials/apply/index.js
+1
-0
ee/app/assets/javascripts/pages/trials/create_lead/index.js
ee/app/assets/javascripts/pages/trials/create_lead/index.js
+1
-0
ee/app/assets/javascripts/trials/track_trial_user_errors.js
ee/app/assets/javascripts/trials/track_trial_user_errors.js
+18
-0
ee/app/views/trials/_errors.html.haml
ee/app/views/trials/_errors.html.haml
+1
-1
ee/changelogs/unreleased/119085-using-snowplow-for-red-error-banner-reporting.yml
.../119085-using-snowplow-for-red-error-banner-reporting.yml
+5
-0
ee/spec/frontend/trials/track_trial_user_errors_spec.js
ee/spec/frontend/trials/track_trial_user_errors_spec.js
+59
-0
No files found.
app/assets/javascripts/tracking.js
View file @
105ac604
...
@@ -111,4 +111,6 @@ export function initUserTracking() {
...
@@ -111,4 +111,6 @@ export function initUserTracking() {
if
(
opts
.
linkClickTracking
)
window
.
snowplow
(
'
enableLinkClickTracking
'
);
if
(
opts
.
linkClickTracking
)
window
.
snowplow
(
'
enableLinkClickTracking
'
);
Tracking
.
bindDocument
();
Tracking
.
bindDocument
();
document
.
dispatchEvent
(
new
Event
(
'
SnowplowInitialized
'
));
}
}
ee/app/assets/javascripts/pages/trials/apply/index.js
View file @
105ac604
import
'
ee/pages/trials/namespace_select
'
;
import
'
ee/pages/trials/namespace_select
'
;
import
'
ee/trials/track_trial_user_errors
'
;
ee/app/assets/javascripts/pages/trials/create_lead/index.js
View file @
105ac604
import
'
ee/pages/trials/country_select
'
;
import
'
ee/pages/trials/country_select
'
;
import
'
ee/trials/track_trial_user_errors
'
;
ee/app/assets/javascripts/trials/track_trial_user_errors.js
0 → 100644
View file @
105ac604
import
Tracking
from
'
~/tracking
'
;
export
default
function
trackTrialUserErrors
()
{
const
flashText
=
document
.
querySelector
(
'
.trial-errors .flash-text
'
);
if
(
flashText
)
{
const
errorMessage
=
flashText
.
textContent
.
trim
();
if
(
errorMessage
)
{
Tracking
.
event
(
'
trials:create
'
,
'
create_trial_error
'
,
{
label
:
'
flash-text
'
,
property
:
'
message
'
,
value
:
errorMessage
,
});
}
}
}
document
.
addEventListener
(
'
SnowplowInitialized
'
,
trackTrialUserErrors
);
ee/app/views/trials/_errors.html.haml
View file @
105ac604
-
if
show_trial_errors?
(
@namespace
,
@result
)
-
if
show_trial_errors?
(
@namespace
,
@result
)
.flash-container
.flash-container
.trial-errors
.flash-alert.text-center
.flash-alert.text-center
=
_
(
'We have found the following errors:'
)
=
_
(
'We have found the following errors:'
)
.flash-text
.flash-text
...
...
ee/changelogs/unreleased/119085-using-snowplow-for-red-error-banner-reporting.yml
0 → 100644
View file @
105ac604
---
title
:
Use snowplow for user error reporting in trial
merge_request
:
24430
author
:
type
:
added
ee/spec/frontend/trials/track_trial_user_errors_spec.js
0 → 100644
View file @
105ac604
import
{
mockTracking
}
from
'
helpers/tracking_helper
'
;
import
trackTrialUserErrors
from
'
ee/trials/track_trial_user_errors
'
;
describe
(
'
trackTrialUserErrors
'
,
()
=>
{
let
spy
;
describe
(
'
when an error is present
'
,
()
=>
{
const
errorMessage
=
'
You cannot have multiple trials
'
;
beforeEach
(()
=>
{
document
.
body
.
innerHTML
=
`
<div class="flash-container trial-errors"
.<div class="flash-alert.text-center">
We have found the following errors:
<div class="flash-text">
${
errorMessage
}
</div>
</div>
</div>
`
;
spy
=
mockTracking
(
'
trials:create
'
,
document
.
body
,
jest
.
spyOn
);
});
it
(
'
tracks the error message
'
,
()
=>
{
trackTrialUserErrors
();
expect
(
spy
).
toHaveBeenCalledWith
(
'
trials:create
'
,
'
create_trial_error
'
,
{
label
:
'
flash-text
'
,
property
:
'
message
'
,
value
:
errorMessage
,
});
});
it
(
'
tracks the error message when snowplow is initialized
'
,
()
=>
{
document
.
dispatchEvent
(
new
Event
(
'
SnowplowInitialized
'
));
expect
(
spy
).
toHaveBeenCalledWith
(
'
trials:create
'
,
'
create_trial_error
'
,
{
label
:
'
flash-text
'
,
property
:
'
message
'
,
value
:
errorMessage
,
});
});
});
describe
(
'
when no error is present
'
,
()
=>
{
beforeEach
(()
=>
{
document
.
body
.
innerHTML
=
`
<div id="dummy-wrapper-element">
</div>
`
;
});
it
(
'
does not track the any error message
'
,
()
=>
{
trackTrialUserErrors
();
expect
(
spy
).
not
.
toHaveBeenCalled
();
});
});
});
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