ampproject / amphtml

The AMP web component framework.
https://amp.dev
Apache License 2.0
14.89k stars 3.89k forks source link

Consent parameters not sent in ads requests using GPT #32035

Open cburaca opened 3 years ago

cburaca commented 3 years ago

I'm trying to develop a amp-ad type network, to implement some ad related custom features. To request the ads and inspect what has been served, I'm using GPT, as usual:

window.googletag.cmd.push(function() {
  const slot = window.googletag
       .defineSlot('NETWORK/SLOT/PATH', [300,250], 'div-container-id')
       .addService(pubads);

  window.googletag.enableServices();
  window.googletag.display('div-container-id');
});

Ads are correctly loaded and displayed, so everything seems normal. However, when inspecting the network requests in the dev console, the consent parameters (gdpr, gdpr_consent, etc.) are not passed in the ads request (as they do in non amp requests), though I confirmed they are present in the component window.context:

context

Shouldn't these parameters be automatically handled and added by the GPT library? If so, is there something else I need to configure or implement? If not, how should I instruct GPT to add them to the request?

Thanks in advance!

calebcordry commented 3 years ago

@cburaca for valid amp pages we do not allow 3rd party javascript i.e. the GPT script tag. Are you trying to serve amp ads to a non-amp page?

If you are trying to serve these ads to an amp page, we already have doubleclick & adsense integrations, perhaps you have a feature you would like to ad to those implementations?

cburaca commented 3 years ago

Thanks @calebcordry . I'm trying to serve ads on amp pages.

I thought it would be possible, as I saw other 3rd party networks using GPT also, and in non amp pages GPT ad requests seem to correctly include consent parameters.

If I'd use doubleclick integration, how could I inspect the served ad to retrieve the lineItemId, size, etc.(as I do when using GPT slotRenderEnded event), and pass that data to other component or script?

calebcordry commented 3 years ago

Ah you are right that some ad networks are using GPT in their code, sorry for the bad info. However, I know very little of how GPT is supposed to work, and I am not sure what level of support the GPT folks offer for this use case. Maybe you could read the consent from context yourself and feed it into whatever logic you need?

@zombifier who will have a better idea on GPT. Khoi, thoughts on if this is something that GPT should support?

cburaca commented 3 years ago

Yes, I can read the consent from context, as my image above shows, but I need it to be sent in the 'ads' request to the ad server also, and have no idea why it is not included in the parameters, as for other networks using GPT.

Please see also the image below, from other 3p. In the 'https://securepubads.g.doubleclick.net/gampad/ads' request, these parameters should be included, but are not: ads

What about this: if I'd use doubleclick integration, how could I inspect the served ad to retrieve the lineItemId, size, etc.(as I do when using GPT slotRenderEnded event)?

zombifier commented 3 years ago

Regarding GPT, it will be able to collect the consent signals as long as the corresponding consent API framework (CCPA, TCFv2, etc.) is on the page. Are they being loaded on the page? This might be your solution.

cburaca commented 3 years ago

I believe so, using the amp-consent component, because when I print the consent information retrieved from the window.context, I see this: context

The way the amp-ad component gets this from the CMP isn't the same as GPT would?

zombifier commented 3 years ago

To be more specific, GPT cannot read the window.context object, it will need to interact with the TCFv2 API in order to get GDPR consent information. You'll need to load or implement this API on the AMP page that provides the information from window.context (populated by amp-consent beforehand). Let us know if you have more questions.

jeffkaufman commented 3 years ago

Another way to say this is that you probably would need to build an adapter. The adapter would consume the consent signals from window.context and present them to GPT by implementing the CMP side of the TCFv2 API.

Note that this is not a recommended way of handling this. Instead, GPT team recommends publishers use amp-doubleclick, which does understand AMP's method of handling consent, and is also much more efficient because it can use the existing AMP runtime.

cburaca commented 3 years ago

Thanks @zombifier and @jeffkaufman.

I'll try to build this adapter and let you know.

jeffkaufman commented 3 years ago

Reviewing https://github.com/InteractiveAdvertisingBureau/GDPR-Transparency-and-Consent-Framework/blob/master/TCFv2/TCF-Implementation-Guidelines.md it's possible that you need to register as a CMP with IAB Europe before implementing the CMP side (consent signals producer) of this adapter. Probably good to check in with them regardless, since they "own" this API?

krzysztofequativ commented 8 months ago

@cburaca, have you figured out how to solve the issue? I'm struggling with the same case in my adapter.