ampproject / ampproject/amphtml

Detect scrolling up/down in amp-next-page trigger

Open
#37,035 1 comment 0 reactions 0 assignees View on GitHub
Stale Type: Feature Request
Dominant language
JavaScript
Stars
14.9k
Forks
4.1k
PR merge metrics
No merged PRs in 30d

Description

### Description

Hi, I have this analytic trigger and I would like to include a new variable that shows if the page was scrolled up or down for the moment the analytic was triggered.
I need this variable because I am using infinite scroll (amp-next-page) and I would like to know if the page was accessed from the top (new page is coming) or back (user is going back)
`

{
"triggers": {
"trackScrollThrough": {
"on": "amp-next-page-scroll",
"request": "page",
"vars": {
"scrollType": "should be here up or down"
}
}
}

`

### Alternatives Considered

A new variable that shows the scroll' direction

### Additional Context

_No response_

Contributor guide

Open the contributing guide

Research direction

Start by tracing the amp-next-page-scroll trigger through the amp-analytics and amp-next-page implementations. Determine how the trigger can expose whether the page was reached while scrolling up or down, then verify that the configured scrollType variable reports the direction at trigger time.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
analytics
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.