Track document visibility in reading depth schema

Authored by Jdlrobson on Feb 6 2017, 9:55 PM.

Unpublished Commit · Learn More

Not On Permanent Ref: This commit is not an ancestor of any permanent ref.


Track document visibility in reading depth schema

Calculate the number of milliseconds that the page is visible for by
tracking how long the document is hidden for via the Page Visibility API
and subtracting that from the ReadingDepth.totalLength property.

Supporting changes:

  • Add the supportsNavigationTiming function to remove the navStart module-level variable, which is only used in the logEvent function.
  • Add the onLoad and onBeforeUnload functions, so that the order of execution can be better documented.

Bug: T155639
Change-Id: I762ec3fc91decf3cffa869dbd783faf62f01329a