Reduce snowplow delay before unloading a page
What does this MR do?
Reduce snowplow delay before unloading a page
- Keep the link click events
- Reduce the
pageUnloadTimer
below10 ms
from the default500ms
https://github.com/snowplow/snowplow-javascript-tracker/issues/719 - Make sure the events are properly queued across pages
Related to #267345 (closed)
Manual testing
- Enable a gitlab.com environment
# lib/gitlab.rb
def self.com?
# Check `gl_subdomain?` as well to keep parity with gitlab.com
true
end
- Enable additional snowplow tracking
Feature.enable(:additional_snowplow_tracking)
- Enable Snowplow on your local GDK
- Use the "Snowplow analytics Debugger" chrome extension to check a self-describing
link-click
event
Background
It turns out linkclicking and formtracking are enabled by using a a feature flag called :additional_snowplow_tracking) to gitlab.com
-
Snowplow JS library uses the localstorage for queueing. So if you go away from https://gitlab.com by clicking on link A, an event is registered in localstorage queue. If you come back again to any page on gitlab.com, the queue is processed and all pending events are sent back.
-
Also, if outgoing links open on a new tab/window, they are already sent automatically on the source page.
-
We digest the feedback from PMs.
-
We reduce the pageUnloadTimer to 10 milliseconds as a first iteration, in order not to lose any data
-
We may move active pages ( for example, contact sales experiment etc cc @dreedy / @s_awezec ), to open links in a new tab to guarantee timely registration of events.
-
We also rely on queuing logic
Does this MR meet the acceptance criteria?
Conformity
-
Changelog entry -
Documentation (if required) -
Code review guidelines -
Merge request performance guidelines -
Style guides -
Database guides -
Separation of EE specific content
Availability and Testing
-
Review and add/update tests for this feature/bug. Consider all test levels. See the Test Planning Process. -
Tested in all supported browsers -
Informed Infrastructure department of a default or new setting change, if applicable per definition of done
Security
If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:
-
Label as security and @ mention @gitlab-com/gl-security/appsec
-
The MR includes necessary changes to maintain consistency between UI, API, email, or other methods -
Security reports checked/validated by a reviewer from the AppSec team