Commit f0df15eb authored by Vasilii Iakliushin's avatar Vasilii Iakliushin

Merge branch '348474-track-interactions-with-registration-features-cta' into 'master'

Track clicks on Registration Features CTA

See merge request gitlab-org/gitlab!79559
parents 2129319b e76a22e0
import '~/pages/admin/application_settings/general/index';
import { initMaintenanceModeSettings } from 'ee/maintenance_mode_settings';
import { initServicePingSettingsClickTracking } from 'ee/registration_features_discovery_message';
initMaintenanceModeSettings();
initServicePingSettingsClickTracking();
import '~/pages/admin/users';
import { initServicePingSettingsClickTracking } from 'ee/registration_features_discovery_message';
initServicePingSettingsClickTracking();
......@@ -2,6 +2,7 @@ import '~/pages/groups/edit';
import initAccessRestrictionField from 'ee/groups/settings/access_restriction_field';
import validateRestrictedIpAddress from 'ee/groups/settings/access_restriction_field/validate_ip_address';
import { initGroupPermissionsFormSubmit } from 'ee/groups/settings/permissions';
import { initServicePingSettingsClickTracking } from 'ee/registration_features_discovery_message';
import createFlash from '~/flash';
import { __ } from '~/locale';
......@@ -58,3 +59,5 @@ if (mergeRequestApprovalSetting) {
}
})();
}
initServicePingSettingsClickTracking();
......@@ -3,6 +3,7 @@
import '~/pages/projects/edit';
import mountApprovals from 'ee/approvals/mount_project_settings';
import { initMergeOptionSettings } from 'ee/pages/projects/edit/merge_options';
import { initServicePingSettingsClickTracking } from 'ee/registration_features_discovery_message';
import initProjectAdjournedDeleteButton from 'ee/projects/project_adjourned_delete_button';
import mountStatusChecks from 'ee/status_checks/mount';
import groupsSelect from '~/groups_select';
......@@ -19,3 +20,4 @@ mountStatusChecks(document.getElementById('js-status-checks-settings'));
initProjectAdjournedDeleteButton();
initMergeOptionSettings();
initServicePingSettingsClickTracking();
import api from '~/api';
export const SERVICE_PING_SETTINGS_CLICK_EVENT = 'users_clicking_registration_features_offer';
export const SERVICE_PING_SETTINGS_LINK_SELECTOR = '.js-go-to-service-ping-settings';
export function initServicePingSettingsClickTracking() {
const triggers = document.querySelectorAll(SERVICE_PING_SETTINGS_LINK_SELECTOR);
if (!triggers.length) {
return;
}
triggers.forEach((trigger) => {
trigger.addEventListener('click', () => {
api.trackRedisCounterEvent(SERVICE_PING_SETTINGS_CLICK_EVENT);
});
});
}
......@@ -2,4 +2,4 @@
- service_ping_settings_path = metrics_and_profiling_admin_application_settings_path(anchor: 'js-usage-settings')
= link_to s_('RegistrationFeatures|Enable Service Ping and register for this feature.'), service_ping_settings_path
= link_to s_('RegistrationFeatures|Enable Service Ping and register for this feature.'), service_ping_settings_path, class: 'js-go-to-service-ping-settings'
---
key_path: redis_hll_counters.growth.users_clicking_registration_features_offer_monthly
description: The number of unique users who clicked the settings link in the Registration Features offer CTA
product_section: growth
product_stage: growth
product_group: group::product intelligence
product_category:
value_type: number
status: active
milestone: "14.8"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79559
time_frame: 28d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
performance_indicator_type: []
options:
events:
- users_clicking_registration_features_offer
distribution:
- ee
tier:
- premium
- ultimate
---
key_path: redis_hll_counters.growth.users_clicking_registration_features_offer_weekly
description: The number of unique users who clicked the settings link in the Registration Features offer CTA
product_section: growth
product_stage: growth
product_group: group::product intelligence
product_category:
value_type: number
status: active
milestone: "14.8"
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/79559
time_frame: 7d
data_source: redis_hll
data_category: optional
instrumentation_class: RedisHLLMetric
performance_indicator_type: []
options:
events:
- users_clicking_registration_features_offer
distribution:
- ee
tier:
- premium
- ultimate
import {
SERVICE_PING_SETTINGS_CLICK_EVENT,
SERVICE_PING_SETTINGS_LINK_SELECTOR,
initServicePingSettingsClickTracking,
} from 'ee/registration_features_discovery_message';
import { TEST_HOST } from 'spec/test_constants';
import api from '~/api';
describe('track settings link clicks', () => {
const clickSettingsLink = () => {
document.querySelectorAll(SERVICE_PING_SETTINGS_LINK_SELECTOR).forEach((button) => {
button.click();
});
};
beforeEach(() => {
jest.spyOn(api, 'trackRedisCounterEvent').mockResolvedValue({ data: '' });
});
describe('when links are present', () => {
beforeEach(() => {
setFixtures(`
<a class="js-go-to-service-ping-settings" href="${TEST_HOST}"></a>
<a class="js-go-to-service-ping-settings" href="${TEST_HOST}"></a>
`);
initServicePingSettingsClickTracking();
});
it('track RedisHLL events', () => {
clickSettingsLink();
expect(api.trackRedisCounterEvent).toHaveBeenCalledTimes(2);
expect(api.trackRedisCounterEvent).toHaveBeenLastCalledWith(
SERVICE_PING_SETTINGS_CLICK_EVENT,
);
});
});
});
......@@ -383,3 +383,8 @@
redis_slot: geo
aggregation: daily
feature_flag: track_geo_proxy_events
# Growth
- name: users_clicking_registration_features_offer
category: growth
redis_slot: users
aggregation: weekly
......@@ -49,7 +49,8 @@ RSpec.describe Gitlab::UsageDataCounters::HLLRedisCounter, :clean_gitlab_redis_s
'secure',
'importer',
'network_policies',
'geo'
'geo',
'growth'
)
end
end
......
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