Despite being in a ready state, the `ext.eventLogging.subscriber` module isn't being executed and so events logged via [[ https://github.com/wikimedia/mediawiki-extensions-EventLogging/blob/807040b63f70457a7914d654897ce3ff47afef5c/modules/ext.eventLogging.subscriber.js#L97 | the subscriber protocol ]] aren't being logged.
== Background
tl;dr: https://www.youtube.com/watch?v=KkgUhV4gvno
The Page Previews (PP) A/B test on enwiki defines three buckets. The `on` bucket contains 3% of all anonymous users. Those users receive the PP experience with its instrumentation turned on. While pairing on {T175377}, @Tbayer and I noticed that PP wasn't logging events on every pageview when I manipulated my way into the `on` bucket. There didn't seem to be any obvious differences between those pages where PP did and did not log events.
For those pages that did log events, we know that:
- The `ext.eventLogging.subscriber` is in the `ready` state and loaded from Local Storage.
- PP is trying to send events using the subscriber protocol.
- We verified this by executing
```lang=js
mw.trackSubscribe( 'event.', ( topic, data ) => console.log( topic, JSON.stringify( data, null, 2 ) ) );
```
== Browsers Affected
I've tested and confirmed this in:
- Chrome (60.0.3112.113) on macOS Sierra (10.12.6)
- Firefox (54.0.1) on macOS Sierra (10.12.6)
== Hypotheses
1. ~~The `ext.eventLogging.subscriber` module script is being executed some time (a long time) after the PP module script.~~
@phuedx: `mw.track` stores messages in an in-memory data structure to guarantee that late subscribers are delivered all messages that have been sent by one or more producers.
== QA Notes
NOTE: This task requires technical QA.
1. Navigate to https://en.wikipedia.beta.wmflabs.org/wiki/Special:AllPages.
1. Log out, if necessary.
1. Ensure that you're in the on/control Page Previews A/B test bucket. Use the below handy snippet:
```lang=js
(function () {
var experimentGroupSize = mw.config.get( 'wgPopupsAnonsExperimentalGroupSize' ),
control = experimentGroupSize / 2;
console.log(mw.experiments.getBucket( {
name: 'ext.Popups.visibility',
enabled: true,
buckets: {
off: 1 - experimentGroupSize,
control: control,
on: control
}
}, mw.user.sessionId() ));
}());
```
1. Observe that a `pageLoaded` Popups EL event is logged.
1. Interact with a link
1. Observe that another Popups EL event is logged.
1. Navigate to another page.
1. Observe that a `pageLoaded` Popups EL event is logged.
1. Interact with a link.
1. Observe that another Popups EL event is logged.
Repeat steps 7-10 a couple of times to prove that the subscriber is always being subscribed.