Combined Sourcepoint CCPA to Version 2 GDPR Code

Implementation of the on-page code of Sourcepoint's CCPA solution for an account already using version 2 of Sourcepoint's GDPR CMP

This article covers the implementation steps for an updated combined TCFv2 and 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 combined TCFv2 and CCPA configuration you will have to change your current Sourcepoint CNAME record setup as outlined in this article. The minimum version of the TCFv2 client-side library is 1.1.3 and the minimum version of the CCPA library is 1.0.44. If you are hosting the client-side library in your own CDN you will have to update the library version in order to benefit from these improvements.

Overview

Setting up Sourcepoint’s combined TCF v2 and CCPA 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 Javascript code-snippet along with version 2 of Sourcepoint's GDPR solution. The JS 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 CCPA and syndicate the user's privacy settings to any relevant third party technology running on your site along with a GDPR message when appropriate. The Sourcepoint script implementation has been optimized for high performance and fast delivery.

The implementation can be divided into two separate steps:

  1. Implementing the Sourcepoint GDPR & CCPA page configuration.

  2. Setting up the message domain.

1. Implementing the Sourcepoint GDPR & CCPA page configuration.

Below is Sourcepoint’s GDPR & CCPA Javascript code-snippet which needs to be placed at the top (preferably in the header of your page before other ad-tech related tags such as a header bidding tag).

<script type="text/javascript">
//GDPR Stub file
(function () { var e = false; var c = window; var t = document; function r() { if (!c.frames["__cmpLocator"]) { if (t.body) { var a = t.body; var e = t.createElement("iframe"); e.style.cssText = "display:none"; e.name = "__cmpLocator"; a.appendChild(e) } else { setTimeout(r, 5) } } } r(); function p() { var a = arguments; __cmp.a = __cmp.a || []; if (!a.length) { return __cmp.a } else if (a[0] === "ping") { a[2]({ gdprAppliesGlobally: e, cmpLoaded: false }, true) } else { __cmp.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.__cmp(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 __cmp !== "function") { c.__cmp = p; __cmp.msgHandler = l; c.addEventListener("message", l, false) } })();
</script>
<script type="text/javascript">
//CCPA Stub file
(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',
}
}
window._sp_ccpa = {
config: {
accountId: ACCOUNT_ID,
baseEndpoint: "https://cdn.privacy-mgmt.com",
getDnsMsgMms: true,
alwaysDisplayDns: false
}
}
</script>
<script src="https://cdn.privacy-mgmt.com/wrapperMessagingWithoutDetection.js"></script>
<script src="https://cdn.privacy-mgmt.com/ccpa.js"></script>

1. The first section of the snipped contains the IAB Stub functions. The Stub functions set up the IAB US Privacy String object “__uspapi” and the __tcfapi. This 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.

2. 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 combined GDPR and CCPA implementations. there are currently five required params to deliver a message successfully:

a. 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 the your account in the Sourcepoint dashboard.

b. baseEndpoint - "https://cdn.privacy-mgmt.com" is a single server endpoint from where the messaging as well as the GDPR or CCPA experiences are 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! More information can be found in our documentation on setting up a subdomain with a CNAME DNS Record.

c. 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 uses cases in where a CCPA Do Not Sell (my data) notification is shown on the website without creating a campaign in the Sourcepoint dashboard.

d. alwaysDisplayDns - Setting this parameter to true enables use cases where a Sourcepoint Do Not Sell (my data) notification is hardcoded.

Other optional params:

propertyHref – maps the message to a specific URL

siteId – maps the message to a specific property (website, app, OTT)

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
}

Previous versions of this documentation included the mmsDomain and ccpaOrigin configuration parameters have been replaced by the new baseEndpoint parameter for optimization reasons. This change is completely backwards compatible. However, it is recommended that older implementations move to the new parameter to benefit from the optimizations.

2. 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 CCPA Javascript library to communicate with the Sourcepoint messaging server in a first-party capacity. The benefit of this approach is to allow Sourcepoint cookies to be “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. For instructions on creating a first-party subdomain and the adding a CNAME record to point to the Sourcepoint servers, please read the documentation on setting up a subdomain with a CNAME DNS Record.