==== Motivation ====
We want to find out to what extend Reference Previews is improving readers' behavior. This ticket is for getting more info about Reference Previews usage, T231529 is about creating a baseline that we can compare the usage against.
==== Acceptance Criteria ====
[x] How often do people look at a reference pop up relative to the pages being opened? E.g. On average, there were 0.03 showings of a reference pop up per page opened where Reference Previews was deployed.
[x] In how many percent of the cases do users click on “go to references section” when they see a reference preview?
 ~~In how many percent of the cases do users click on a link inside the reference itself when they see a reference preview?~~
[x] How often (absolute number per page being opened) do people (who have referencepreview enabled) click on a link inside the reference itself when they see a reference preview?
[x] How often (absolute number per page being opened) do people (who have referencepreview enabled) click on a link inside the reference itself, but from the references section
[x] In how many percent of the cases does an opened reference pop up contain scroll bars?
[x] Of those times, how often do users scroll? (For now, let’s not separate between horizontally and vertically)
==== Metrics ====
We're using a new schema "[[ https://meta.wikimedia.org/w/index.php?title=Schema:ReferencePreviewsPopups | ReferencePreviewsPopups ]]", which tracks the following actions:
* `action: clickedReferenceContentLinkpoppedOpen` is sent for clicks on links in the references area contentwhen a reference preview is rendered. **TODO** unreliable.
* `action: poppedOpen` is sent when a reference preview is rendered. `scrollbarsPresent: true` is set when the reference overflows its bounding box and a vertical scrollbar is present.
* `action: clickedGoToReferences` is sent when "jump to references" is clickedscrolled` is sent exactly once, if the user scrolls a reference preview either horizontally or vertically.
* `action: clickedReferencePreviewsContentLink` is sent when a reference content link is clicked in a reference preview.
* `action: scrolled` is sent exactly once, if the user scrolls aclickedGoToReferences` is sent when "jump to reference preview either horizontally or verticallyes" is clicked.
This can be supplemented with ReferencePreviewsBaseline to collect all of the metrics we need here, although note that the sampling rate may be different. That will already collect the following:
* `action: pageview` is recorded when opening a page with Cite enabled. When Reference Previews are enabled for the user, this event will include `referencePreviewsEnabled: true`.
* `action: clickedFootnote` when clicking a reference link (""). **Note** that this also fires in other circumstances such as when "Jump to references" is clicked, so we need to refine a bit or at least figure out how to calculate the correct statistics. Maybe it's as simple as ignoring this when `referencePreviewsEnabled`, and using `poppedOpen` instead.
* `action: clickedReferenceContentLink` when clicking on a link in the References section.
>>! @Jdlrobson [wrote](https://meta.wikimedia.org/wiki/Schema_talk:Popups#Should_ReferenceTooltips_be_logged_in_a_separate_schema):
> I see [the schema](https://meta.wikimedia.org/wiki/Schema:Popups) has been updated to include ReferenceTooltips. I wonder if it might make sense to use a new schema, given you'll likely want to log reference tooltip previews separately from page previews. I'd imagine reference tooltips will display less often then link previews so if you are leaning heavily on the existing logging code, the sample size for reference tooltips is likely to be very small in comparison to link previews. Does it make sense to "fork" this schema and update the code so that it doesn't log link previews at all, or is data relating to link previews important for the questions you are trying to answer?