Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
a4ecef34
Commit
a4ecef34
authored
Oct 24, 2019
by
Doug Stull
Committed by
Mike Greiling
Oct 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Revert adding user id to snowplow
parent
61cace63
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
6 additions
and
14 deletions
+6
-14
app/assets/javascripts/tracking.js
app/assets/javascripts/tracking.js
+0
-1
app/views/layouts/_snowplow.html.haml
app/views/layouts/_snowplow.html.haml
+1
-1
lib/gitlab/tracking.rb
lib/gitlab/tracking.rb
+2
-3
spec/frontend/tracking_spec.js
spec/frontend/tracking_spec.js
+0
-5
spec/lib/gitlab/tracking_spec.rb
spec/lib/gitlab/tracking_spec.rb
+3
-4
No files found.
app/assets/javascripts/tracking.js
View file @
a4ecef34
...
@@ -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
'
);
...
...
app/views/layouts/_snowplow.html.haml
View file @
a4ecef34
...
@@ -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
}
lib/gitlab/tracking.rb
View file @
a4ecef34
...
@@ -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
...
...
spec/frontend/tracking_spec.js
View file @
a4ecef34
...
@@ -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
'
);
});
});
...
...
spec/lib/gitlab/tracking_spec.rb
View file @
a4ecef34
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment