Skip to content

Next Page pageview GA event fired in <amp-pixel> while using with <amp-next-page> #25069

@akkyverma

Description

@akkyverma

Next Page pageview GA event fired in <amp-pixel> while using with <amp-next-page>

What's the issue?

We are trying to implement <amp-next-page> functionality in our AMP pages and to fire GA pageviews as per the AMP documentation, <amp-analytics> is currently unsupported for pages added under <amp-next-page>. Here's a screenshot from the official documentation: https://images.hindi.news18.com/ibnkhabar/uploads/2019/10/doc.png

Hence in order to measure page views per suggestion, we are using <amp-pixel>, but amp-pixel seems to firing in background with XHR calls for next page even before user scrolls till the next page. This is leading to false analytics data for page views, which is undesirable.

Please look into the screen capture. https://images.hindi.news18.com/ibnkhabar/uploads/2019/10/Issue.png

How do we reproduce the issue?

  1. Open browser with network tab in debug window.
  2. Open the URL
  3. Write collect in search field and just enter the URL in browser.
  4. Now you can see 2 URLs (GA events under amp-pixel) fired - first for 'amit-shah-calls-meet-on-thursday-of-bjp-office-bearers-to-elect-new-party-chief...' and 2nd for next coming page when user is going to scroll to, at the time of loading itself without any actual scroll or resize event.
    We sense that for optimizing the amp-next-page user experience, the next page is fetched before hand itself (as can be seen in the network tab with "fetch" event for the next page straight away) and since amp-pixel in part of the code which is getting fired even before it's in view and while the page is rendered, the event gets triggered before hand.

Issue

What browsers are affected?

Tested only in Google Chrome Version 77.0.3865.90 (Official Build) (64-bit) [Mobile Device] Galaxy S5.

Which AMP version is affected?

Powered by AMP ⚡ HTML – Version 1910071803120
amp-next-page-0.1.js

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions