ampproject / ampproject/amphtml
`incrementalEngagedTime` Variable substitution doesn't reset on `story-page-visible`
- Dominant language
- JavaScript
- Stars
- 14.9k
- Forks
- 4.1k
- PR merge metrics
- No merged PRs in 30d
Description
#### What's the issue?
Visible time on page does not track correctly. Values are far higher than we expect to see.
Numbers being reported for visible time on page are not what we expect. They could be shorter or longer.
We are using the [Visible trigger](https://github.com/ampproject/amphtml/blob/master/extensions/amp-story/amp-story-analytics.md#visible-trigger-on-story-page-visible) reference [Incremental Engaged Time](https://github.com/ampproject/amphtml/blob/master/spec/amp-var-substitutions.md#incremental-engaged-time) variable repeatedly. However, the timer is not resetting along with page change.
#### How do we reproduce the issue?
```
"pageTimer": {
"on": "story-page-visible",
"vars": {
"event_name": "custom",
"event_action": "time-spent-on-story-page",
"event_category": "time-tracking",
"event_label": "page-$DEFAULT(${storyPreviousPageId}, IGNORE_EVENT)-${incrementalEngagedTime(pageTimer)}-secs",
"send_to": ["UA-zzzzzzzz-1"]
}
},
```
#### What browsers are affected?
We did not find different behavior cross-browser.
#### Which AMP version is affected?
Observed in Version 2103020156003.
Contributor guide
Research direction
Start with the Visible trigger and Incremental Engaged Time references in the issue, then reproduce the supplied story-page-visible configuration. Trace the timer across page changes and verify that incrementalEngagedTime(pageTimer) resets for each newly visible story page.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- analytics
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100