Create a JSON offer
- Click Offers > Code Offers.
- Click Create Offer > JSON Offer.
- Type an offer name.
- (Conditional) If you have a Target Premium account, choose the desired workspace.
- (Conditional) Choose the desired profile attributes.
- Type or paste your JSON code in the Code box.
- Click Create.
JSON example
JSON offers are supported only in activities created using the Form-Based Experience Composer. Currently the only way to be able to use JSON offers is via direct API/SDK calls.
Here is an example:
The actions passed to success callback is an array of object. Assuming that you have a single JSON offer, that has this content:
{
"demo": {"a": 1, "b": 2}
}
The actions array has this structure:
[
{
action: "setJson",
content: [{
"demo": {"a": 1, "b": 2}
}]
}
]
To extract the JSON offer, you iterate through actions and find the action with the setJson
action, and then iterate through the content array.
Use case
Let’s say the following JSON offer gets delivered to your web page:
{
"_id": "5a65d24d8fafc966921e9169",
"index": 0,
"guid": "7c006504-c6f7-468d-a46f-f72531ea454c",
"isActive": true,
"balance": "$2,075.06",
"picture": "https://placehold.it/32x32",
"tags": [
"esse",
"commodo",
"excepteur"
],
"friends": [
{
"id": 0,
"name": "Carla Lyons"
},
{
"id": 1,
"name": "Ollie Mooney"
}
],
"greeting": "Hello, Stephenson Fernandez! You have 4 unread messages.",
"favoriteFruit": "strawberry"
}
The following code shows how to access the “greeting” attribute:
adobe.target.getOffer({
"mbox": "name_of_mbox",
"params": {},
"success": function(offer) {
console.log(offer[0].content[0].greeting);
},
"error": function(status, error) {
console.log('Error', status, error);
}
});
JSON offer example using Real-time CDP Profile Attributes
Real-time CDP Profile Attributes can be shared with Target for use in HTML and JSON offers.
For more information, see Share Real-time CDP Profile Attributes with Target.
Filtering offers by the JSON offer type
You can filter the Offers library by the JSON offer type by clicking the Show filters icon (
Adobe Target Maturity Webinar Series
Adobe Customer Success Webinars
Tuesday, Feb 4, 4:00 PM UTC
Adobe Target innovations, including GenAI, and best practices on AI-powered personalization and experimentation at scale.
Register