Commit 16d1915f authored by Michael Kozono's avatar Michael Kozono

Merge branch '215209-track-group-repo-analytics-pageviews' into 'master'

Track group repo analytics pageviews in snowplow

See merge request gitlab-org/gitlab!42376
parents 647572c6 afc0c8e5
...@@ -10,5 +10,15 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl ...@@ -10,5 +10,15 @@ class Groups::Analytics::RepositoryAnalyticsController < Groups::Analytics::Appl
before_action -> { authorize_view_by_action!(:read_group_repository_analytics) } before_action -> { authorize_view_by_action!(:read_group_repository_analytics) }
def show def show
track_event(pageview_tracker_params)
end
private
def pageview_tracker_params
{
label: 'group_id',
value: @group.id
}
end end
end end
---
title: Track views of group repo analytics page in snowplow
merge_request: 42376
author:
type: added
...@@ -15,7 +15,7 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do ...@@ -15,7 +15,7 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
stub_licensed_features(feature_name => true) stub_licensed_features(feature_name => true)
end end
describe 'GET show' do describe 'GET show', :snowplow do
subject { get :show, params: { group_id: group } } subject { get :show, params: { group_id: group } }
before do before do
...@@ -24,6 +24,17 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do ...@@ -24,6 +24,17 @@ RSpec.describe Groups::Analytics::RepositoryAnalyticsController do
specify { is_expected.to have_gitlab_http_status(:success) } specify { is_expected.to have_gitlab_http_status(:success) }
it 'tracks a pageview event in snowplow' do
subject
expect_snowplow_event(
category: 'Groups::Analytics::RepositoryAnalyticsController',
action: 'show',
label: 'group_id',
value: group.id
)
end
context 'when license is missing' do context 'when license is missing' do
before do before do
stub_licensed_features(feature_name => false) stub_licensed_features(feature_name => false)
......
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