This article covers the implementation steps for an updated TCF and U.S. Privacy - CCPA onsite configuration that utilizes an improved CDN setup and cloud infrastructure. In comparison to previous versions this updated configuration provides the following benefits once implemented.
- Reduced risk of consent messaging being blocked by ad blockers
- Improved performance in the delivery of first layer messages
- Simplified implementation of optional CNAME strategy to improve the persistence of 1st party cookies in adverse browser environments.
If you wish to upgrade from a previous TCF and U.S. Privacy - CCPA configuration you will have to change your current Sourcepoint cnaming setup. The minimum version of the U.S. Privacy - CCPA client-side library is 1.0.44 and above. The minimum version of the TCF client-side library is 1.1.3 and above. If you are hosting the client-side library in your own CDN you will have to update the library versions in order to benefit from these improvements.
Overview
Setting up Sourcepoint’s combined U.S. Privacy - CCPA and GDPR TCF solution is a simple process that publisher teams can follow to get up and running quickly. This document is a quick start guide on how to implement a Do Not Sell (my data) experience on your website using Sourcepoint’s JavasScript code-snippet along with Sourcepoint's GDPR TCF solution. The JavaScript code snippet needs to be placed on your site, preferably in the head
tag before any advertising technology scripts implemented on your site. The goal of the implementation is to render a Do Not Sell (my data) notification required under U.S. Privacy - CCPA and syndicate the user's privacy settings to any relevant third party technology running on your site along with a GDPR TCF message when appropriate. The Sourcepoint script implementation has been optimized for high performance and fast delivery.
Below are the tags and libraries necessary to serve a U.S. Privacy - CCPA "Do Not Sell" message and a GDPR TCF message:
//Example only. Please use stub file generated in Sourcepoint portal as it may have changed.
<script type="text/javascript">
function _typeof(t){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}!function(){for(var t,e,o=[],n=window,r=n;r;){try{if(r.frames.__tcfapiLocator){t=r;break}}catch(t){}if(r===n.top)break;r=n.parent}t||(function t(){var e=n.document,o=!!n.frames.__tcfapiLocator;if(!o)if(e.body){var r=e.createElement("iframe");r.style.cssText="display:none",r.name="__tcfapiLocator",e.body.appendChild(r)}else setTimeout(t,5);return!o}(),n.__tcfapi=function(){for(var t=arguments.length,n=new Array(t),r=0;r<t;r++)n[r]=arguments[r];if(!n.length)return o;"setGdprApplies"===n[0]?n.length>3&&2===parseInt(n[1],10)&&"boolean"==typeof n[3]&&(e=n[3],"function"==typeof n[2]&&n[2]("set",!0)):"ping"===n[0]?"function"==typeof n[2]&&n[2]({gdprApplies:e,cmpLoaded:!1,cmpStatus:"stub"}):o.push(n)},n.addEventListener("message",(function(t){var e="string"==typeof t.data,o={};if(e)try{o=JSON.parse(t.data)}catch(t){}else o=t.data;var n="object"===_typeof(o)?o.__tcfapiCall:null;n&&window.__tcfapi(n.command,n.version,(function(o,r){var a={__tcfapiReturn:{returnValue:o,success:r,callId:n.callId}};t&&t.source&&t.source.postMessage&&t.source.postMessage(e?JSON.stringify(a):a,"*")}),n.parameter)}),!1))}();
</script>
<script type="text/javascript">
(function () { var e = false; var c = window; var t = document; function r() { if (!c.frames["__uspapiLocator"]) { if (t.body) { var a = t.body; var e = t.createElement("iframe"); e.style.cssText = "display:none"; e.name = "__uspapiLocator"; a.appendChild(e) } else { setTimeout(r, 5) } } } r(); function p() { var a = arguments; __uspapi.a = __uspapi.a || []; if (!a.length) { return __uspapi.a } else if (a[0] === "ping") { a[2]({ gdprAppliesGlobally: e, cmpLoaded: false }, true) } else { __uspapi.a.push([].slice.apply(a)) } } function l(t) { var r = typeof t.data === "string"; try { var a = r ? JSON.parse(t.data) : t.data; if (a.__cmpCall) { var n = a.__cmpCall; c.__uspapi(n.command, n.parameter, function (a, e) { var c = { __cmpReturn: { returnValue: a, success: e, callId: n.callId } }; t.source.postMessage(r ? JSON.stringify(c) : c, "*") }) } } catch (a) { } } if (typeof __uspapi !== "function") { c.__uspapi = p; __uspapi.msgHandler = l; c.addEventListener("message", l, false) } })();
</script>
<script type="text/javascript">
window._sp_ = {
config: {
accountId: ACCOUNT_ID_HERE,
baseEndpoint: 'https://cdn.privacy-mgmt.com',
targetingParams: {
type: "GDPR"
}
}
}
window._sp_ccpa = {
config: {
baseEndpoint: "https://cdn.privacy-mgmt.com",
accountId: ACCOUNT_ID_HERE,
getDnsMsgMms: true,
alwaysDisplayDns: false,
targetingParams: {
type: "CCPA"
}
}
}
</script>
<script src="https://cdn.privacy-mgmt.com/wrapperMessagingWithoutDetection.js"></script>
<script src="https://cdn.privacy-mgmt.com/ccpa.js"></script>
Note: Previous versions of this documentation included the mmsDomain
and ccpaOrigin
configuration parameters have been replaced by the new baseEndpoint
parameter for optimization reasons.
These changes are completely backwards compatible. However, it is recommended that older implementations move to the new parameter to benefit from the optimizations.
TCF configuration details
The first section of the snippet contains the IAB stub file. The stub file is defining the __tcfapi
function to queue all calls into the CMP's onsite API to be released as soon as the consent information is available. It is important to have this script tag always at the top of the HTML document in the first position to avoid errors and failure of the service. To learn more about the IAB stub file please refer to the IAB's TCF Technical Specifications.
The second section of the snippet contains your account specific configuration parameters. This section sets up the parameters necessary for your website to communicate with the Sourcepoint messaging platform and establishes a communication channel with the Sourcepoint messaging and consent service libraries. In addition to the standard parameters in the example above, there are additional parameters that allow for JavaScript callbacks to be triggered for different customization purposes. For GDPR TCF implementations there are currently two required parameters to deliver a user notification successfully:
Parameter | Description |
baseEndpoint |
https://cdn.privacy-mgmt.com is a single server endpoint from where the messaging as well as the GDPR and TCF experience is served. The Note: If your organization has edited the baseEndpoint with a CNAME DNS Record you will also need to edit the URL for this wrapper URL. Please follow the following format if necessary:
<script src="https://client.domain.com/wrapperMessagingWithoutDetection.js"></script>
|
accountId |
This parameter needs to be used to set the account ID you received from your Sourcepoint account manager - The ID associates your data and website with your account in the Sourcepoint dashboard. |
In addition to the required parameters you can use following optional configuration parameters to tailor the implementation to your use case:
authId
Allows your organization to pass a consent identifier to Sourcepoint to be used with authenticated consent. Click here to learn more.
window._sp_ = {
config: {
accountId: 1234,
baseEndpoint: "https://cmp.clienturl.com",
propertyHref: "https://uat.tomnews.com",
authId: 123456
}
}
authCookie
Allows your organization to configure a unique name for Sourcepoint's authId
cookie.
window._sp_ = {
config: {
accountId: 1234,
baseEndpoint: "https://cmp.clienturl.com",
propertyHref: "https://uat.tomnews.com",
authCookie: "test_uuid"
}
}
joinHref
When set to true
, will ensure that all directory regular expression functionality works in conjunction with the propertyHref
parameter. The joinHref
parameter is solely used to test your implementation across different servers while still allowing for URL RegEx matching.
window._sp_ = {
config: {
accountId: 1234,
baseEndpoint: "https://cmp.clienturl.com",
propertyHref: "https://uat.tomnews.com",
joinHref : true
}
}
isSPA
When set to true, will confirm the implementation for a single page application and will show a message only when window._sp_.executeMessaging();is triggered.
Note: window._sp_.executeMessaging();
is supposed to be called on each (virtual) pageload
window._sp_ = {
config: {
accountId: 1234,
baseEndpoint: "https://cmp.clienturl.com",
isSPA : true
}
}
groupPmId
Allows your organization to use the privacy manager ID for the property group use of a property group's privacy manager ID.
Note: Call window._sp_.loadPrivacyManagerModal()
without passing a parameter and the privacy manager that displays will be that property's version of the groupPmId
privacy manager.
propertyHref
Maps the implementation to a specific URL as set up in the Sourcepoint account dashboard.
Note: Use the propertyHref
parameter to spoof messaging campaigns onto a local environment.
propertyHref: "https://tom.sourcepoint.com",
propertyId
Maps the message to a specific property (website, app, OTT) as set up in Sourcepoint account dashboard.
targetingParams
This parameter enables you to create key-value pairs that can be used for targeting in the scenario builder in the Sourcepoint dashboard. Key-value pairs can be created in the following format:
targetingParams: {
key1: valueA,
key2: valueB
}
Click here for more information on key-value pairs.
events
An array of events that allow JavaScript callbacks to be triggered. Please refer to the Optional Callback document to learn more about how to use events as part of your setup configuration.
consentLanguage
If you want to ensure that the purposes or stack names listed in a consent message to remain in the same language regardless of users browser language setting, you can set this using the consent language parameter. The parameter below would be added to the config section of the Sourcepoint tag and would set the language to Dutch.
consentLanguage: "nl"
If this parameter is not present, the stacks and purposes will appear according the user's preferred language. A list of two-letter codes is available at https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes.
U.S. Privacy - CCPA configuration details
The first section of the U.S. Privacy - CCPA snippet contains the IAB Stub function. The Stub function sets up the IAB US Privacy String object __uspapi
and makes it available on queue to be called and released when needed. It is important to have this script tag always at the top in the first position to avoid errors and failure of the service.
The second section of the snippet contains your account specific configuration parameters. This section sets up the parameters necessary for your website to communicate with the Sourcepoint messaging platform and establishes a communication channel with the Sourcepoint messaging service library. In addition to the standard parameters in the example above, there are additional parameters that allow for JavaScript callbacks to be triggered for different customization purposes. For U.S. Privacy - CCPA implementations, there are currently four required parameters to deliver a message successfully:
Parameter | Description |
accountId |
This parameter needs to be used to set the account ID you received from your Sourcepoint account manager - The ID associates your data and website with your account in the Sourcepoint dashboard. |
baseEndpoint |
https://cdn.privacy-mgmt.com is a single server endpoint from where the messaging as well as the GDPR and TCF experience is served. The baseEndpoint can also be changed to a CNAMED 1st party subdomain in order to persist 1st party cookies on Safari web browser (due to Safari’s ITP) by setting cookies through the server with set-cookie rather than using document.cookie on the page. Changing the baseEndpoint domain is optional but recommended. |
getDnsMsgMms |
As an alternative to establishing the communication with the message management service through the mmsDomain , you can set this value to false to establish the channel through the ccpaOrigin URL. This approach enables use cases in where a U.S. Privacy - CCPA Do Not Sell (my data) notification is shown on the website without creating a campaign in the Sourcepoint dashboard. |
alwaysDisplayDns |
Setting this parameter to true enables use cases where a Sourcepoint Do Not Sell (my data) notification is hardcoded. |
In addition to the required parameters you can use following optional configuration parameters to tailor the implementation to your use case:
siteHref
Maps the message to a specific URL.
siteId
targetingParams
This parameter enables you to create key-value pairs that can be used for targeting in the scenario builder in the Sourcepoint dashboard. Key-value pairs can be created in the following format:
targetingParams: {
key1: valueA,
key2: valueB
}
Click here for more information on key-value pairs.
Setting up The Messaging Domain
Setting up a first-party subdomain with a CNAME record for the baseEndpoint
is optional. The goal of creating a first-party subdomain is for the U.S. Privacy - CCPA and GDPR TCF JavaScript libraries to communicate with the Sourcepoint messaging server in a first-party capacity. The benefit of this approach is to allow Sourcepoint cookies to be the first party and thus, circumventing Safari’s Intelligent Tracking Prevention (ITP). This creates a discrete messaging channel between the publisher’s messaging subdomain and the Sourcepoint messaging server.
Note: You can utilize the same CNAME for both U.S. Privacy - CCPA and GDPR messaging campaigns.
Comments
0 comments