LogoLogo
  • Overview
  • What Ads Can Project Agora Commerce Serve?
  • Integration
    • API Introduction
    • Integration Workflow
      • Integration Summary
      • Integration Steps
    • Syncing Data
      • Syncing Data Via File Protocols
    • Syncing Catalog & Products
      • Syncing Catalog and Products Via File
    • Syncing Order Data
      • Syncing Order Data Via API
    • Reporting Clicks and Impressions
    • Integration Checklist
  • Integration Guides
    • HTTP Persistence & Ad Caching
    • Reference
    • Requesting Ads (the "Context" and its Parts)
    • Product Listing Ad Integration Guide
      • Requesting a Category Product Ad
      • Requesting a Search Term Product Ad
      • Requesting a Home Page Product Ad
    • Discovery Product Listing Ad Integration Guide
      • Requesting a Discovery Product Ad
    • Banner Ad Integration Guide
      • Banner Ad Content Standard
      • Requesting a Search Term Banner Ad
      • Requesting a Category Banner Ad
      • Requesting a Home Page Banner Ad
      • The Post Checkout Banner Ad Context
      • Graceful Fallback in the Event That No Ads Are Displayed
    • Banner X Ad Integration Guide
      • Banner X Ad Content Standard
      • Requesting a Category Banner X Ad
      • Requesting a Search Term Banner X Ad
      • Requesting a Home Page Banner X Ad
      • Banner X Ad Reference
      • Graceful Fallback in the Event That No Ads Are Displayed
Powered by GitBook
On this page
  • Context:
  • Exemplar Context
  • What Happens when an Ad Is Successfully Requested
  1. Integration Guides
  2. Product Listing Ad Integration Guide

Requesting a Home Page Product Ad

Home Page ads require a simple "context' to be sent to Project Agora Commerce. A "context" is a bit of code that defines the conditions under which a product is shown to a customer.

Context:

Below are the values needed to generate a home page ad:

POST $BASE_URL/v1/ads/generate HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic your_api_key_here
{
    "pageType": "Home",
    "catalogId": "$MY_CATALOG_ID",
    "productFilters": [["placement:SponsoredProducts"]],
    "maxNumberOfAds": number
}
curl -iX POST "$BASE_URL/v1/ads/generate" \ 
-H "accept: application/json" \
-H "content-type: application/json" \
-H "Authorization: Basic your_api_key_here" \
-d \
'{
    "pageType": "Home",
    "catalogId": "$MY_CATALOG_ID",
    "productFilters": [["placement:SponsoredProducts"]],
    "maxNumberOfAds": number
}'

Exemplar Context

Here is an example of a context for the pageType "Home":

POST $BASE_URL/v1/ads/generate HTTP/1.1
accept: application/json
content-type: application/json
Authorization: Basic 4ww25f70-b52s-40de-8f29-07b139b5cdc8
{
    "pageType": "Home",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "productFilters": [["placement:SponsoredProducts"]],
    "maxNumberOfAds": 3
}
curl -iX POST "$BASE_URL/v1/ads/generate" \ 
-H "accept: application/json" \
-H "content-type: application/json" \
-H "Authorization: Basic 4ww25f70-b52s-40de-8f29-07b139b5cdc8" \
-d \
'{
    "pageType": "Home",
    "catalogId": "628dbe95-2ec9-4e07-881d-3e9f92ab2e0b",
    "productFilters": [["placement:SponsoredProducts"]],
    "maxNumberOfAds": 3
}'

What Happens when an Ad Is Successfully Requested

When you successfully request an ad, you receive the following object:

HTTP/2 200
{
    "ads": [
        {
            "id": "display_SEY2W7-VZzspoirbw4ANs-r-w6YyODk5MDQ5UA==",
            "gtin": "catpref--2899049P",
            "discount": {
                "amount": 0,
                "minPrice": 0,
                "maxPerCustomer": 0
            },
            "expiry": "2019-12-10T01:46:07.516943179Z"
        },
        {
            "id": "display_-hPcUdg5KUQ2sxhE6r0XVN3-iLY5ODkxNTY2UA==",
            "gtin": "catpref--9891566P",
            "discount": {
                "amount": 0,
                "minPrice": 0,
                "maxPerCustomer": 0
            },
            "expiry": "2019-12-10T01:46:07.516948637Z"
        },
        {
            "id": "display_aGULlK-E_yEiVZ_S_jH9qsH-KhYyOTAyNjIwUA==",
            "gtin": "catpref--2902620P",
            "discount": {
                "amount": 0,
                "minPrice": 0,
                "maxPerCustomer": 0
            },
            "expiry": "2019-12-10T01:46:07.516953955Z"
        }
    ],
    "banners": [],
    "products": []
}
{
    "ads": [
        {
            "id": "display_SEY2W7-VZzspoirbw4ANs-r-w6YyODk5MDQ5UA==",
            "gtin": "catpref--2899049P",
            "discount": {
                "amount": 0,
                "minPrice": 0,
                "maxPerCustomer": 0
            },
            "expiry": "2019-12-10T01:46:07.516943179Z"
        },
        {
            "id": "display_-hPcUdg5KUQ2sxhE6r0XVN3-iLY5ODkxNTY2UA==",
            "gtin": "catpref--9891566P",
            "discount": {
                "amount": 0,
                "minPrice": 0,
                "maxPerCustomer": 0
            },
            "expiry": "2019-12-10T01:46:07.516948637Z"
        },
        {
            "id": "display_aGULlK-E_yEiVZ_S_jH9qsH-KhYyOTAyNjIwUA==",
            "gtin": "catpref--2902620P",
            "discount": {
                "amount": 0,
                "minPrice": 0,
                "maxPerCustomer": 0
            },
            "expiry": "2019-12-10T01:46:07.516953955Z"
        }
    ],
    "banners": [],
    "products": []
}

No customer information or cart items are necessary in this simple context. The simple context consists only of necessary filters.

The discount and products fields are legacy and can be ignored

The static filterplacement:SponsoredProducts should be included in all SPL requests

In gtin field of the above responses you will get the pa_id as in the product feed for the product to be displayed.

Reminder: the pa_id is the concatenation of the catalog prefix and each product SKU, so to identify which SKU to display on your side you may need to remove the catalog prefix and the symbols "--"

pa_id= catprefix--SKU

If you are unsure of the strings displayed on this page. Take a look at the Reference page.

PreviousRequesting a Search Term Product AdNextDiscovery Product Listing Ad Integration Guide

Last updated 4 years ago