Key-Value Pair Targeting (Legacy)
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.
targetingParams can be added to the overall implementation code and/or per messaging campaign type in the implementation code. Please review our implementation documentation for more information.
In the example below we are passing the key-value pair of dark-mode: true for all campaigns run on the property 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.
1
//Example
2
window._sp_queue = [];
3
window._sp_ = {
4
config: {
5
accountId: 1111,
6
baseEndpoint: 'https://cdn.privacy-mgmt.com',
7
ccpa: { },
8
gdpr: { },
9
propertyHref: 'https://www.testdemo.com',
10
campaignEnv: 'stage',
11
isSPA: true,
12
targetingParams:{
13
darkmode: true
14
},
Copied!
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.

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.
Last modified 4mo ago