AriWeissman
Director of UX

Implementing Evidon AMP support Without Using The AMP-Geo Tag

How do I implement Evidon AMP support without using the AMP-Geo tag?

--


Ari Weissman
Sr Director of UX & Community

## If I’ve helped, accept this response as a solution so that other’s can find is more quickly in the future.
## Have thoughts on Crownpeak products? We'd love to hear them. Speak with the Crownpeak Product Team..

0 Kudos
1 Reply
kensnyder
Head of Support

Great @AriWeissman .

I've pasted in below the details from one of our whitepapers on that topic. It provides an explanation on how the AMP consent tag works and offers an alternative to enabling consent support for all countries without using the <amp-geo> tag.

 

 

-------

 

Overview

The default Evidon AMP tag for the Universal Consent Platform (UCP) uses the <amp-geo> tag to control where consent support is needed. Based on customer feedback that consent support would only be offered in the EU, the tag has been implemented to automatically include all EU countries . If you need to support additional countries, they can be added to the list and they will be automatically supported.

Recently we have received requests to enable the amp-consent support for every country. This can be done in our current tag but adding so many additional countries would be tedious and error-prone. This document describes another mechanism to enable this type of support.

How <amp-consent> Works

To better understand the modifications recommended below, here is a very short explanation of how the <amp-consent> tag decides when to show the consent interface.

  • Inside the <amp-consent> tag there is a JSON object with a single required property: consents. Inside that object, you define the different consent scenarios you wish to support. Normally there will be only one consent defined, but you could have multiple if you need to show a different prompt for different scenarios.
  • When the tag executes, it looks at the settings under the “consents” to see if it should run a prompt. Specifically, it looks at either of the following options:
    • checkConsentHref
    • promptIfUnknownForGeoGroup
  • The checkConsentHref is a URL that points to an external service which, in theory, performs some kind of check to see if the consent interface should be displayed or not. It returns a simple object to indicate the result.
  • The promptIfUnknownForGeoGroup option takes a reference to an <amp-geo> tag, where it will pull the specified list of countries. If the current country is in the list, the consent interface is displayed.

Evidon AMP Tag

The Evidon team elected to use the <amp-geo> tag as our mechanism to show the consent interface. We did this for a number of reasons but primarily for ease of deployment and speed. By including the geo in our tag, we can set up consent support without needing to roll out a service to be used by the checkConsentHref option. While we never actually ran timings, it seems likely that using the geo tag is faster and more reliable than calling a 3rd party service hosted on the internet.

Showing Consent For All Countries

There are 2 options for modifications to enable consent support for all countries.

  • The first option is to extend the <amp-geo> tag to include all countries (at least all reasonable countries)
  • The other approach requires altering the provided AMP tag to use the checkConsentHref option.

Since altering the <amp-geo> tag is self-explanatory, here we will focus on the second option.

Note: We will summarize the steps here, but for full details please visit the amp-consent reference documents at https://www.ampproject.org/docs/reference/components/amp-consent

The trickiest part of this is setting up the service you will use. The AMP team made this a little more difficult by requiring the communication to be a POST (instead of a GET). A GET would have allowed us to just store a simple object on our CDN and return that from the call. But a POST request requires a server to process the request.

You will need to build a web endpoint that accepts a POST. That endpoint will receive the following object structure:

{
“consentInstanceId”: “my-consent”
}

The instance id sent is the name of the consent set up in the <amp-consent> consents object structure. For the evidon tag it will be “gdpr” instead of “my-consent”.

If you are blindly enabling consent support then what is passed in can really just be ignored unless you want to record the request somewhere for logging.

From the service you will need to return the following structure:

{
“promptIfUnknown”: true/false
}

And that is really it for the service. Not much to it, but it may need to allow CORS support so this request can be made from cross-domain requests. Also, it needs to be available globally, so it can be hit from anywhere the amp page is executing.

Once you have a service up and running you just need to modify the tag to use that option. Here’s how to do that.

Let’s assume you set up your service at the following endpoint: “https://www.customer.com/amp/consent”

With that service URL you will modify the provided tag in the following manner:

  1. Remove the tag we provide (unless you need it for some other reason).
  2. Change this:
“consents”:
    { “gdpr”: {
        “promptIfUnknownForGeoGroup”: “consentCountries”,
        “promptUI”: “evidonConsent”
    }
}

To this: 

 

“consents”: {
    “gdpr”: {
        “checkConsentHref”: “https://www.customer.com/amp/consent”,
        “promptUI”: “evidonConsent”
    }
}

 

That is all there is to it. Do a little testing to make sure it all works, but you should now be requiring consent from all countries for the AMP tag.

--


Ken Snyder
VP, Customer Support & Cloud Operations

## If I’ve helped, accept this response as a solution so that other’s can find is more quickly in the future.
## Have thoughts on Crownpeak products? We'd love to hear them. Speak with the Crownpeak Product Team..

0 Kudos