Key-Value Pair Targeting

Admin access or Domain access to property (property group) with feature access to message/scenario/partition set management.

Key-value pairs allow your organization to add customized targeting in your scenarios based on values you define and pass into the Sourcepoint platform. Using these values, your organization can then build messaging logic to serve different experiences to the end-user.

In this article, we will cover the two corresponding configurations needed to successfully utilize key-value pairing in your scenarios.

Insert targetingParams Parameter into Implementation Code

Key-value pairs must first be added to the on-page client configuration code snippet using the targetingParams parameter. Multiple key-value pairs can be added per messaging call.

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.

In the example(s) below we are passing the key-value pair of dark-mode: true into the Sourcepoint platform using the targetingParams parameter to identify users who have dark mode enabled on their web browser. In the configure key-value pair in scenario step, the true value will be used to drive a unique messaging experience for dark-mode users.

Please click the appropriate tab below to view and example of how to insert the above key-value pair into your implementation.

GDPR TCF v2
GDPR non-TCF
CCPA
GDPR TCF v2
<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: 12345,
baseEndpoint: 'https://cdn.privacy-mgmt.com',
targetingParams:{
dark-mode: true
}
}
}
</script>
<script src="https://cdn.privacy-mgmt.com/wrapperMessagingWithoutDetection.js"></script>
GDPR non-TCF
<script>
window._sp_ = {
config: {
accountId: 12345,
baseEndpoint: 'https://cdn.privacy-mgmt.com',
targetingParams:{
dark-mode: true
}
}
}
</script>
<script src="https://cdn.privacy-mgmt.com/messagingNoTcfApi.js" async></script>
CCPA
<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>
window._sp_ccpa = {
config: {
accountId: 12345,
baseEndpoint: "https://cdn.privacy-mgmt.com",
getDnsMsgMms: true,
alwaysDisplayDns: false
targetingParams:{
dark-mode: true
}
}
}
</script>
<script src="https://cdn.privacy-mgmt.com/ccpa.js"></script>

Configure Key-Value Pair in Scenario

To leverage the data being passed into the Sourcepoint platform, your organization will need to build out the messaging logic in the scenario builder based on the passed values.

As indicated above, our goal in this example is to deliver a unique messaging experience for dark-most users when the true value is passed.

From a new or existing step in a scenario, click + add an event.

Use the subsequent dropdown menu to select Condition > String Match.

Input the key, value, and additional information for the condition. Click Save when finished.

With the key-value pair configured in your scenario, use the scenario builder to create the messaging experience when the key-value pair is triggered. In our example, when the key-value pair dark-mode: true is triggered we will deliver our dark-mode message experience.