Permission: Campaign entities
The French DPA introduced new GDPR guidelines (October 2020) for publishers that need to be complied with by April 2021. These guidelines state that publishers should allow end-users to reject all consent purposes as easily as it enables them to accept all consent purposes.
In order to comply with these guidelines, many publishers offer a button on their GDPR first layer message that enables end-users to reject all purposes whose legal basis is user consent while allowing purposes whose legal basis is legitimate interest.
- Create "continue without agreeing" button on GDPR first layer message
- Create key-value pair targeting in scenario
- Configure implementation code on property
- Full examples
Create "continue without agreeing" button on GDPR first layer message
Note: Before continuing, please contact your Sourcepoint Account Manager to enable custom choice options on your organization's account.
Navigate to a GDPR first layer message (either GDPR TCF or GDPR Standard) on the property and add a button component to the message with the appropriate labeling, style, etc...
While focused on the newly created button, expand the Action accordion and select Custom Javascript from the Choice Option dropdown menu.
Input the following JavaScript in the provided field to output a message (e.g. dismissed) to the web console whenever the button is selected.
console.log('dismissed');
Click Save Message when finished.
Create key-value pair targeting in scenario
With the custom JavaScript added to your "continue without agreeing" button, navigate to the scenario builder on the same property.
Configure the following key-value pair targeting step for the scenario with the following events:
- Condition: Consent Status (GDPR) No Action
- Condition: Key Value Pair Targeting Key:cookiew | Value: dismissed | Match: No
- Message: Show Message Always GDPR TCF v2 First Layer Message
Note: The above key-value pair targeting step is in addition to any other targeting logic you have configured in your scenario.
Additionally, be mindful of the key and value defined in your scenario step. If you elect to edit either from what is defined in the example, you will also need to update the implementation code on the property.
Click Save when finished and continue subsequent steps to launch your GDPR TCF messaging campaign.
Configure implementation code on property
In this section, we will cover the necessary configurations that must be included in the property's implementation code. Sourcepoint's solution for the "continue without agreeing" button utilizes a cookie that is set whenever the appropriate events are satisifed.
Note: For your convenience we have included full examples of the following configurations for our unified and legacy scripts.
Read and split cookie function
Add the following function to the implementation code to the property. This function reads, and splits the name/value from the cookie that is set whenever an end-user selects your organization's "continue without agreeing" button.
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
Client parameters
The following parameters should be set in the client configuration script:
Parameter | Value | Purpose |
isSPA |
true |
Necessary for the customizations made to the event callbacks since the solution requires a way for the Sourcepoint script to refresh itself. Note: In addition to setting the |
targetingParam |
"cookiew": getCookie("cw") |
Pass the key-value pair to Sourcepoint so decisions can be made following the logic of the scenario step. |
/* Example using unified script */
window._sp_queue = [];
window._sp_ = {
config: {
accountId: 12324,
baseEndpoint: 'https://cdn.privacy-mgmt.com',
isSPA: true,
gdpr: {
targetingParams: {
"cookiew": getCookie("cw")
},
},
Event callback configurations
The following event callbacks should be edited to set a cookie when certain conditions are satisfied
- onMessageChoiceSelect
- onPrivacyManagerAction
Note: Your organization is responsible for setting the duration of the cookie.
choice_type_id == 9
is returned in the callback.choice_type_id == 9
is tied to buttons whose action is a custom JavaScript (e.g. the "continue without agreeing" button configured in this article).
if (choice_type_id == 9){
document.cookie = "cw=dismissed; expires=Thu, 18 Dec 2030 12:00:00 UTC";
}
purposeConsent
and vendorConsent
returns a "none"
value in the callback.
if(pmData.purposeConsent == "none" && pmData.vendorConsent == "none") {
document.cookie = "cw=dismissed; expires=Thu, 18 Dec 2030 12:00:00 UTC";
}
Full examples
<head>
<script>
!function(t){var e={};function n(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,n),o.l=!0,o.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)n.d(r,o,function(e){return t[e]}.bind(null,o));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=3)}([function(t,e,n){var r=n(2);t.exports=!r((function(){return 7!=Object.defineProperty({},"a",{get:function(){return 7}}).a}))},function(t,e){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},function(t,e){t.exports=function(t){try{return!!t()}catch(t){return!0}}},function(t,e,n){n(4),function(){if("function"!=typeof window.__tcfapi){var t,e=[],n=window,r=n.document;!n.__tcfapi&&function t(){var e=!!n.frames.__tcfapiLocator;if(!e)if(r.body){var o=r.createElement("iframe");o.style.cssText="display:none",o.name="__tcfapiLocator",r.body.appendChild(o)}else setTimeout(t,5);return!e}()&&(n.__tcfapi=function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];if(!r.length)return e;if("setGdprApplies"===r[0])r.length>3&&2===parseInt(r[1],10)&&"boolean"==typeof r[3]&&(t=r[3],"function"==typeof r[2]&&r[2]("set",!0));else if("ping"===r[0]){var i={gdprApplies:t,cmpLoaded:!1,apiVersion:"2.0"};"function"==typeof r[2]&&r[2](i,!0)}else e.push(r)},n.addEventListener("message",(function(t){var e="string"==typeof t.data,r={};try{r=e?JSON.parse(t.data):t.data}catch(t){}var o=r.__tcfapiCall;o&&n.__tcfapi(o.command,o.parameter,o.version,(function(n,r){var i={__tcfapiReturn:{returnValue:n,success:r,callId:o.callId}};e&&(i=JSON.stringify(i)),t.source.postMessage(i,"*")}))}),!1))}}()},function(t,e,n){var r=n(0),o=n(5).f,i=Function.prototype,c=i.toString,u=/^s*function ([^ (]*)/;r&&!("name"in i)&&o(i,"name",{configurable:!0,get:function(){try{return c.call(this).match(u)[1]}catch(t){return""}}})},function(t,e,n){var r=n(0),o=n(6),i=n(10),c=n(11),u=Object.defineProperty;e.f=r?u:function(t,e,n){if(i(t),e=c(e,!0),i(n),o)try{return u(t,e,n)}catch(t){}if("get"in n||"set"in n)throw TypeError("Accessors not supported");return"value"in n&&(t[e]=n.value),t}},function(t,e,n){var r=n(0),o=n(2),i=n(7);t.exports=!r&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},function(t,e,n){var r=n(8),o=n(1),i=r.document,c=o(i)&&o(i.createElement);t.exports=function(t){return c?i.createElement(t):{}}},function(t,e,n){(function(e){var n=function(t){return t&&t.Math==Math&&t};t.exports=n("object"==typeof globalThis&&globalThis)||n("object"==typeof window&&window)||n("object"==typeof self&&self)||n("object"==typeof e&&e)||Function("return this")()}).call(this,n(9))},function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},function(t,e,n){var r=n(1);t.exports=function(t){if(!r(t))throw TypeError(String(t)+" is not an object");return t}},function(t,e,n){var r=n(1);t.exports=function(t,e){if(!r(t))return t;var n,o;if(e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;if("function"==typeof(n=t.valueOf)&&!r(o=n.call(t)))return o;if(!e&&"function"==typeof(n=t.toString)&&!r(o=n.call(t)))return o;throw TypeError("Can't convert object to primitive value")}}]);
</script>
<script>
x = 1;
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
window._sp_queue = [];
window._sp_ = {
config: {
accountId: 12324,
baseEndpoint: 'https://cdn.privacy-mgmt.com',
isSPA: true,
gdpr: {
targetingParams: {
"cookiew": getCookie("cw")
},
},
propertyHref: 'https://YOUR_PROPERTY_URL.com',
events: {
onMessageReady: function (message_type) {
console.log('onMessageReady', message_type)
},
onMessageChoiceSelect: function (message_type, choice_id, choice_type_id) {
console.log('onMessageChoiceSelect message_type: ', message_type);
console.log('onMessageChoiceSelect choice_id: ', choice_id);
console.log('onMessageChoiceSelect choice_type_id: ', choice_type_id);
if (choice_type_id == 9){
document.cookie = "cw=dismissed; expires=Thu, 18 Dec 2030 12:00:00 UTC";
}
},
onPrivacyManagerAction: function (message_type, pmData) {
console.log('onPrivacyManagerAction message_type:', message_type);
console.log('onPrivacyManagerAction', pmData)
if(pmData.purposeConsent == "none" && pmData.vendorConsent == "none") {
document.cookie = "cw=dismissed; expires=Thu, 18 Dec 2030 12:00:00 UTC";
}
},
onMessageChoiceError: function (message_type, err) {
console.log('onMessageChoiceError', message_type);
console.log('onMessageChoiceError', err)
},
onConsentReady: function (message_type, consentUUID, euconsent) {
console.log('onConsentReady', message_type);
console.log('consentUUID', consentUUID)
console.log('euconsent', euconsent)
},
onPMCancel: function (message_type) {
console.log('onPMCancel', message_type)
},
onMessageReceiveData: function (message_type, data) {
console.log('onMessageReceiveData', message_type);
console.log('onMessageReceiveData', data)
console.log(JSON.stringify(data));
},
onSPPMObjectReady: function () {
console.log('onSPPMObjectReady')
},
onError: function (message_type, errorCode, errorObject, userReset){
console.log('errorCode: ', message_type);
console.log('errorCode: ' + errorCode);
console.log(errorObject);
console.log('userReset: ' + userReset);
},
}
}
}
function showMessage(){
window._sp_.executeMessaging();
}
</script>
<script src="https://cdn.privacy-mgmt.com/unified/wrapperMessagingWithoutDetection.js" async></script>
</head>
<body onload="showMessage()">
<head>
<script type="text/javascript">
!function () { var e = function () { var e, t = "__tcfapiLocator", a = [], n = window; for (; n;) { try { if (n.frames[t]) { e = n; break } } catch (e) { } if (n === window.top) break; n = n.parent } e || (!function e() { var a = n.document, r = !!n.frames[t]; if (!r) if (a.body) { var i = a.createElement("iframe"); i.style.cssText = "display:none", i.name = t, a.body.appendChild(i) } else setTimeout(e, 5); return !r }(), n.__tcfapi = function () { for (var e, t = arguments.length, n = new Array(t), r = 0; r < t; r++)n[r] = arguments[r]; if (!n.length) return a; if ("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)); else if ("ping" === n[0]) { var i = { gdprApplies: e, cmpLoaded: !1, cmpStatus: "stub" }; "function" == typeof n[2] && n[2](i) } else a.push(n) }, n.addEventListener("message", (function (e) { var t = "string" == typeof e.data, a = {}; try { a = t ? JSON.parse(e.data) : e.data } catch (e) { } var n = a.__tcfapiCall; n && window.__tcfapi(n.command, n.version, (function (a, r) { var i = { __tcfapiReturn: { returnValue: a, success: r, callId: n.callId } }; t && (i = JSON.stringify(i)), e.source.postMessage(i, "*") }), n.parameter) }), !1)) }; "undefined" != typeof module ? module.exports = e : e() }();
</script>
<script>
x = 1;
function getCookie(name) {
const value = `; ${document.cookie}`;
const parts = value.split(`; ${name}=`);
if (parts.length === 2) return parts.pop().split(';').shift();
}
window._sp_ = {
config: {
accountId: 1234,
propertyHref: 'https://YOUR_COMPANY_PROPERTY.com',
baseEndpoint: 'https://cdn.privacy-mgmt.com',
targetingParams: {
"cookiew": getCookie("cw")
},
isSPA : true,
events: {
onMessageReady: function () {
console.log('onMessageReady')
},
onMessageChoiceSelect: function (choice_id, choice_type_id) {
console.log('onMessageChoiceSelect choice_id: ', choice_id);
console.log('onMessageChoiceSelect choice_id: ', choice_type_id);
if (choice_type_id == 9){
document.cookie = "cw=dismissed; expires=Thu, 18 Dec 2030 12:00:00 UTC";
}
},
onPrivacyManagerAction: function (pmData) {
console.log('onPrivacyManagerAction', pmData)
if(pmData.purposeConsent == "none" && pmData.vendorConsent == "none") {
document.cookie = "cw=dismissed; expires=Thu, 18 Dec 2030 12:00:00 UTC";
}
},
onMessageChoiceError: function (err) {
console.log('onMessageChoiceError', err)
},
onConsentReady: function (consentUUID, euconsent) {
console.log('onConsentReady')
console.log('consentUUID', consentUUID)
console.log('euconsent', euconsent)
},
onPMCancel: function () {
console.log('onPMCancel')
},
onMessageReceiveData: function (data) {
console.log('onMessageReceiveData', data)
console.log(JSON.stringify(data));
},
onSPPMObjectReady: function () {
console.log('onSPPMObjectReady')
}
}
}
}
function showMessage(){
window._sp_.executeMessaging();
}
</script>
<script src="https://cdn.privacy-mgmt.com/wrapperMessagingWithoutDetection.js">
</head>
<body onload="showMessage()">
Comments
0 comments