Create JSON offers create-json-offers

On this page: Learn how to create JSON offers in Adobe Target and how to retrieve their content in a page or an application.

JSON offers are created in the Offer Library of Adobe Target for use in the Form-Based Experience Composer. In form-based activities, they support use cases where Target decisioning must send an offer in JSON format, for consumption in an SPA framework or in server-side integrations.

JSON considerations

The following information applies to JSON offers:

  • JSON offers are currently available only for A/B Test, Automated Personalization (AP), and Experience Targeting (XT) activities.
  • JSON offers can be used only in form-based activities.
  • JSON offers can be retrieved directly with the Server Side APIs and the Mobile Node.js, Java, .NET, and Python SDKs.
  • In the browser, JSON offers can be retrieved only with at.js 1.2.3 or later, through getOffer(), by filtering the actions on the setJson action.
  • JSON offers are delivered as native JSON objects rather than as strings. Consumers of these objects no longer need to handle them as strings and convert them to JSON objects.
  • Unlike other offers, such as HTML offers, JSON offers are not applied automatically, because they are non-visual. Developers must write code that explicitly gets the offer with getOffer().

Create a JSON offer section_BB9C72D59DEA4EFB97A906AE7569AD7A

A JSON offer holds the JSON content that Target decisioning sends to an SPA framework or to a server-side integration.

  1. Click Offers > Code Offers.

  2. Click Create Offer > JSON Offer.

    Change Redirect Offer dialog with one redirect offer selected and the Add button

  3. Enter a name for the offer.

  4. (Conditional) For a Target Premium account, select the workspace.

  5. (Conditional) Select the profile attributes.

    Real-Time CDP profile attributes can be shared with Target for use in HTML and JSON offers. See Share Real-Time CDP Profile Attributes with Target.

  6. Type or paste the JSON code in the Code box.

    Create JSON Offer dialog with the Name and Workspace fields, the Profile Attributes list with the Adobe Experience Platform and Adobe Target folders, and the Code box

  7. Click Create.

To display only JSON offers in the Offers library, click the Show filters icon ( Show Filters icon ), then select the JSON Offers check box.

Structure of the actions array section_A54F7BB2B55D4B7ABCD5002E0C72D8C9

JSON offers are supported only in activities created with the Form-Based Experience Composer. Currently, JSON offers can be used only through direct API or SDK calls.

The actions passed to the success callback are an array of objects. For example, a single JSON offer can have the following content:

{
  "demo": {"a": 1, "b": 2}
}

The actions array then has the following structure:

[
 {
   action: "setJson",
   content: [{
     "demo": {"a": 1, "b": 2}
   }]
 }
]

To extract the JSON offer, iterate through the actions, find the action with the setJson action, then iterate through the content array.

Example: access an attribute section_85B07907B51A43239C8E3498EF58B1E5

In this example, the following JSON offer is delivered to a 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 accesses 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);
  }
});
AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: JSON offers are created in the Offer Library in Adobe Target for use in the Form-Based Experience Composer, and developers must write code to get them, for example with getOffer().

Intents:

  • Create a JSON offer in the Offer Library.
  • Use a JSON offer in a form-based activity when Target decisioning is required to send an offer in JSON format for consumption in SPA framework or server-side integrations.
  • Retrieve a JSON offer in the browser with getOffer() by filtering actions using the setJson action.
  • Extract a JSON offer from the actions array passed to the success callback.
  • Filter the Offers library by the JSON offer type.

Glossary:

  • JSON offer (product-specific): an offer in JSON format that is delivered as a native JSON object rather than as a string. It is a non-visual offer.
  • Offer Library (product-specific): where JSON offers are created in Adobe Target.
  • Form-Based Experience Composer (product-specific): the composer for which JSON offers are created; JSON offers are supported only in activities created with it.
  • setJson action (product-specific): the action in the actions array whose content array holds the JSON offer.

Guardrails:

  • In the browser, JSON offers can be retrieved only via at.js 1.2.3 (or later) and using getOffer() by filtering actions using the setJson action.
  • JSON offers can be retrieved directly when you are using the Server Side APIs and Mobile Node.js, Java, .NET, and Python SDKs.
  • JSON offers are not applied automatically, as opposed to other offers (such as HTML offers), because JSON offers are non-visual offers. Developers must write code to explicitly get the offer using getOffer().

Applicability:

  • Applies: A/B Test, Automated Personalization (AP), and Experience Targeting (XT) activities. JSON offers are currently available only for these activity types.
  • Applies: form-based activities only.

Terminology:

  • Canonical name: JSON offer.
  • Acronym: AP (Automated Personalization)
  • Acronym: XT (Experience Targeting)

FAQ:

  • Which activities can use JSON offers? JSON offers are currently available only for A/B Test, Automated Personalization (AP), and Experience Targeting (XT) activities, and can be used in form-based activities only.
  • Are JSON offers applied automatically like HTML offers? No. JSON offers are not applied automatically because they are non-visual offers, so developers must write code to explicitly get the offer using getOffer().
  • How can a JSON offer be retrieved in the browser? In the browser, JSON offers can be retrieved only via at.js 1.2.3 (or later) and using getOffer() by filtering actions using the setJson action.
  • How is a JSON offer delivered? JSON offers are delivered as native JSON objects rather than as strings, so consumers of these objects are no longer required to handle objects as strings and convert them to JSON objects.
  • How do I extract a JSON offer from the actions array? Iterate through actions, find the action with the setJson action, and then iterate through the content array.
  • How do I filter the Offers library by the JSON offer type? Click the Show filters icon, then select the JSON Offers checkbox.

Examples:

  • Actions array structure for a single JSON offer with the content { "demo": {"a": 1, "b": 2} }: the array holds one object with the action setJson and a content array that contains the offer. It illustrates the actions passed to the success callback.
  • Accessing the “greeting” attribute of a delivered JSON offer: adobe.target.getOffer() is called with mbox, params, success and error, and the success function reads offer[0].content[0].greeting. It shows how to access the “greeting” attribute.

Related pages:

  • Composer in which form-based activities are created: Form-Based Experience Composer (c-experiences/form-experience-composer.md)
  • If you have a Target Premium account, choose the desired workspace: workspace (administrating-target/c-user-management/property-channel/property-channel.md)
  • Real-time CDP Profile Attributes can be shared with Target for use in HTML and JSON offers: Share Real-time CDP Profile Attributes with Target (c-integrating-target-with-mac/integrating-with-rtcdp.md)

Personas:

  • marketer: Can filter the Offers library by the JSON offer type by selecting the Show filters icon, then the JSON Offers checkbox. The page states that JSON offers are currently available only for A/B Test, Automated Personalization (AP) and Experience Targeting (XT) activities. The page states that JSON offers can be used in form-based activities only. Where: “FAQ”.
  • developer: Can retrieve a JSON offer in the browser only via at.js 1.2.3 (or later), using getOffer() and filtering actions with the setJson action. Can extract the offer by iterating through actions, finding the action with setJson, and iterating through the content array. The page states that JSON offers are not applied automatically, so developers must write code to explicitly get the offer using getOffer(). Where: “FAQ”.

Onboarding:

  • Level: Experienced
  • First minimal step: Select Offers, then Code Offers, then select Create Offer and JSON Offer.
  • Next: Share Real-time CDP Profile Attributes with Target for use in HTML and JSON offers: Share Real-time CDP Profile Attributes with Target (c-integrating-target-with-mac/integrating-with-rtcdp.md)
recommendation-more-help
target-help-main