Measure bounce rate and dwell time for search results

Authored by EBernhardson.


Measure bounce rate and dwell time for search results

Fires an event every time a user recieves a search result,
along with when they arive and leave from a page linked from
the search results. Initially this uses a sampling rate of
1 in 1000. If a user is not selected by the 1 in 1000
sampling they will stay rejected for the next 20 minutes.

A few caveats:

  • Only works for logged in users. After I0465243 has been deployed for 30 days we can make this a dependency to ext.wikimediaEvents, rather than ext.wikimediaEvents.loggedin
  • Only works for users with sendBeacon. Testing has shown that unload events are only sent perhaps half the time without it, and the time between load and unload is the primary thing measured here.
  • If the users localStorage is full, perhaps due to T66721 they will not be included in the test. This is because localStorage is used to track the users session identifier.

Bug: T100907
Change-Id: Icffce2a5fbdb525ccce8f2f9c7b3ee3c7d18f055