Using Offer Decisioning with the Platform Web SDK
Adobe Experience Platform Web SDK can deliver and render personalized offers that are managed in Offer Decisioning. You can create your offers and other related objects using the Offer Decisioning user interface (UI) or APIs.
Prerequisites
- Organization is enabled for edge decisioning
- Offers, Activities created
- Datastream is published
Terminology
It is important to understand the following terminology when working with Offer Decisioning. For more information and to view additional terms, please visit the Offer Decisioning glossary.
-
Container: A container is an isolation mechanism to keep different concerns apart. The container ID is the first path element for all repository APIs. All decisioning objects reside within a container.
-
Decision Scopes: For Offer Decisioning, decision scopes are the Base64 encoded strings of JSON containing the activity and placement IDs you want the offer decisioning service to use to propose offers.
Decision scope JSON:
code language-json { "activityId":"xcore:offer-activity:11cfb1fa93381aca", "placementId":"xcore:offer-placement:1175009612b0100c" }
Decision scope Base64 encoded string:
code language-json "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ=="
note tip TIP You can copy the decision scope value from the Activity Overview page in the UI. -
Datastreams: For more information, please read the datastreams documentation.
-
Identity: For more information, please read this documentation outlining how Platform Web SDK uses Identity Service.
Enabling Offer Decisioning
To enable Offer Decisioning, perform the following steps:
-
Enabled Adobe Experience Platform in your datastream and check the “Offer Decisioning” box
-
Follow the instructions to install the SDK (The SDK can be installed standalone or through the UI. See the tags quick start guide) for more information.
-
Configure the SDK for Offer Decisioning. Additional Offer Decisioning specific steps are provided below.
-
Install the standalone SDK
-
Configure the “sendEvent” action with your
decisionScopes
code language-javascript alloy("sendEvent", { ... "decisionScopes": [ "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTIxYWIwOWMxM2JkZDIyNCIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjEyMWFiMDZhODRkMDViMTEifQ==", "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTIxYWIyNWI5NTUwNWIxZiIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjEyMWFiMjFmOTQzMDE0MmIifQ==" ] })
-
-
Install the SDK through tags
-
Install and configure the Platform Web SDK extension with the Datastream you created by selecting the configuration from the “Datastream” dropdown. See the documentation on extensions.
-
Create the necessary Data Elements. At the bare minimum, you must create a Platform Web SDK Identity Map and a Platform Web SDK XDM Object data element.
-
Create your Rules.
-
Add a Platform Web SDK Send Event action and add the relevant
decisionScopes
to that action’s configuration
-
-
Create and publish a library containing all the relevant Rules, Data Elements, and Extensions you have configured
-
Sample requests and responses
One decisionScopes
value
Request
{
"events": [
{
"xdm": {
"identityMap": {
"ECID": [
{
"id": "91133425615229052182584359620783097099"
}
]
}
},
"query": {
"personalization": {
"decisionScopes": [
"eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ=="
]
}
}
}
]
}
identityMap
{ "identityMap": { "ECID": [ { "id": "91133425615229052182584359620783097099" } ] } }
.Note: Users don’t need to include the
ECID
parameter in the API call. This parameter is automatically added to the call if needed.decisionScopes
decisionScopes
per request."decisionScopes": ["eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ=="]
Response
{
"requestId": "94c4f2f1-9218-43ce-afd3-eb0d853c5174",
"handle": [
{
"payload": [
{
"id": "2862bb89-5df2-4bc6-85c2-d8f7e1a091de",
"scope": "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ==",
"activity": {
"id": "xcore:offer-activity:11cfb1fa93381aca",
"etag": "2"
},
"placement": {
"id": "xcore:offer-placement:1175009612b0100c",
"etag": "1"
},
"items": [
{
"id": "xcore:personalized-offer:124cc332095cfa74",
"schema": "https://ns.adobe.com/experience/offer-management/content-component-html",
"etag": "1",
"data": {
"id": "xcore:personalized-offer:124cc332095cfa74",
"format": "text/html",
"language": [
"en-US"
],
"content": "<p>20% Off on shipping</p>",
"characteristics": {
"foo": "bar",
"foo1": "bar1"
}
}
}
]
}
],
"type": "personalization:decisions",
"eventIndex": 0
}
]
}
scope
"scope": "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ=="
activity.id
"id": "xcore:offer-activity:11cfb1fa93381aca"
placement.id
"id": "xcore:offer-placement:1175009612b0100c"
items.id
"id": "xcore:personalized-offer:124cc332095cfa74"
schema
"schema": "https://ns.adobe.com/experience/offer-management/content-component-html"
data.id
"id": "xcore:personalized-offer:124cc332095cfa74"
format
"format": "text/html"
language
"language": [ "en-US" ]
content
"content": "<p style="color:red;">20% Off on shipping</p>"
deliveryUrl
"deliveryURL": "https://image.jpeg"
characteristics
"characteristics": { "foo": "bar", "foo1": "bar1" }
Multiple decisionScopes
values
Request
{
"events": [
{
"xdm": {
"identityMap": {
"ECID": [
{
"id": "91133425615229052182584359620783097099"
}
]
}
},
"query": {
"personalization": {
"decisionScopes": [
"eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ==",
"eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTIyMjA4YjNhODc0MDU1OCIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjEyMjIwNDUyOTUxNGEyYzAifQ==",
"eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTIyYzkxMzg1Mjc2MDE4YyIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjEyMzMxZjU2MTYyYWEyZjcifQ=="
]
}
}
}
]
}
identityMap
{ "identityMap": { "ECID": [ { "id": "91133425615229052182584359620783097099" } ] } }
.Note: Users don’t need to include the
ECID
parameter in the API call. This parameter is automatically added to the call if needed.decisionScopes
decisionScopes
per request."decisionScopes":["eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ==", "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTIyMjA4YjNhODc0MDU1OCIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjEyMjIwNDUyOTUxNGEyYzAifQ=="
Response
{
"requestId": "94c4f2f1-9218-43ce-afd3-eb0d853c5174",
"handle": [
{
"payload": [
{
"id": "a2804dfb-a0ec-4df9-8311-59d3ecdeb642",
"scope": "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MTEyMyIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDExMjMifQ==",
"activity": {
"id": "xcore:offer-activity:11cfb1fa93381123",
"etag": "1"
},
"placement": {
"id": "xcore:offer-placement:1175009612b01123",
"etag": "3"
},
"items": [
{
"id": "xcore:personalized-offer:11e36d4a22954123",
"schema": "https://ns.adobe.com/experience/offer-management/content-component-text",
"etag": "2",
"data": {
"id": "xcore:personalized-offer:11e36d4a22954123",
"format": "text/text",
"language": [
"en"
],
"content": "20% Off on shipping",
"characteristics": {
"foo2": "bar2"
}
}
}
]
},
{
"id": "a2804dfb-a0ec-4df9-8311-59d3ecdeb642",
"scope": "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ==",
"activity": {
"id": "xcore:offer-activity:11cfb1fa93381aca",
"etag": "2"
},
"placement": {
"id": "xcore:offer-placement:1175009612b0100c",
"etag": "1"
},
"items": [
{
"id": "xcore:personalized-offer:11e36d4a2295415d",
"schema": "https://ns.adobe.com/experience/offer-management/content-component-imagelink",
"etag": "1",
"data": {
"id": "xcore:personalized-offer:11e36d4a2295415d",
"format": "image/png",
"language": [
"en"
],
"deliveryURL": "https://image.jpeg",
"characteristics": {
"foo": "bar",
"foo1": "bar1"
}
}
}
]
}
],
"type": "personalization:decisions",
"eventIndex": 0
}
]
}
scope
"scope": "eyJhY3Rpdml0eUlkIjoieGNvcmU6b2ZmZXItYWN0aXZpdHk6MTFjZmIxZmE5MzM4MWFjYSIsInBsYWNlbWVudElkIjoieGNvcmU6b2ZmZXItcGxhY2VtZW50OjExNzUwMDk2MTJiMDEwMGMifQ=="
activity.id
"id": "xcore:offer-activity:11cfb1fa93381123"
placement.id
"xcore:offer-placement:1175009612b01123"
items.id
"id": "xcore:personalized-offer:11e36d4a22954123"
schema
"schema": "https://ns.adobe.com/experience/offer-management/content-component-text"
data.id
"id": "xcore:personalized-offer:11e36d4a22954123"
format
"format": "text/text"
language
"language": [ "en-US" ]
content
"content": "<p style="color:red;">20% Off on shipping</p>"
deliveryUrl
"deliveryURL": "https://image.jpeg"
characteristics
"characteristics": { "foo": "bar", "foo1": "bar1" }
Limitations
Some offer constraints are currently not supported with the mobile Edge Network workflows, for example Capping. The Capping field value specifies the number of times an offer can be presented across all users. For more details, see Offer eligibility rules and constraints documentation.