2

The newly introduced AMP-Consent Component has some really nice features, which i would adapt in order to comply with the new cookie - policy.

https://github.com/ampproject/amphtml/issues/13716

My question is: how to implement an endpoint and how to trigger this (xhr)? I haven't found an really working solution for this till yet.

Christian Felix
  • 644
  • 1
  • 9
  • 28

1 Answers1

3

You can find two sample flows on how to use amp-consent on ampbyexample.com.

Sebastian Benz
  • 4,238
  • 1
  • 21
  • 17
  • thank you Sebastian. The only question that remains is, how i am supposed to implement the endpoint, in the above example: "checkConsentHref": "/samples_templates/consent/getConsent". – Christian Felix Apr 17 '18 at 09:31
  • 1
    A CORS endpoints can be specified via the `checkConsentHref` attribute. This endpoint will be queried via a POST request to determine if the consent UI specified for it needs to be shown. The response should look like this: { "promptIfUnknown": boolean (true/false) } The response will indicate if the consent needs to be shown or not. If it needs to be shown, the element with the id given in `promptUI` will be displayed. – Sebastian Benz Apr 17 '18 at 12:31
  • @SebastianBenz so are you saying that we can now essentially implement the component on our AMP pages? Is it production ready? – Arminder Dahul Apr 18 '18 at 07:30
  • Here is yesterday's blog post announcing the component: https://amphtml.wordpress.com/2018/04/18/new-tools-for-building-user-controls-in-amp-pages/. It's currently still marked as experimental, but will launch soon. – Sebastian Benz Apr 19 '18 at 08:21
  • @SebastianBenz, does the amp-consent supports an the moment only one consent instance? I was strongly suggesting that the purpose of amp-consent was to enabling mutiple consents instances , as shown here: https://github.com/ampproject/amphtml/issues/13716. I am doing something wrong? – Christian Felix Apr 23 '18 at 10:35
  • At the moment is supports only a single instance, support for multiple consents is planned (afaik). Please chime in on the discussion on Github if you want to know more. – Sebastian Benz Apr 24 '18 at 11:30