amp.dev icon indicating copy to clipboard operation
amp.dev copied to clipboard

Example for Cookie consent with CCPA, GDPR, and other geo groups and multiple cookies for Analytics and features

Open MrCsabaToth opened this issue 4 years ago • 5 comments

🚀 Feature Request

It's so common scenario that it'd be good to have an example for a cookie consent, which:

  1. Identifies EEA (GDPR) geo group
  2. CCPA geo group
  3. All other (maybe in that case still offer CCPA?)

The example would contain Google Analytics (or other analytics), Disqus comment sections or other amp-iframe.

Problem

I have not been able to find a clear solution for these, and I have uncertainty what I'll patch together is good.

Solution

I'd like to see an official solution.

Alternatives

Could be also a blog post. It'd be best if the solution wouldn't require own hosted portions of the consent logic, but if that's the only way to handle cookie categories I'm highly interested.

Additional information (optional)

I feel like since GDPR and CCPA are mandatory now, and majority of the websites use analytics and other features requiring cookies that it'd be best to have a pair official examples.

MrCsabaToth avatar May 20 '20 21:05 MrCsabaToth

I really looking forward example. For me, it sounds like super complicated how to implement GDPR compliant cookie. I know that everything is in the documentation but usually when I am coding I am using an official example and use documentation to tune it only.

piotr-galas avatar Nov 28 '20 17:11 piotr-galas

As of now I'm using a simple modal dialog with Accept/Reject choices and I tried to summarize all the possible cookies I saw. See https://gitlab.com/MrCsabaToth/mrcsabatoth.gitlab.io/-/blob/master/_layouts/default.html#L64

One of the most difficult things without AMP is to first offer the information and choice to the user and then only allow selected cookies on demand, which would require on-demand load of JS libraries and some content. data-block-on-consent keyword and <amp-iframe makes this extremely easy.

But also as a reference I went through various trials until I got there: https://stackoverflow.com/questions/61944487/how-to-get-amp-cookie-consent-modal-dialog-backdrop-working

MrCsabaToth avatar Nov 29 '20 01:11 MrCsabaToth

Do you know if there is a way to load the amp-consent JSON content dynamically? I am trying to use different configurations on the page but I need to change the amp-consent implementation every time I want to change something.

I'm looking for a way to load the JSON configuration from an external source or something like that.

jcmlmorav avatar Mar 05 '21 17:03 jcmlmorav

Do you know if there is a way to load the amp-consent JSON content dynamically? I am trying to use different configurations on the page but I need to change the amp-consent implementation every time I want to change something.

I'm looking for a way to load the JSON configuration from an external source or something like that.

Mine is hard wired. I think this can very well be done and it's actually depends on what kind of SSG (Static Site Generator) you use. Your build pipeline together with your SSG may capable of picking up a JSON and interpolating parts of your consent. If you have such solution in the future, I'd be interested.

MrCsabaToth avatar Mar 05 '21 19:03 MrCsabaToth

For those that come after (since this issue is still open)...

There are now more examples published (eg: https://amp.dev/documentation/examples/user-consent/geolocation-based_consent_flow/?format=websites - see the left navigation for variations)

I'm looking for a way to load the JSON configuration from an external source or something like that.

Iubenda, for one, moves custom JS logic into a non-AMP iframe containing the prompt UI triggered via amp-geo + amp-consent with promtUISrc, then messages your AMP parent page with the user response via window.postMessage.

ptim avatar Sep 28 '22 01:09 ptim