ampproject / ampproject/amphtml

`incrementalEngagedTime` Variable substitution doesn't reset on `story-page-visible`

Open
#33,260 1 comment 0 reactions 0 assignees View on GitHub
Stale Type: Bug WG: stories
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.