In T191532#4575856 @Ryasmeen noticed that on iOS Safari, a ReadingDepth event can be sent without issues-a_sample or issues-b_sample set.
A sample event is:
{ "event": { "pageTitle": "Misandry", "namespaceId": 0, "skin": "minerva", "isAnon": false, "pageToken": "b3533106e2ca571cfe0e", "sessionToken": "9a570f564eb6d4932fc6", "action": "pageLoaded", "domInteractiveTime": 2711, "default_sample": true }, "revision": 18201205, "schema": "ReadingDepth", "webHost": "reading-web-staging.wmflabs.org", "wiki": "wiki" }
Replication steps
Set the following
$wgWMEReadingDepthSamplingRate = 1; $wgMinervaABSamplingRate = 1;
Load a page with issues.
Inspect the ReadingDepth event and check that 2 sample fields are set (default and a or b)
Replication steps (QA steps)
Make sure configured like so:
$wgWMEReadingDepthSamplingRate = 1; $wgMinervaABSamplingRate = 1;
- Run the site is run in debug mode (append ?debug=true to the end of a URI) e.g. http://reading-web-staging.wmflabs.org/wiki/Pharmacovigilance?debug=true
- Expected: ReadingDepth events with 2 sample fields
- Actual: ReadingDepth events with 1 sample field
Repeat with the following config (ask a developer to do this!):
$wgWMEReadingDepthSamplingRate = 1; $wgMinervaABSamplingRate = 0;
Expected: ReadingDepth events will be sent with 1 sample field
Actual: NO ReadingDepth events are sent
Developer notes
This is a race condition. It appears possible if ReadingDepth is enabled in WikimediaEvents before the Minerva Page issues test.
It can be mitigated by delaying the pageLoaded event, however it's impossible to fix this without introducing a hard dependency on WikimediaEvents to Minerva's module or vice versa.
Maybe loading it during document.ready could help?
The user doesn't get opted into the ReadingDepth schema (e.g. the skin code needs to load before ext.wikimediaEvents). I think this is the problem.
The only way to remedy this is to make sure on Minerva, the Minerva entry point skins.minerva.scripts is loaded before initialising ReadingDepth (mw.trackSubscribe calls before a mw.track event will always be honored). We have to be careful that this does not impact Vector.
I've written a patch to deal with this situation.
Acceptance criteria / testing
- ReadingDepth is working on the Vector skin
- When ReadingDepth is disabled I see ReadingDepth events where bucket sample field is set.
- When both ReadingDepth and wgMinervaABSamplingRate is enabled to 100% of users I see ReadingDepth events where bucket and default sample fields are set