Key-Value Pairs Targeting in TCF Version 2.0

Overview

The Sourcepoint Dialogue platform allows you to add additional targeting through the use of key-value pairs. The key-value pairs are added to the on-page configuration code using the targetingParams parameter. You can then add a targeting condition in the scenario for a campaign. Multiple key-value pairs can be added per messaging call.

The example code below passes a key-value pair of color=red to the Sourcepoint platform by setting the key-value pair up within the targetingParams parameter. The value set can be a string, boolean or integer value. JavaScript variables that evaluate to either strings, boolean values or integers can be passed.

Key-Value Pair Code Example:

<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>
window._sp_ = {
config: {
accountId: 22,
baseEndpoint: 'https://cdn-000.privacy-mgmt.com',
targetingParams:{
color: "red"
}
}
}
</script>
<script src="https://cdn-000.privacy-mgmt.com/wrapperMessagingWithoutDetection.js"></script>
‚Äč

Key-Value Pair User Interface Setup Example

To leverage this data, there a corresponding step in the Dialogue user interface that would perform (or not perform) an action based on the value portion of the key-value pair being sent. In the example screenshot below, the scenario is setup to show a message only if there is value of blue being sent for the color_preference key.