-
Notifications
You must be signed in to change notification settings - Fork 3.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove experimental flag from visibility triggers and add documentation. #3512
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,6 +42,16 @@ When the same `var` is defined in multiple locations, the value is picked in the | |
|
||
The remainder of this doc lists and describes the variables supported in `amp-analytics`. | ||
|
||
| Table of Contents | | ||
|---| | ||
| [Device and Browser](#device-and-browser) | | ||
| [Interaction](#interaction) | | ||
| [Miscellaneous](#miscellaneous) | | ||
| [Page and content](#page-and-content) | | ||
| [Performance](#performance) | | ||
| [Visibility](#visibility-variables) | | ||
|
||
|
||
## Page and content | ||
|
||
### ampdocHost | ||
|
@@ -361,3 +371,75 @@ Provides the number of seconds that have elapsed since 1970. (Epoch time) | |
|
||
Example value: `1452710304312` | ||
|
||
## Visibility Variables | ||
|
||
### backgrounded | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Are the below two variables related to prerendering or separate. It might be good to note either way. For example, when could a page be backgroundedAtStart? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is not related to prerendering. Nothing in amp-analytics executes before the page is made visible afaik. Will add some context here. |
||
|
||
A binary variable with possible values of 1 and 0 to indicate that the page/tab was sent to background at any point before the hit was sent. 1 indicates that the page was backgrounded while 0 indicates that the page has always been in the foreground. This variable does not count prerender as a backgrounded state. | ||
|
||
### backgroundedAtStart | ||
|
||
A binary variable with possible values of 1 and 0 to indicate that the page/tab was backgrounded at the time when the page was loaded. 1 indicates that the page was loaded in the background while 0 indicates otherwise. This variable does not count prerender as a backgrounded state. | ||
|
||
### maxContinuousVisibleTime | ||
|
||
Provides the maximum amount of continuous time an element has met the `visibilitySpec` conditions at the time this ping is sent. Note that a ping with a continuousTimeMin=1000 and totalTimeMin=5000 that is visible for 1000ms, then not visible, then visible | ||
for 2000ms, then not, then visible for 1000ms, then not, then visible for 1020ms | ||
will report 2000 for this number as that is the max continuous visible time, | ||
even if it is not the current continuous visible time (1020 in this example). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would currentContinuousVisible time be useful to provide? Seems like it might be. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Probably. Can you open an issue to track it? |
||
|
||
### elementHeight | ||
|
||
Provides the height of the element specified by `visibilitySpec`. | ||
|
||
### elementWidth | ||
|
||
Provides the width of the element specified by `visibilitySpec`. | ||
|
||
### elementX | ||
|
||
Provides the X coordinate of the left edge of the element specified by `visibilitySpec`. | ||
|
||
### elementY | ||
|
||
Provides the Y coordinate of the top edge of the element specified by `visibilitySpec`. | ||
|
||
### firstSeenTime | ||
|
||
Provides the time when at least 1px of the element is on the screen for the first time since the trigger is registered by `amp-analytics`. | ||
|
||
### firstVisibleTime | ||
|
||
Provides the time when the element met visibility conditions for the first time since | ||
the trigger is registered by `amp-analytics`. | ||
|
||
### lastSeenTime | ||
|
||
Provides the time when at least 1px of the element is on the screen for the last time since javascript load. | ||
|
||
### lastVisibleTime | ||
|
||
Provides the time when the element met visibility conditions for the last time since | ||
javascript load. | ||
|
||
### loadTimeVisibility | ||
|
||
Provides the percentage of element visible in the viewport at load time. This variable assumes that the page is scrolled to top. | ||
|
||
### maxVisiblePercentage | ||
|
||
Provides the maximum visible percentage over the time that `visibilitySpec` conditions were met. For example, a ping where the element was 100%, then off the page, then 100% will report this value as 100. A ping with visiblePercentageMax=50 undergoing the same transitions would report somewhere between 0 and 50 since any time when the element was 100% on the page would not be counted. | ||
|
||
### minVisiblePercentage | ||
|
||
Provides the minimum visible percentage over the time that visibilitySpec conditions were met. For example, a ping where the element was 100%, then off the page, then 100% will report this value as 0. A ping with visiblePercentageMin=50 condition undergoing the same transitions would report somewhere between 50 and 100 since any time when the element was 0% to 50% on the page would not be counted. | ||
|
||
### totalTime | ||
|
||
Provides the total time from the time page was loaded to the time a ping was sent out. The value is calculated from the time document became interactive. | ||
|
||
### totalVisibleTime | ||
|
||
Provides the total time for which the element has met the visiblitySpec conditions at time this ping is sent. | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Assuming the statement I write here is true, should have something like: "If multiple properties are specified, they must all be true in order for a request to fire."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.