Sourcepoint offers messaging capabilities for multiple regulatory frameworks for your AMP property. These messages are surfaced to your end-users in accordance with the campaigns (and scenarios) that you configure for the AMP property. In this article, we will cover how to implement GDPR TCF on your AMP property.

  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


Implementation code snippet for AMP property

In this section, we will cover the various elements that you may find in the GDPR TCF implementation code for your AMP property. The GDPR TCF implementation code can be divided into three distinct sections:

GDPR TCF AMP headers

The following scripts should be copied into the header of the AMP property without modification:

<script async="" src="https://cdn.ampproject.org/v0.js"></script>
<!-- required for the amp-consent component -->
<script async="" src="https://cdn.ampproject.org/v0/amp-consent-0.1.js"></script>
<!-- required to sync auth_id with publishers domain and Google.com domain -->
<script async="" src="https://cdn.ampproject.org/v0/amp-analytics-0.1.js"></script>

<amp-analytics> component

The following code should be inserted near the top of the body of the AMP property without modification. This component allows an end-user’s consent selections to persist across AMP pages hosted on a Google domain and your organization's domain. 

<amp-analytics>
<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>

Further configure the <amp-analytics> component for your property

  Note: This article describes how to configure the <amp-analytics> component specifically for the implementation of the Sourcepoint CMP for AMP. Please read the official AMP guide for further instructions (click here and here) on how to configure the <amp-analytics> component for your property.

<amp-consent> component

The amp-consent component is where you will include the specific account and property details for your organization. Within the component you will need to update certain placeholders with the correct values.

<amp-consent id="consent" layout="nodisplay">
   <script type="application/json">
      {
         "consentInstanceId": "Sourcepoint",
         "consentRequired": "remote",
         "checkConsentHref": "https://{CNAME DOMAIN}/wrapper/tcfv2/v1/amp-v2?authId=CLIENT_ID",
         "promptUISrc": "https://{CNAME DOMAIN}/amp/index.html?authId=CLIENT_ID",
         "mmsDomain": "https://{CNAME DOMAIN}",
         "postPromptUI": "consent-ui",
         "cookies": {
            "enabled": true,
            "AMP-CONSENT": {    "value": "LINKER_PARAM(authId, _a)" }
         },
         "clientConfig": {
            "accountId": {__SP_ACCOUNT_ID__},
            "propertyHref": {__SP_PROPERTY_HREF__},
            "propertyId": {__SP_PROPERTY_ID__},
            "privacyManagerId": {__SP_PRIVACY_MANAGER_ID__},
            "isTCFV2": true,
            "pmTab": "purposes",
            "stageCampaign": false,
            "targetingParams": {    "{__KEY__}": "{__VALUE__}"  }
         }
      }
   </script>
</amp-consent>
Parameter Description
consentInstanceId

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

consentRequired

Parameter tells the <amp-consent> component to use code from a remote source. This parameter should always be set to remoteunless restricting consent collection to region(s). Click here for more information.

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.
mmsDomain Domain that will communicate with the Sourcepoint messaging service.

The format for the path of this parameter is https://{CNAME DOMAIN} 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.

uiConfig

An optional parameter that adds a light black overlay to the site behind the message experience. Can be used to deter end-user scrolling without engaging with your consent experience.

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.
propertyId Replace the {__SP_PROPERTY_ID__} placeholder with the property ID on which the message is to be served. You can find the property ID from the Sourcepoint analytics dashboard.
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.

targetingParams

An optional configuration that allows a developer to set arbitrary key/value pairs. These key/value pairs are sent to Sourcepoint servers where they can be used to take a decision within the scenario builder.

targetingParams: { key1: valueA, key2: valueB }


Implementation code example

The following is a code example using a property from a demo account and the default domain from Sourcepoint.

<!doctype html>
   <html amp lang="en">
   <head>
      <meta charset="utf-8">
      <title>Simple AMP implementation</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 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>Simple AMP code example - Sourcepoint</h1>
      <amp-analytics>
         <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-consent id="consent" layout="nodisplay"> <script type="application/json"> { "consentInstanceId": "Sourcepoint", "consentRequired": "remote", "checkConsentHref": "https://sp-cdn.sp-demo.com/wrapper/tcfv2/v1/amp-v2?authId=CLIENT_ID", "promptUISrc": "https://sp-cdn.sp-demo.com/amp/index.html?authId=CLIENT_ID", "mmsDomain": "https://sp-cdn.sp-demo.com", "postPromptUI": "consent-ui", "cookies": { "enabled": true, "AMP-CONSENT": { "value": "LINKER_PARAM(authId, _a)" } }, "clientConfig": { "accountId": 1732, "propertyHref": "https://amp.newscriptdemo.com", "propertyId": 19118, "privacyManagerId": 547514, "isTCFV2": true, "pmTab": "purposes", "stageCampaign": false, "targetingParams": { "color": "red" } } } </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