amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

Amp-next-page not getting the refeererDocument from the Host Page

Open eduardcotmrf opened this issue 5 years ago • 5 comments

What's the issue?

When giving a pageview from an amp-analytics tag inside a amp-next-page, the documentReferrer should be the hostPage, but it's empty.

How do we reproduce the issue?

Here you have an example: https://output.jsbin.com/gujosag. Try it in mobile ans let the amp-next-page build. You'll see two calls in the network to ?ping. In ref you have the ${documentReferrer] variable, it's empty on the pageviw of the amp-next-page where it should be the host page.

What browsers are affected?

All.

Which AMP version is affected?

All.

eduardcotmrf avatar Mar 23 '21 11:03 eduardcotmrf

@eduardcotmrf In the link you provided, the amp-analytics element in the amp-next-page's child page contains this config:


      {
        "requests": {
          "event": "https://amp.dev/documentation/examples/components/amp-analytics/ping?user=2e0194f8-8b5d-4fea-9354-1fa085c78518&account=ampdev&event=${eventId}&n=${n}"
        },
        "triggers": {
          "renderStart": {
            "on": "ad-render-end",
            "request": "event",
            "vars": {
              "eventId": "pageviewFromAmpDoc",
              "n": "${timestamp}"
            }
          }
        }
      }

Which does not have a ${documentReferrer} variable, so it's hard to test.

However, even when I do test it out locally, the document referrer works on both the host page and the child page.

I'm curious, is this happening with a viewer context?

micajuine-ho avatar Jun 30 '21 19:06 micajuine-ho

@eduardcotmrf can u respond to the comment above?

dmanek avatar Jul 07 '21 17:07 dmanek

sorry yes, the example didnt have the attribute.

Here I have reproduce it again: https://output.jsbin.com/pamarakogi

The parameter ref from both calls to ping have the documentReferrer. The second one, the one coming from the amp-next page should have the host page on it but it's blank.

Remember to test it simulating mobile in order to let the amp-next-page work fine in the example.

eduardcotmrf avatar Dec 24 '21 08:12 eduardcotmrf

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 Sep 17 '23 01:09 stale[bot]

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 27 '25 03:04 stale[bot]