== Background
In {T179426}, we used the current Page Previews EventLogging instrumentation to try to determine the typical time to first user link interaction (see T179426#3741809 and T179426#3741859). Unfortunately, the use of the server-side timestamp, which is only accurate to the second, was too high granularity in order to move forward with {T179426}.
@Gilles recommended that we specifically measure this metric with the high-precision (milliseconds accurate to 5 microseconds), monotonic clock exposed via [[https://developer.mozilla.org/en-US/docs/Web/API/Performance/now | performance.now()]].
== Options== Plan
=== 1.Per T180036#374696, we'll add a high-precision timestamp to the existing EventLogging instrumentation. So, With EventLoggingwe'll:
- Add an `event_timestamp` field to [[ https://meta.wikimedia.org/wiki/Schema:Popups | the Popups schema ]].
- In the client, set the field to `performance.now` for every event we send.
- Re-run the analysis in T179426#3741809 with the `event_timestamp` rather than the `timestamp` field.
=== 2. With statsv
- Update [the statsv reducer](https://github.com/wikimedia/mediawiki-extensions-Popups/blob/deccd841c30013b540fcd038c1c9f282fff0ab88/src/reducers/statsv.js) to send a timer metric representing the [[ https://github.com/wikimedia/mediawiki-extensions-Popups/blob/deccd841c30013b540fcd038c1c9f282fff0ab88/src/reducers/statsv.js#L32-L35 | the first link interaction ]], e.g.== Developer Notes
```lang=js# The field could/should be added in [the `src/reducers/eventLogging.js#getBaseData` function](https://github.com/wikimedia/mediawiki-extensions-Popups/blob/deccd841c30013b540fcd038c1c9f282fff0ab88/src/reducers/eventLogging.js#L15-L33).
const update = { linkDwellStartedAt: action.timestamp }
if ( isFirstInteraction ) {
update.action = 'timing.PagePreviewsFirstInteraction';# All events have timestamps added to them. The timestamps are generated by calling `mw.now`, which proxies to `performance.now` when it's available. Use the timestamp from the event, rather than invoking `performance.now` in the reducer.
update.data = action.timestamp - pageLoadedTime; // Stored when reducing the BOOT action.
}
return nextState( state, update );
```
* Add [a histogram panel](http://docs.grafana.org/features/panels/heatmap/) to [the Page Previews dashboard](https://grafana.wikimedia.org/dashboard/db/reading-web-page-previews)- This is mostly a point of principle: the reducers should only be combining data with existing state.
== AC
* We plot a histogram of the data that we've collected and re-present it to #performance-team.