amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

The analytics "timer" trigger keeps firing in Search Viewer carousel after user swiping away

Open lannka opened this issue 8 years ago • 8 comments

lannka avatar Oct 22 '18 22:10 lannka

Was looking at the issue. There's few behavior pattern we should clarify first.

  1. maxTimerLength Do we pause the timer counter when user swipe away and resume the time after they come back
  2. interval Same question
  3. batching interval Do we pause the batch interval timer?
  4. reportWindow Same question
  5. Do we differentiate between user swipe away versus user minimize the browser or switch tab.

@torch2424 Let's make sure we have answers for those before proceeding : )

zhouyx avatar Oct 26 '18 08:10 zhouyx

Rad! Thanks for looking into this 😄 cc @zhouyx

torch2424 avatar Oct 30 '18 01:10 torch2424

Those are all good questions.

I think fundamentally we should decide what's the right analytics behavior on user swipe away & swipe back in Search Carouse, which directly corresponds to unload and resume in amp-analytics's lifecycle.

Option A Treat it as a completely new pageview (like browser refresh). everything should be reset. we could save those trigger instances for performance sake, but all internal states should be reset. There will be a new pageview ping. All visibility state are reset, timer trigger are reset. All queued pings should be sent in a batch when the page gets unloaded.

Option B Treat it as a continuation as the previous pageview, like user switched tab and back. This is the current behavior, all states are kept. Though a bit unintuitive to think that a page in background is still firing timer events, it's understandable if we put it into the tab switching analogy. If we want to pause some of the states, then we will face many hard questions like what @zhouyx brought up above.

@rudygalfi @jeffjose want to hear from you about those 2 options from product's perspective.

lannka avatar Oct 30 '18 21:10 lannka

I'm leaning towards Option A since it aligns with our current thinking of amp-next-page and we can leverage some of the work done in that.

Option B will lead us into a territory of memory management in case the user swipes, say 100 pages.

jeffjose avatar Nov 07 '18 11:11 jeffjose

This issue hasn't been updated in awhile. @torch2424 Do you have any updates?

ampprojectbot avatar Feb 13 '19 03:02 ampprojectbot

@micajuine-ho @jridgewell

I was taking a look at this issue and it seems as though this is the expected behavior of the timer trigger. The documentation states that The timer trigger will continue to send out requests regardless of document state (inactive or hidden), until the maxTimerLength has been reached or stopSpec has been met.

Is there a way to get an inactive state from the top stories carousel and does this fall within the bounds of the spec behavior.

rbeckthomas avatar Apr 22 '21 19:04 rbeckthomas

This seems like something @ampproject/wg-monetization should answer.

jridgewell avatar Apr 22 '21 20:04 jridgewell

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 7 days if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 28 '25 03:04 stale[bot]