Commit a4ecef34 authored by Doug Stull's avatar Doug Stull Committed by Mike Greiling

Revert adding user id to snowplow

parent 61cace63
...@@ -102,7 +102,6 @@ export function initUserTracking() { ...@@ -102,7 +102,6 @@ export function initUserTracking() {
window.snowplow('enableActivityTracking', 30, 30); window.snowplow('enableActivityTracking', 30, 30);
window.snowplow('trackPageView'); // must be after enableActivityTracking window.snowplow('trackPageView'); // must be after enableActivityTracking
if (opts.userId) window.snowplow('setUserId', opts.userId);
if (opts.formTracking) window.snowplow('enableFormTracking'); if (opts.formTracking) window.snowplow('enableFormTracking');
if (opts.linkClickTracking) window.snowplow('enableLinkClickTracking'); if (opts.linkClickTracking) window.snowplow('enableLinkClickTracking');
......
...@@ -7,4 +7,4 @@ ...@@ -7,4 +7,4 @@
};p[i].q=p[i].q||[];n=l.createElement(o);g=l.getElementsByTagName(o)[0];n.async=1; };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")); n.src=w;g.parentNode.insertBefore(n,g)}}(window,document,"script","#{asset_url('snowplow/sp.js')}","snowplow"));
window.snowplowOptions = #{Gitlab::Tracking.snowplow_options(@group, current_user).to_json} window.snowplowOptions = #{Gitlab::Tracking.snowplow_options(@group).to_json}
...@@ -39,7 +39,7 @@ module Gitlab ...@@ -39,7 +39,7 @@ module Gitlab
snowplow.track_self_describing_event(event_json, context, Time.now.to_i) snowplow.track_self_describing_event(event_json, context, Time.now.to_i)
end end
def snowplow_options(group, user) def snowplow_options(group)
additional_features = Feature.enabled?(:additional_snowplow_tracking, group) additional_features = Feature.enabled?(:additional_snowplow_tracking, group)
{ {
namespace: SNOWPLOW_NAMESPACE, namespace: SNOWPLOW_NAMESPACE,
...@@ -47,8 +47,7 @@ module Gitlab ...@@ -47,8 +47,7 @@ module Gitlab
cookie_domain: Gitlab::CurrentSettings.snowplow_cookie_domain, cookie_domain: Gitlab::CurrentSettings.snowplow_cookie_domain,
app_id: Gitlab::CurrentSettings.snowplow_site_id, app_id: Gitlab::CurrentSettings.snowplow_site_id,
form_tracking: additional_features, form_tracking: additional_features,
link_click_tracking: additional_features, link_click_tracking: additional_features
user_id: user&.id
}.transform_keys! { |key| key.to_s.camelize(:lower).to_sym } }.transform_keys! { |key| key.to_s.camelize(:lower).to_sym }
end end
......
...@@ -11,7 +11,6 @@ describe('Tracking', () => { ...@@ -11,7 +11,6 @@ describe('Tracking', () => {
namespace: '_namespace_', namespace: '_namespace_',
hostname: 'app.gitfoo.com', hostname: 'app.gitfoo.com',
cookieDomain: '.gitfoo.com', cookieDomain: '.gitfoo.com',
userId: null,
}; };
snowplowSpy = jest.spyOn(window, 'snowplow'); snowplowSpy = jest.spyOn(window, 'snowplow');
}); });
...@@ -35,7 +34,6 @@ describe('Tracking', () => { ...@@ -35,7 +34,6 @@ describe('Tracking', () => {
contexts: { webPage: true }, contexts: { webPage: true },
formTracking: false, formTracking: false,
linkClickTracking: false, linkClickTracking: false,
userId: null,
}); });
}); });
...@@ -43,18 +41,15 @@ describe('Tracking', () => { ...@@ -43,18 +41,15 @@ describe('Tracking', () => {
initUserTracking(); initUserTracking();
expect(snowplowSpy).toHaveBeenCalledWith('enableActivityTracking', 30, 30); expect(snowplowSpy).toHaveBeenCalledWith('enableActivityTracking', 30, 30);
expect(snowplowSpy).toHaveBeenCalledWith('trackPageView'); expect(snowplowSpy).toHaveBeenCalledWith('trackPageView');
expect(snowplowSpy).not.toHaveBeenCalledWith('setUserId');
expect(snowplowSpy).not.toHaveBeenCalledWith('enableFormTracking'); expect(snowplowSpy).not.toHaveBeenCalledWith('enableFormTracking');
expect(snowplowSpy).not.toHaveBeenCalledWith('enableLinkClickTracking'); expect(snowplowSpy).not.toHaveBeenCalledWith('enableLinkClickTracking');
window.snowplowOptions = Object.assign({}, window.snowplowOptions, { window.snowplowOptions = Object.assign({}, window.snowplowOptions, {
formTracking: true, formTracking: true,
linkClickTracking: true, linkClickTracking: true,
userId: '1',
}); });
initUserTracking(); initUserTracking();
expect(snowplowSpy).toHaveBeenCalledWith('setUserId', '1');
expect(snowplowSpy).toHaveBeenCalledWith('enableFormTracking'); expect(snowplowSpy).toHaveBeenCalledWith('enableFormTracking');
expect(snowplowSpy).toHaveBeenCalledWith('enableLinkClickTracking'); expect(snowplowSpy).toHaveBeenCalledWith('enableLinkClickTracking');
}); });
......
...@@ -19,11 +19,10 @@ describe Gitlab::Tracking do ...@@ -19,11 +19,10 @@ describe Gitlab::Tracking do
cookieDomain: '.gitfoo.com', cookieDomain: '.gitfoo.com',
appId: '_abc123_', appId: '_abc123_',
formTracking: true, formTracking: true,
linkClickTracking: true, linkClickTracking: true
userId: nil
} }
expect(subject.snowplow_options(nil, nil)).to match(expected_fields) expect(subject.snowplow_options(nil)).to match(expected_fields)
end end
it 'enables features using feature flags' do it 'enables features using feature flags' do
...@@ -37,7 +36,7 @@ describe Gitlab::Tracking do ...@@ -37,7 +36,7 @@ describe Gitlab::Tracking do
linkClickTracking: false linkClickTracking: false
} }
expect(subject.snowplow_options('_group_', nil)).to include(addition_feature_fields) expect(subject.snowplow_options('_group_')).to include(addition_feature_fields)
end end
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