AMP - Restrict consent collection to region

The <amp-geo> component is an optional configuration that your organization can use to ensure that consent is only required for particular regions within CCPA or GDPR TCF. More information on geo-targeting options can be found on the official AMP documentation page, click here and here.

  Note: Please be advised that the configuration of your AMP property (property, vendor list, messages, etc...) in the Sourcepoint portal needs to follow prescribed guidelines specific to AMP. In addition to this implementation article, please review our AMP configuration guidelines article.


<amp-geo> implementation

  Note: When using <amp-geo>to restrict collection to specific region(s) do not add any geo-restrictions to your scenarios on the AMP property. 

Implementing the <amp-geo> component into your AMP implementation is comprised of three parts:

AMP header

In addition to the two headers necessary for a AMP implementation, your organization will also need to add the following header to utilize the <amp-geo> component:

<script async custom-element="amp-geo" src="https://cdn.ampproject.org/v0/amp-geo-0.1.js"></script>

<amp-geo> component

Add the <amp-geo> component to your AMP implementation to define the region(s) where you require consent.

CCPA example GDPR TCF example

The example below is for CCPA, using a preset list of US & California regions requiring consent:

<amp-geo layout="nodisplay">
   <script type="application/json">
      {
         "ISOCountryGroups": {
            "ccpa": ["preset-us-ca"]
         }
      }
   </script>
</amp-geo>

<geoOverride> in <amp-consent> component

With the region specified in the <amp-geo> component, use the geoOverride parameter within the <amp-consent> component to specify the region that should be detected before executing the consent messaging experience.

CCPA example
<amp-consent id='consent' layout='nodisplay' type='SourcePoint'>
   <script type="application/json">
      {
         "consentInstanceId": "sourcepoint",
         "consentRequired": false,
         "checkConsentHref": false,
         "geoOverride": {
            "ccpa": {
               "checkConsentHref": "https://{CNAME DOMAIN}/wrapper/ccpa/amp-v2?authId=CLIENT_ID",
               "consentRequired": "remote",               
               "postPromptUI": "consent-ui",
               "promptUISrc": "https://{CNAME DOMAIN}/amp/unified/index.html?authId=CLIENT_ID&source_url=SOURCE_URL",
               "cookies": {
                  "enabled": true,
                  "AMP-CONSENT": {
                     "value": "LINKER_PARAM(authId, _a)"
                  }
               },
               "clientConfig": {
                  "accountId": {__SP_ACCOUNT_ID__},
                  "propertyHref": {__SP_SITE_HREF__},
                  "stageCampaign": false,
                  "isCCPA": true,
                  "privacyManagerId": {__SP_PRIVACY_MANAGER_ID__} 
	       }
	    }
	 }          }
   </script>
</amp-consent>

The following parameters should be included in the <amp-consent> component outside of geoOverride:

Parameter Description
consentInstanceId Parameter tells the <amp-consent> component to use Sourcepoint code. This parameter should always be set to sourcepoint.

The following should be included within geoOverride under your eea specific grouping:

Parameter Description
consentRequired

Parameter tells the <amp-consent> component to use code from a remote source. This parameter should always be set to remote.

checkConsent
Href
URL that will check the end-user's consent. The path for this URL will leverage the CNAME record.

The format of the URL path is https://{CNAME DOMAIN}/wrapper/tcfv2/v1/amp-v2?authId=CLIENT_ID where {CNAME DOMAIN} would be replaced by the CNAME domain record created.
promptUISrc URL that will return the post prompt user interface where end-user's can change their consent.

The path should always be set to https://{CNAME DOMAIN}/amp/index.html?authId=CLIENT_ID where {CNAME DOMAIN} would be replaced by the CNAME domain record previously created.
postPromptUI

The page element that should be displayed to end-users to provide them with the ability to change their consent after they initially consent.

cookies

Required to store and persist consent across pages. This object should always be defined exactly as in the example without modification.

accountId Replace the {__SP_ACCOUNT_ID__} placeholder with your Sourcepoint account ID.
propertyHref Property created in the Sourcepoint portal that contains the message, scenario, partition and campaign.

Replace the {__SP_SITE_HREF__} placeholder with the property name, preceded by the https:// protocol. For example, a property defined as amp.property.tcfv2 in the UI should have a propertyHref parameter of https://amp.property.tcfv2.
isCCPA

Parameter tells the <amp-consent> component that the implementation is set to CCPA regulations.

StageCampaign

A parameter that accepts a boolean value. When set to true, the implementation will display a CCPA messaging campaign configured for the stage environment.

privacy
ManagerId
The privacy manager id can be found through this link:
  • https://analytics.sourcepoint.com/ccpa/privacy_manager

Click on the privacy manager name, the id can be found in the URL of the webpage. Replace the {__SP_PRIVACY_MANAGER_ID__} placeholder with the the privacy manager id, found in the Sourcepoint analytics dashboard and the privacy manager builder for your campaign.

GDPR TCF example
<amp-consent id='consent' layout='nodisplay' type='SourcePoint'>
   <script type="application/json">
      {
         "consentInstanceId": "sourcepoint",
         "consentRequired": false,
         "checkConsentHref": false,
         "geoOverride": {
            "eea": {             
               "checkConsentHref": "https://{CNAME DOMAIN}/wrapper/tcfv2/v1/amp-v2?authId=CLIENT_ID",
               "consentRequired": "remote",               
               "postPromptUI": "consent-ui",
               "promptUISrc": "https://{CNAME DOMAIN}/amp/unified/index.html?authId=CLIENT_ID&source_url=SOURCE_URL",             
               "cookies": {
                  "enabled": true,
                  "AMP-CONSENT": {    "value": "LINKER_PARAM(authId, _a)" }
               },
               "clientConfig": {
                  "accountId": {__SP_ACCOUNT_ID__},
                  "propertyHref": {__SP_PROPERTY_HREF__},
                  "stageCampaign": false,
                  "pmTab": "purposes",
                  "privacyManagerId": {__SP_PRIVACY_MANAGER_ID__},
                  "isTCFV2": true               
	             }
	          }
	       }
      }
   </script>
</amp-consent>
    

The following parameters should be included in the <amp-consent> component outside of geoOverride:

Parameter Description
consentInstanceId Parameter tells the <amp-consent> component to use Sourcepoint code. This parameter should always be set to sourcepoint.

The following should be included within geoOverride under your eea specific grouping:

Parameter Description
consentRequired

Parameter tells the <amp-consent> component to use code from a remote source. This parameter should always be set to remote.

checkConsentHref URL that will check the end-user's consent. The path for this URL will leverage the CNAME record.

The format of the URL path is https://{CNAME DOMAIN}/wrapper/tcfv2/v1/amp-v2?authId=CLIENT_ID where {CNAME DOMAIN} would be replaced by the CNAME domain record created.
promptUISrc URL that will return the post prompt user interface where end-user's can change their consent.

The path should always be set to https://{CNAME DOMAIN}/amp/index.html?authId=CLIENT_ID where {CNAME DOMAIN} would be replaced by the CNAME domain record previously created.
postPromptUI

The page element that should be displayed to end-users to provide them with the ability to change their consent after they initially consent. Click here for more information.

cookies

Required to store and persist consent across pages. This object should always be defined exactly as in the example without modification.

accountId Replace the {__SP_ACCOUNT_ID__} placeholder with your Sourcepoint account ID.
propertyHref Property created in the Sourcepoint analytics dashboard that contains the message, scenario, partition set, and campaign.

Replace the {__SP_PROPERTY_HREF__} placeholder with the property name, preceded by the https:// protocol. For example, a property defined as amp.property.tcfv2 in the UI should have a propertyHref value of https://amp.property.tcfv2.
privacy
ManagerId
Replace the {__SP_PRIVACY_MANAGER_ID__} placeholder with the the privacy manager ID, found in the Sourcepoint analytics dashboard and the privacy manager builder for your campaign.
isTCFv2

Parameter tells the <amp-consent> component whether the implementation is for GDPR TCF v1 or GDPR TCF v2.

If the value for this parameter is false, the implementation will default to GDPR TCF v1 logic.

pmTab

Determines which tab is opened by default when the privacy manager is accessed.

The value for the parameter can either be vendors or purposes.

stageCampaign

A parameter that accepts a boolean value. When set to true, the implementation will display a GDPR TCF v2 messaging campaign configured for the stage environment.


<amp-geo> implementation example

The following is a code example using a property from a demo account and the default domain from Sourcepoint. The example is for a TCF AMP implementation where consent from German & French territories are required:

<!doctype html>
<html amp lang="en">
   <head>
      <meta charset="utf-8">
      <title>Hello AMPs</title>
      <script async src="https://cdn.ampproject.org/v0.js"></script>
      <!-- required for the amp-consent component -->
      <script async custom-element="amp-consent" src="https://cdn.ampproject.org/v0/amp-consent-0.1.js"></script>
      <!-- required for geo-targeting -->
      <script async custom-element="amp-geo" src="https://cdn.ampproject.org/v0/amp-geo-0.1.js"></script>
      <!-- required to sync auth_id with publishers domain and Google.com domain -->
      <script async custom-element="amp-analytics" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>
</head> <body> <h1>Welcome to the mobile web</h1>
<amp-analytics type="googleanalytics"> <script type=application/json> { "linkers":{"authId":{"ids":{"_a":"CLIENT_ID(AMP-CONSENT)"},"enabled":true,"proxyOnly":false}},"cookies":{"enabled":true,"authId":{"value":"LINKER_PARAM(authId, _a)"}} } </script> </amp-analytics> <amp-geo layout="nodisplay"> <script type="application/json"> { "ISOCountryGroups": { "eea": ["de", "fr"] } } </script> </amp-geo> <amp-consent id="consent" layout="nodisplay" type="SourcePoint"> <script type="application/json"> { "consentInstanceId": "sourcepoint", "consentRequired": false, "checkConsentHref": false, "geoOverride": { "eea": { "checkConsentHref": "https://cdn.privacy-mgmt.com/wrapper/tcfv2/v1/amp-v2?authId=CLIENT_ID", "consentRequired": "remote", "postPromptUI": "consent-ui", "promptUISrc": "https://cdn.privacy-mgmt.com/amp/unified/index.html?authId=CLIENT_ID&source_url=SOURCE_URL", "cookies": { "enabled": true, "AMP-CONSENT": { "value": "LINKER_PARAM(authId, _a)" } }, "clientConfig": { "accountId": 1732, "propertyHref": "https://amp.newscriptdemo.com", "stageCampaign": false, "pmTab": "purposes", "privacyManagerId": 547514, "isTCFV2": true } } } } </script> </amp-consent> <div id="consent-ui"> <button on="tap:consent.prompt(consent=SourcePoint)">Privacy Settings</button> </div> </body> </html>
Was this article helpful?
0 out of 0 found this helpful