Requesting banner x ads

Requesting ads

Banner x ads are generated on /bannerx endpoint. All banner x requests require the contentStandardId and the bannerSlotIds you are requesting ads for. In addition, your banner call should have the context's customerId,sessionId,placement, and catalogId.

When requesting banner x ads, you're able to specify the maximum number of banners you would like to receive per banner slot. You can control this with the maxNumberOfAds parameter.

Search placements

Search placements are typically the easiest to request. They require a searchTerm to be specified in the request, like the example below:

POST $BASE_URL/v1/ads/bannerx HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "customerId": "wertg5432a",
    "sessionId": "ec9-4e07-881d-3e9", 
    "placement": "search",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "searchTerm": "chocolate",
    "options": {
                         "filterMode": "AndOr"
                             },
    "contentStandardId": "c61941e2-1435-460b-9d2b-5d838e3dba9c",
    "bannerSlotIds": [
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 1
    },
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 2
    }
  ]
}

Category placements

Category placements require productFilters to be specified in the request. The example below shows where you would send the category filters:

POST $BASE_URL/v1/ads/bannerx HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "customerId": "wertg5432a",
    "sessionId": "ec9-4e07-881d-3e9", 
    "placement": "category",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "productFilters": [
         ["category:Cupboard/Snacks"]
    ],
    "options": {
                             "filterMode": "AndOr"
                             },
    "contentStandardId": "fec2ab89-7a29-42b5-b58a-5675688b52d9",
    "bannerSlotIds": [
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 1
    },
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 2
    }
}

As additional categories are perused, you should update your API call accordingly.

Cross-sell category placements

Cross-sell category placements have a very similar request to category placements. You will want to specify the exact category you are requesting ads for. This is typically the page you are on. Specify the category in the productFilters of the request. The example below shows where you would send the category filters:

POST $BASE_URL/v1/ads/generate HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "customerId": "wertg5432a",
    "sessionId": "ec9-4e07-881d-3e9", 
    "placement": "category-cross-sell",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "productFilters": [
         ["category:Cupboard/Snacks"]
    ],
    "options": {
                             "filterMode": "AndOr"
                             },
    "contentStandardId": "fec2ab89-7a29-42b5-b58a-5675688b52d9",
    "bannerSlots": [
           {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 1
    },
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 2
    }
    ],            
    "maxNumberOfAds": 3
}

As additional categories are perused, you need to update your API call accordingly.

πŸ“˜

Merging organic and cross-sell category targeting?

If you're looking to merge an organic and cross-sell category ad request into a single placement, you will need to implement merging and delivery logic to your customers. This is the integator's responsibility, though CitrusAd are happy to be consulted.

In general, we advise that you show organic category ads, and position and category cross-sell advertisements after the organic placements.

Broad match placements

Broad placements such as home or checkout pages do not require any productFilters to be specified in the request. Any filters the retailer would like to specify (on offer, new, etc) can be specified in the productFilters to ensure CitrusAd only serve ads within the requirements, like the example below:

POST $BASE_URL/v1/ads/bannerx HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "customerId": "wertg5432a",
    "sessionId": "ec9-4e07-881d-3e9", 
    "placement": "home",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "productFilters": [
         []
    ],
    "options": {
                             "filterMode": "AndOr"
                             },
    "contentStandardId": "fec2ab89-7a29-42b5-b58a-5675688b52d9",
    "bannerSlotIds": [
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 1
    },
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 2
    }
}

Request enhancements

We advise you to consider the below enhancements to enhance your user experience.

Filtered searches

If your customer filters their search, you can extend your context to provide productFilters. Below is an example where the customer is filtering by the category "Cupboard" and the dietary restriction "Gluten-free". This same principle can be applied to any category or broad match placement.

POST $BASE_URL/v1/ads/bannerx HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "customerId": "wertg5432a",
    "sessionId": "ec9-4e07-881d-3e9", 
    "placement": "search",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "searchTerm": "chocolate",
    "productFilters": [
         ["category:Cupboard"],["dietary:Gluten-free"]
    ],
    "options": {
                             "filterMode": "AndOr"
                             },
    "contentStandardId": "fec2ab89-7a29-42b5-b58a-5675688b52d9",
    "bannerSlotIds": [
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 1
    },
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 2
    }
}

Filtering by location

If you are synchronising location filters in your catalog, you can extend your context to provide the customer's store location in the productFilters, like the example below:

POST $BASE_URL/v1/ads/bannerx HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic <API_KEY>
{
    "customerId": "wertg5432a",
    "sessionId": "ec9-4e07-881d-3e9", 
    "placement": "search",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "searchTerm": "chocolate",
    "productFilters": [
         ["category:Cupboard"],["dietary:Gluten-free"],["location:Westenbury"]
    ],
    "options": {
                             "filterMode": "AndOr"
                             },
    "contentStandardId": "fec2ab89-7a29-42b5-b58a-5675688b52d9",
    "bannerSlotIds": [
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 1
    },
    {
      "slotId": "<SLOT_ID>",
      "maxNumberOfAds": 2
    }
}

The banner x response

All responses follow the same JSON format. All content required to render the banner is provided in the response. If the banner does not have a component configured (such as no secondary hero image), CitrusAd will not serve the property.

{
    "ads": [
        {
            "contentStandardId": "c619d1e2-1435-460b-9d2b-5d838e3dba9c",
            "slotId": "<SLOT_ID>",
            "banners": [
                {
                    "citrusAdId": "shotgun__vW5pOojxDfN7T9VwaXWQLF2wKw3NzE0MTA3",
                    "citrusCampaignName": "CitrusAd-Example-Category-Banner-X-Ad-52793b405f1347b22e72a38c5a08699b",
                    "citrusContentStandardId": "c619d1e2-1435-460b-9d2b-5d838e3dba9c",
                    "citrusSlotId": "<SLOT_ID>",
                    "citrusExpiry": "2021-05-17T02:47:52.849995214Z",
                    "headingText": "Banner Advertisement for Magnum Double Ice Cream with a product image and shop now button",
                    "bannerText": "<strong>Magnum Double Ice Cream</strong>",
                    "bannerTextColour": "6e6c6c",
                    "ctaFlag": true,
                    "ctaText": "Shop now",
                    "ctaTextAccessibility": "for Magnum products",
                    "ctaLink": "https://www.tesco.com/groceries/en-GB/search?query=magnums",
                    "backgroundColour": "e1d6ac",
                    "heroImage": "https://cdn.flavedo.io/s/9b93e7f9-d747-4c8b-bcba-2357b280a3b3",
                    "heroImageAltText": "Magnums",
                    "tags": {},
                    "gtins": [
                        "7714107",
                        "7733636",
                        "7733657",
                        "7163379",
                        "7733628"
                    ],
                    "position": 1
                }
            ]
        },
        {
            "contentStandardId": "c619d1e2-1435-460b-9d2b-5d838e3dba9c",
            "slotId": "<SLOT_ID>",
            "banners": [
                {
                    "citrusAdId": "shotgun_kZp9yTCMm71vTo7iyQaK9I_YB09FUFYzNzBTQ0FO",
                    "citrusCampaignName": "milo-campaign-lakjsdf09kj",
                    "citrusContentStandardId": "21r372ba-dce6-46f2-bd16-1b923b9189f9",
                    "citrusSlotId": "<SLOT_ID>",
                    "citrusExpiry": "2021-05-17T02:47:52.849995214Z",
                    "headingText": "A banner for Milo with a product image and a shop now button",
                    "bannerText": "<strong>Try Milo Cereal</strong>",
                    "bannerTextColour": "48a94c",
                    "heroImage": "https://assets.imageurl.io/s/85d2d333-eed5-44d7-b131-8851d59f0574",
                    "heroImageAltText": "Milo product image",
                    "ctaFlag": true,
                    "ctaText": "Shop now",
                    "ctaTextAccessibility": "for Milo products",
                    "ctaLink": "retailer.com/everything/search/heritage%20mill?pageNumber=1",
                    "secondaryHeroImage": "https://assets.imageurl.io/s/85d2d333-eed5-44d7-b131-8m435c34r",
                    "secondaryHeroImageAltText": "Milo Logo",
                    "secondaryHeroMode": "landscape",
                    "backgroundColour": "895b5b",
                    "backgroundImage": "https://assets.flavedo.io/s/9c6fa248-c5ff-4341-9833-7e2b08464ada",
                    "backgroundImagePosition": "FILL",
                    "secondaryBackgroundImage": "https://assets.flavedo.io/s/9c6fa248-c5ff-4341-9833-7e2b08464ada",
                    "tags": {},
                    "gtins": [
                         "16309011",
                         "57312011",
                         "65250011"
                                ],
                    "position": 1
                }
            ]
        }
    ]
}

The id field is your Ad ID used in impression and click reports. Please refer to the reference for more information on each string.

πŸ“˜

If you’re unsure about the strings in this section, please visit the Banner ad reference page.