amphtml icon indicating copy to clipboard operation
amphtml copied to clipboard

<amp-consent> inside <amp-next-page> fires twice when loaded from Google Search viewer

Open oliverfernandez opened this issue 6 years ago • 28 comments

What's the issue?

I can only reproduce this in AMP documents loaded inside the Google Search results AMP viewer.

If an AMP page uses the following:

  • <amp-consent> extension
  • <amp-next-page> to load a second AMP document. This document also contains the <amp-consent> extension

The expected behaviour is that since the <amp-consent> has already collected user's consent in the host AMP document, the <amp-consent> component that belongs to the hosted AMP document loaded inside the <amp-next-page> is not asking for consent again.

When the AMP document is loaded from its canonical URL the behaviour is the right one, all works fine. However, when the same AMP document is loaded from the Google Search AMP viewer, the <amp-consent> appears twice: first when the user opens the page, and second when the user scrolls down and the AMP document inside the <amp-next-page> becomes active

I understand that not having the <amp-consent> component in the hosted AMP document inside the <amp-next-page> is not an option, because then other components wouldn't receive the user's consent (<amp-analytics> <amp-ad> etc.)

How do we reproduce the issue?

To reproduce this you need to load the URLs from a region where GDPR / CCPA applies (i.e EU or California)

Here you can see an AMP document loaded inside the Google AMP viewer where the issue is reproducible https://www.google.com/amp/s/ewn.co.za/2020/07/23/economists-express-mixed-views-on-another-interest-rate-cut/amp

The same document loaded from the original URL works correctly https://ewn.co.za/2020/07/23/economists-express-mixed-views-on-another-interest-rate-cut/amp

oliverfernandez avatar Jul 23 '20 08:07 oliverfernandez

Steps to reproduce:

  1. Go to https://www.google.com/amp/s/ewn.co.za/2020/07/23/economists-express-mixed-views-on-another-interest-rate-cut/amp
  2. When the page is loaded, the consent is appearing
  3. Tap "Ok" button. Consent is closed
  4. Scroll to bottom of the page.
  5. Observe result. Actual result: consent is appeared twice

Ichigo3d avatar Jul 23 '20 15:07 Ichigo3d

/cc @zhouyx I am unable to repro this issue locally (using our viewer example). Any ideas on how to move forwards?

micajuine-ho avatar Jul 24 '20 20:07 micajuine-ho

I think the proper fix here is

  1. <amp-next-page> should remove <amp-consent> from its doc. We've agreed on this before, <amp-consent> has position:fixed, and removing the one from next page is fine provided they're guaranteed to be from the same domain.
  2. When fetching the consent service from shadow doc, the parent doc's consent service should be returned instead. Note we can't register the consent service to window because of the existence of FIE.

to @wassgha.

zhouyx avatar Jul 24 '20 20:07 zhouyx

@zhouyx I understand that we need to wait until this is fixed in AMP runtime, and that not rendering now an <amp-consent> when inside an <amp-next-page> is not an option?

oliverfernandez avatar Jul 27 '20 09:07 oliverfernandez

@zhouyx @zhouyx BTW, will this fix also apply to AMP shadows? We are experiencing the same issue

oliverfernandez avatar Jul 29 '20 09:07 oliverfernandez

@zhouyx I understand that we need to wait until this is fixed in AMP runtime, and that not rendering now an when inside an is not an option?

If you are utilizing the promptUISrc iframe, one potential fix would be to have the iframe return the consent information without prompt.

Ideally the fix should also apply to AMP shadows. However without the parent <amp-next-page> I need a way to remove the duplicate <amp-consent> from shadow AMP docs. @dvoytenko do you have any suggestion on how to do that? Thanks

zhouyx avatar Jul 29 '20 21:07 zhouyx

I'd think ideally a shadow doc embedded via amp-next-page would simply ignore its amp-consent and instead get the data from the parent doc?

dvoytenko avatar Jul 30 '20 23:07 dvoytenko

Should the consent be a service at window level, instead of at doc level?

Edit: I'm sorry, I just saw now @zhouyx regarding that consent service cannot be registered at window level

oliverfernandez avatar Jul 31 '20 10:07 oliverfernandez

I'd think ideally a shadow doc embedded via amp-next-page would simply ignore its amp-consent and instead get the data from the parent doc?

I agree with that approach. @wassgha @nainar to prioritize the fix on the <amp-next-page> side. Meanwhile, @dvoytenko thoughts on shadow AMP that's not <amp-next-page>? Which service is responsible to remove duplicate <amp-consent> component?

zhouyx avatar Aug 01 '20 00:08 zhouyx

Should the consent be a service at window level, instead of at doc level?

Actually I think we can register the consent service at window level once we have ampdoc-fie launched, because FIE will have its own window by then. @dvoytenko is that correct?

zhouyx avatar Aug 01 '20 00:08 zhouyx

If the moving this service to the window is the right thing to do, there's no need to wait for ampdoc-fie - the FIE already has the its own window and that wouldn't change.

dvoytenko avatar Aug 03 '20 19:08 dvoytenko

@zhouyx @dvoytenko has this work been prioritised? is there any ETA for it?

lautarorodriguezmrf avatar Aug 24 '20 11:08 lautarorodriguezmrf

Hi @lautarorodriguezmrf Sorry we haven't been able to prioritize the work yet.

@nainar Who owns the <amp-next-page> today?

zhouyx avatar Aug 24 '20 18:08 zhouyx

@zhouyx

We have been told that, starting in September, Ad Manager will start blocking ad requests that don't carry the appropriate consent information.

Effectively speaking, this will leave amp-next-page unusable from an amp-ad and amp-analytics perspective, leaving as only temporary fix showing the CMP twice to the users.

I don't mean to add pressure here, just inform about the situation. Do you think that this could be done by an outside collaborator, or is it a deep change that needs to be done by someone from the AMP team?

oliverfernandez avatar Aug 27 '20 16:08 oliverfernandez

cc @nainar @alanorozco

zhouyx avatar Aug 27 '20 21:08 zhouyx

@zhouyx @dvoytenko @nainar @alanorozco This is getting more and more urgent every day as Google ad manager will cease to answer requests without consent. Is there any way in which we can get this prioritized?

juanazabalmrf avatar Sep 30 '20 07:09 juanazabalmrf

/cc @kristoferbaxter

dvoytenko avatar Sep 30 '20 16:09 dvoytenko

Looks like <amp-next-page> is not actively owned by anyone. I'll sync with @nainar offline on the priority.

zhouyx avatar Sep 30 '20 23:09 zhouyx

Discussed offline. I can take this, but I haven't touched amp-next-page code before so I don't have an estimate on time. We will definitely prioritize this in Q4.

zhouyx avatar Sep 30 '20 23:09 zhouyx

@zhouyx Any updates on this one? We're seeing this happen on CNET.

Cauchon avatar Dec 09 '20 21:12 Cauchon