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
d1abe8f1
Commit
d1abe8f1
authored
Feb 19, 2021
by
Brandon Labuschagne
Committed by
Nicolò Maria Mezzopera
Feb 19, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move cohorts FE tracking to Redis
The FE tracking for cohorts was set up in snowplow instead of redis.
parent
81b2ae7f
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
2 deletions
+56
-2
app/assets/javascripts/admin/users/tabs.js
app/assets/javascripts/admin/users/tabs.js
+10
-1
app/views/admin/users/index.html.haml
app/views/admin/users/index.html.haml
+1
-1
config/feature_flags/development/usage_data_i_analytics_cohorts.yml
...ture_flags/development/usage_data_i_analytics_cohorts.yml
+8
-0
spec/frontend/admin/users/tabs_spec.js
spec/frontend/admin/users/tabs_spec.js
+37
-0
No files found.
app/assets/javascripts/admin/users/tabs.js
View file @
d1abe8f1
import
Api
from
'
~/api
'
;
import
{
historyPushState
}
from
'
~/lib/utils/common_utils
'
;
import
{
mergeUrlParams
}
from
'
~/lib/utils/url_utility
'
;
const
COHORTS_PANE
=
'
cohorts
'
;
const
COHORTS_PANE_TAB_CLICK_EVENT
=
'
i_analytics_cohorts
'
;
const
tabClickHandler
=
(
e
)
=>
{
const
{
hash
}
=
e
.
currentTarget
;
const
tab
=
hash
===
`#
${
COHORTS_PANE
}
`
?
COHORTS_PANE
:
null
;
let
tab
=
null
;
if
(
hash
===
`#
${
COHORTS_PANE
}
`
)
{
tab
=
COHORTS_PANE
;
Api
.
trackRedisHllUserEvent
(
COHORTS_PANE_TAB_CLICK_EVENT
);
}
const
newUrl
=
mergeUrlParams
({
tab
},
window
.
location
.
href
);
historyPushState
(
newUrl
);
};
...
...
app/views/admin/users/index.html.haml
View file @
d1abe8f1
...
...
@@ -5,7 +5,7 @@
%a
.nav-link
{
href:
'#users'
,
class:
active_when
(
params
[
:tab
]
!=
'cohorts'
),
data:
{
toggle:
'tab'
},
role:
'tab'
}
=
s_
(
'AdminUsers|Users'
)
%li
.nav-item.js-users-tab-item
{
role:
'presentation'
}
%a
.nav-link
{
href:
'#cohorts'
,
class:
active_when
(
params
[
:tab
]
==
'cohorts'
),
data:
{
toggle:
'tab'
,
track:
{
event:
'i_analytics_cohorts'
,
action:
'click_tab'
}
},
role:
'tab'
}
%a
.nav-link
{
href:
'#cohorts'
,
class:
active_when
(
params
[
:tab
]
==
'cohorts'
),
data:
{
toggle:
'tab'
},
role:
'tab'
}
=
s_
(
'AdminUsers|Cohorts'
)
.tab-content
...
...
config/feature_flags/development/usage_data_i_analytics_cohorts.yml
0 → 100644
View file @
d1abe8f1
---
name
:
usage_data_i_analytics_cohorts
introduced_by_url
:
https://gitlab.com/gitlab-org/gitlab/-/merge_requests/54329
rollout_issue_url
:
milestone
:
'
13.9'
type
:
development
group
:
group::optimize
default_enabled
:
true
spec/frontend/admin/users/tabs_spec.js
0 → 100644
View file @
d1abe8f1
import
initTabs
from
'
~/admin/users/tabs
'
;
import
Api
from
'
~/api
'
;
jest
.
mock
(
'
~/api.js
'
);
jest
.
mock
(
'
~/lib/utils/common_utils
'
);
describe
(
'
tabs
'
,
()
=>
{
beforeEach
(()
=>
{
setFixtures
(
`
<div>
<div class="js-users-tab-item">
<a href="#users" data-testid='users-tab'>Users</a>
</div>
<div class="js-users-tab-item">
<a href="#cohorts" data-testid='cohorts-tab'>Cohorts</a>
</div>
</div`
);
initTabs
();
});
afterEach
(()
=>
{});
describe
(
'
tracking
'
,
()
=>
{
it
(
'
tracks event when cohorts tab is clicked
'
,
()
=>
{
document
.
querySelector
(
'
[data-testid="cohorts-tab"]
'
).
click
();
expect
(
Api
.
trackRedisHllUserEvent
).
toHaveBeenCalledWith
(
'
i_analytics_cohorts
'
);
});
it
(
'
does not track an event when users tab is clicked
'
,
()
=>
{
document
.
querySelector
(
'
[data-testid="users-tab"]
'
).
click
();
expect
(
Api
.
trackRedisHllUserEvent
).
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