Commit a053283e authored by Rémy Coutable's avatar Rémy Coutable

Merge branch 'am-rename-tracking-options-to-options' into 'master'

Rename snowplow_options to options

See merge request gitlab-org/gitlab!69227
parents ce19f164 c8c20634
......@@ -7,7 +7,7 @@
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1;
n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","#{asset_url('snowplow/sp.js')}","snowplow"));
window.snowplowOptions = #{Gitlab::Tracking.snowplow_options(@group).to_json}
window.snowplowOptions = #{Gitlab::Tracking.options(@group).to_json}
gl = window.gl || {};
gl.snowplowStandardContext = #{Gitlab::Tracking::StandardContext.new.to_context.to_json.to_json}
......@@ -568,14 +568,14 @@ Snowplow Micro is a Docker-based solution for testing frontend and backend event
formTracking: false,
```
1. Update `snowplow_options` in `lib/gitlab/tracking.rb` to add `protocol` and `port`:
1. Update `options` in `lib/gitlab/tracking.rb` to add `protocol` and `port`:
```diff
diff --git a/lib/gitlab/tracking.rb b/lib/gitlab/tracking.rb
index 618e359211b..e9084623c43 100644
--- a/lib/gitlab/tracking.rb
+++ b/lib/gitlab/tracking.rb
@@ -41,7 +41,9 @@ def snowplow_options(group)
@@ -41,7 +41,9 @@ def options(group)
cookie_domain: Gitlab::CurrentSettings.snowplow_cookie_domain,
app_id: Gitlab::CurrentSettings.snowplow_app_id,
form_tracking: additional_features,
......
......@@ -18,7 +18,7 @@ module Gitlab
Gitlab::ErrorTracking.track_and_raise_for_dev_exception(error, snowplow_category: category, snowplow_action: action)
end
def snowplow_options(group)
def options(group)
additional_features = Feature.enabled?(:additional_snowplow_tracking, group)
{
namespace: SNOWPLOW_NAMESPACE,
......
......@@ -11,7 +11,7 @@ RSpec.describe Gitlab::Tracking do
described_class.instance_variable_set("@snowplow", nil)
end
describe '.snowplow_options' do
describe '.options' do
it 'returns useful client options' do
expected_fields = {
namespace: 'gl',
......@@ -22,13 +22,13 @@ RSpec.describe Gitlab::Tracking do
linkClickTracking: true
}
expect(subject.snowplow_options(nil)).to match(expected_fields)
expect(subject.options(nil)).to match(expected_fields)
end
it 'when feature flag is disabled' do
stub_feature_flags(additional_snowplow_tracking: false)
expect(subject.snowplow_options(nil)).to include(
expect(subject.options(nil)).to include(
formTracking: false,
linkClickTracking: false
)
......
......@@ -70,7 +70,7 @@ module Tooling
'data-track-action'
)
all_changed_files.select do |file|
matching_files?(file, extension: '.rb', pattern: %r{Gitlab::Tracking\.(event|enabled\?|snowplow_options)$}) ||
matching_files?(file, extension: '.rb', pattern: %r{Gitlab::Tracking\.(event|enabled\?|options)$}) ||
matching_files?(file, extension: '.js', pattern: js_patterns) ||
matching_files?(file, extension: '.vue', pattern: js_patterns) ||
matching_files?(file, extension: '.haml', pattern: %r{data: \{ track})
......
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