Commit 8ae52dcd authored by Tetiana Chupryna's avatar Tetiana Chupryna

Merge branch '343581-add-tracking-to-continuous-onboarding-iteration-2-experiment' into 'master'

Track the continuous onboarding iteration 2 experiment

See merge request gitlab-org/gitlab!72836
parents cd0f5c42 e20fb276
......@@ -40,6 +40,7 @@ export default {
data-track-action="click_link"
:data-track-label="$options.i18n.ACTION_LABELS[action].title"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
data-track-experiment="change_continuous_onboarding_link_urls"
>
{{ $options.i18n.ACTION_LABELS[action].title }}
</gl-link>
......
# frozen_string_literal: true
class ChangeContinuousOnboardingLinkUrlsExperiment < ApplicationExperiment # rubocop:disable Gitlab/NamespacedClass
attr_writer :namespace
def track(action, **event_args)
super(action, **event_args.merge(namespace: @namespace))
end
end
......@@ -13,6 +13,7 @@ module LearnGitlabHelper
urls_to_use = nil
experiment(:change_continuous_onboarding_link_urls) do |e|
e.namespace = project.namespace
e.use { urls_to_use = action_urls }
e.try { urls_to_use = new_action_urls(project) }
end
......
# frozen_string_literal: true
require 'spec_helper'
RSpec.describe ChangeContinuousOnboardingLinkUrlsExperiment, :snowplow do
before do
stub_experiments(change_continuous_onboarding_link_urls: 'control')
end
describe '#track' do
context 'when no namespace has been set' do
it 'tracks the action as normal' do
subject.track(:some_action)
expect_snowplow_event(
category: subject.name,
action: 'some_action',
namespace: nil,
context: [
{
schema: 'iglu:com.gitlab/gitlab_experiment/jsonschema/1-0-0',
data: an_instance_of(Hash)
}
]
)
end
end
context 'when a namespace has been set' do
let_it_be(:namespace) { create(:namespace) }
before do
subject.namespace = namespace
end
it 'tracks the action and merges the namespace into the event args' do
subject.track(:some_action)
expect_snowplow_event(
category: subject.name,
action: 'some_action',
namespace: namespace,
context: [
{
schema: 'iglu:com.gitlab/gitlab_experiment/jsonschema/1-0-0',
data: an_instance_of(Hash)
}
]
)
end
end
end
end
......@@ -135,6 +135,7 @@ exports[`Learn GitLab renders correctly 1`] = `
<a
class="gl-link"
data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Set up CI/CD"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
......@@ -156,6 +157,7 @@ exports[`Learn GitLab renders correctly 1`] = `
<a
class="gl-link"
data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Start a free Ultimate trial"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
......@@ -177,6 +179,7 @@ exports[`Learn GitLab renders correctly 1`] = `
<a
class="gl-link"
data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Add code owners"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
......@@ -205,6 +208,7 @@ exports[`Learn GitLab renders correctly 1`] = `
<a
class="gl-link"
data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Add merge request approval"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
......@@ -269,6 +273,7 @@ exports[`Learn GitLab renders correctly 1`] = `
<a
class="gl-link"
data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Create an issue"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
......@@ -290,6 +295,7 @@ exports[`Learn GitLab renders correctly 1`] = `
<a
class="gl-link"
data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Submit a merge request"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
......@@ -347,6 +353,7 @@ exports[`Learn GitLab renders correctly 1`] = `
<a
class="gl-link"
data-track-action="click_link"
data-track-experiment="change_continuous_onboarding_link_urls"
data-track-label="Run a Security scan using CI/CD"
data-track-property="Growth::Conversion::Experiment::LearnGitLab"
href="http://example.com/"
......
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