Skip to content
Snippets Groups Projects
Commit 2ef9d56b authored by Eugenia Grieff's avatar Eugenia Grieff :two:
Browse files

Merge branch '427472-add-structured-event-tracking-for-join-a-project' into 'master'

Add track options for join a project

See merge request !134396



Merged-by: default avatarEugenia Grieff <egrieff@gitlab.com>
Approved-by: default avatarEugenia Grieff <egrieff@gitlab.com>
Approved-by: default avatarSiddharth Dungarwal <sdungarwal@gitlab.com>
Co-authored-by: default avatarSerhii Yarynovskyi <syarynovskyi@gitlab.com>
parents 62dc05b6 890d4cb4
No related branches found
No related tags found
1 merge request!134396Add track options for join a project
Pipeline #1043867649 passed
......@@ -29,6 +29,7 @@ def update
if result.success?
track_event('successfully_submitted_form')
track_joining_a_project_event
successful_update_hooks
redirect_to update_success_path
......@@ -114,12 +115,18 @@ def signup_onboarding_path
end
end
def track_event(action)
def track_joining_a_project_event
return unless onboarding_status.joining_a_project?
track_event('select_button', label: 'join_a_project')
end
def track_event(action, label: onboarding_status.tracking_label)
::Gitlab::Tracking.event(
helpers.body_data_page,
action,
user: current_user,
label: onboarding_status.tracking_label
label: label
)
end
......
......@@ -216,6 +216,36 @@
)
end
context 'with joining_project selection' do
context 'when creating a new project' do
it 'does not track join a project event' do
patch_update
expect_no_snowplow_event(
category: 'registrations:welcome:update',
action: 'select_button',
user: user,
label: 'join_a_project'
)
end
end
context 'when joining a project' do
let(:joining_project) { 'true' }
it 'tracks join a project event' do
patch_update
expect_snowplow_event(
category: 'registrations:welcome:update',
action: 'select_button',
user: user,
label: 'join_a_project'
)
end
end
end
context 'when the new user already has any accepted group membership' do
let!(:member1) { create(:group_member, user: user) }
......@@ -511,7 +541,9 @@
end
context 'when failed request' do
subject(:patch_update) { patch :update, params: { user: { role: 'software_developer' } } }
subject(:patch_update) do
patch :update, params: { user: { role: 'software_developer' }, joining_project: 'true' }
end
before do
allow_next_instance_of(::Users::SignupService) do |service|
......@@ -529,6 +561,17 @@
label: 'free_registration'
)
end
it 'does not track join a project event' do
patch_update
expect_no_snowplow_event(
category: 'registrations:welcome:update',
action: 'select_button',
user: user,
label: 'join_a_project'
)
end
end
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment