amp-story: Add an event to track manual page advancements
Describe the new feature or change to an existing feature you'd like to see
Right now the story-page-visible event fires every time the story advances to another page regardless of how it was triggered. There is a variable storyAdvancementMode that tells you what triggered the advancement, but there is no way to change other parameters on the analytics event based on that variable.
For example, I would like to send the story-page-visible event to Google Analytics with the "non-interaction hit" flag set to 0 when it's a manual advancement or 1 otherwise. Doing so would allow me to correctly track bounce rate in GA.
I'd like one of the following:
- a separate event for manually triggered page advancements
- a way to do simple logic in variable substitutions (e.g.
"ni": "${storyAdvancementMode == 'manualAdvance' ? 0 : 1}", this is a much larger feature request)
Describe alternatives you've considered
Only alternative is to do manual post-processing on the events, which may not be possible when sending analytics to clients.
Additional context
Add any other context or screenshots about the feature request here.
/cc @ampproject/wg-stories
cc @ampproject/wg-stories
The 2nd option I listed is actually currently possible with the following (undocumented?) snippet: 'ni': '$IF($EQUALS(${storyAdvancementMode}, manualAdvance), 1, 0)'. Unfortunately storyAdvancementMode seems to not be correct (#26579), but assuming that's fixed this issue is covered.
Thanks @drtchops! I just sent a fix to the bug you mentioned #26581, your snippet should work as expected.