Commit 4ef38b5e authored by Stan Hu's avatar Stan Hu

Merge branch '219944-track-billings-page-view' into 'master'

Track views of the {profiles,groups}/billings page

See merge request gitlab-org/gitlab!38843
parents 7b222329 9e65d413
......@@ -10,6 +10,7 @@ class Groups::BillingsController < Groups::ApplicationController
@top_most_group = @group.root_ancestor if @group.has_parent?
current_plan = (@top_most_group || @group).plan_name_for_upgrading
@plans_data = FetchSubscriptionPlansService.new(plan: current_plan).execute
track_experiment_event(:contact_sales_btn_in_app, 'page_view:billing_plans:group')
record_experiment_user(:contact_sales_btn_in_app)
end
end
......@@ -7,6 +7,7 @@ class Profiles::BillingsController < Profiles::ApplicationController
@plans_data = FetchSubscriptionPlansService
.new(plan: current_user.namespace.plan_name_for_upgrading)
.execute
track_experiment_event(:contact_sales_btn_in_app, 'page_view:billing_plans:profile')
record_experiment_user(:contact_sales_btn_in_app)
end
end
......@@ -29,6 +29,7 @@ RSpec.describe Groups::BillingsController do
allow_next_instance_of(FetchSubscriptionPlansService) do |instance|
allow(instance).to receive(:execute)
end
allow(controller).to receive(:track_experiment_event)
end
it 'renders index with 200 status code' do
......@@ -49,6 +50,12 @@ RSpec.describe Groups::BillingsController do
expect(assigns(:plans_data)).to eq(data)
end
it 'tracks the page view for the contact_sales_btn_in_app experiment' do
expect(controller).to receive(:track_experiment_event).with(:contact_sales_btn_in_app, 'page_view:billing_plans:group')
get_index
end
it 'records user for the contact_sales_btn_in_app experiment' do
expect(controller).to receive(:record_experiment_user).with(:contact_sales_btn_in_app)
......
......@@ -13,6 +13,7 @@ RSpec.describe Profiles::BillingsController do
allow_next_instance_of(FetchSubscriptionPlansService) do |instance|
allow(instance).to receive(:execute)
end
allow(controller).to receive(:track_experiment_event)
end
def get_index
......@@ -39,6 +40,12 @@ RSpec.describe Profiles::BillingsController do
expect(assigns(:plans_data)).to eq(data)
end
it 'tracks the page view for the contact_sales_btn_in_app experiment' do
expect(controller).to receive(:track_experiment_event).with(:contact_sales_btn_in_app, 'page_view:billing_plans:profile')
get_index
end
it 'records user for the contact_sales_btn_in_app experiment' do
expect(controller).to receive(:record_experiment_user).with(:contact_sales_btn_in_app)
......
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