Note: By default, clients who implement after May 5th, 2021 will utilize the steps below to implement Sourcepoint's unified script. Organizations who implemented prior to this date and still have properties utilizing our legacy script should follow our migration guide to update those properties.

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


Retrieve implementation code snippet for property

With a web property created, click Properties on the left-hand panel and select Properties from the subsequent menu. 

Screen_Shot_2021-10-25_at_9.26.56_AM.png

Click <> inline with the property name.

Screen_Shot_2021-11-08_at_3.26.49_PM.png

Use the provided dropdown menu to select the messaging campaigns that will be implemented on the property. The implementation code snippet will automatically update as more messaging frameworks are added.

  Note: To implement a GDPR Standard campaign select GDPR Compliance from the dropdown menu and select the checkbox for GDPR Standard.

Screen_Shot_2022-02-01_at_3.48.37_PM.png

Copy the code from the generator and add to your property.


Implementation code snippet overview

In this section, we will cover the various elements that you may find in the implementation code snippet. A complete example can be found below and can be divided into three sections:

//Example only. Please use stub file generated in Sourcepoint portal as it may have changed.
<script>
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> (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> window._sp_queue = []; window._sp_ = { config: { accountId: 22, baseEndpoint: 'https://cdn.privacy-mgmt.com', ccpa: { }, gdpr: { } } } </script> <script src="https://cdn.privacy-mgmt.com/unified/wrapperMessagingWithoutDetection.js" async></script>

Stub file

  Note: Your implementation code snippet will include a stub file only if you are implementing either GDPR TCF and/or CCPA as one of the messaging campaigns used on the property.

The first part of the implementation code snippet contains the IAB stub functions. The stub functions set up the IAB privacy string object __uspapi and/or __tcfapi. This makes it available on queue to be called and released when needed. It is important to have these script tags in the first position to avoid errors and failure of service.

GDPR TCF stub file CCPA stub file
//Example only. Please use stub file generated in Sourcepoint portal as it may have changed.
<script>
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>

Client configuration script

The client configuration script contains your organization's specific account configuration parameters. This configuration includes the necessary and optional parameters for your property to communicate with the Sourcepoint messaging platform and consent service libraries.

Currently, there are two required parameters to successfully deliver an end-user notification:

  • accountId
  • baseEndpoint

In addition to the required parameters (above), your organization can implement additional parameters in the code snippet to allow for javascript callbacks that can be triggered for different customization purposes.

  Note: Follow the resources below for additional parameters your organization can utilize to customize your implementation:

Required Parameter Description
accountId The accountId value associates the property with your organization's Sourcepoint account. Your organization's accountId can be retrieved by contacting your Sourcepoint Account Manager or via the My Account page in your Sourcepoint account.
baseEndpoint

A single server endpoint that serves the messaging experience.

  Note: The baseEndpoint can also be changed to a CNAME first-party subdomain in order to persist first-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.

<script>
window._sp_queue = [];
window._sp_ = {
    config: {
        accountId: 12123,
        baseEndpoint: https://cdn.privacy-mgmt.com,
        ccpa: { },
        
        gdpr: { },

custom: { }, } } </script>

URL to messaging library

The final scripts are URL(s) that points to Sourcepoint's messaging libraries. The default URLs are as follows:

Campaign(s) Description
CCPA, GDPR TCF, GDPR Standard, Custom Messaging

https://cdn.privacy-mgmt.com/unified/wrapperMessagingWithoutDetection.js'

This script only needs to be included once regardless of how many different types of messaging campaigns you run on the property.

  Note: If your organization has edited the baseEndpoint with a CNAME DNS record you will also need to edit the URL. Please follow the following format if necessary:

https://cname.subdomain/unified/wrapperMessagingWithoutDetection.js

In the developer console, the URL to the messaging library can return the following regardless of whether a message was shown to the user:

Console Description
Messaging without detection successfully executed The script, messaging without detection, has successfully fired. It does not indicate that a message was shown to the end-user.
interaction complete The interaction with our, messaging without detection script, has concluded. It does not indicate that an end-user interacted with a message.  

Screen_Shot_2022-02-03_at_9_09_55_AM.jpg

Was this article helpful?
0 out of 0 found this helpful