Eligible forecast

Forecast a new ad ignoring the ads that are already running in your network

Eligibility Forecast

To forecast a new ad ignoring the ads that are already running in your network, you can use an eligible forecast. For an eligible forecast, you must supply an ad together with the end date and forecast type. The following is an example of an eligible forecast with an ad with no particular targeting criteria:

{
  "type": "eligible",
  "endDate": "2023-03-20",
  "ad": {
    "id": 1,
    "flight": {
      "id": 1,
      "goalType": 1,
      "goalAmount": 10000,
      "networkId": 12345,
      "priorityId": 1,
      "startDate": "2023-03-13T00:00:00",
      "priority": {
        "id": 1,
        "order": 5,
        "type": "lottery"
      }
    },
    "creative": {
      "id": 1,
      "adType": 1
    }
  },
  "params": {
    "sampling": 3
  }
}

The above forecast request should produce a result like the following:

{
  "resultStatus": "success",
  "result": {
    "total": {
      "impressions": 9772192,
      "uniqueUsers": 2665288
    }
  },
  "id": "86439249-4544-4ade-b48c-015a0ecede25",
  "status": "finished",
  "progress": 100.0,
  "desc": "Forecast is finished"
}

We understand a lot of the fields in the above payload are unnecessary. You shouldn’t need to set up IDs for entities that you’re planning. We’re working on improving the API to be more aligned with what you need to set up in the management API. For the time being, you need to define a flight id, network id, advertiser id and priority id, even though in most of the cases they’re not going to be used in a meaningful way.

With the above in place, we can start exploring our inventory and narrowing our ad. For example, we can run the same request but grouped by $site:

{
  "type": "eligible",
  "endDate": "2023-03-20",
  "ad": {
    "id": 1,
    "flight": {
      "id": 1,
      "goalType": 1,
      "goalAmount": 10000,
      "networkId": 11030,
      "advertiserId": 1,
      "priorityId": 1,
      "startDate": "2023-03-13T00:00:00",
      "priority": {
        "id": 1,
        "order": 5,
        "type": "lottery"
      }
    },
    "creative": {
      "id": 1,
      "adType": 1
    }
  },
  "params": {
    "sampling": 3,
    "groupBy": ["$site"]
  }
}

This should result in a list of impressions and unique users eligible per site:

{
  "resultStatus": "success",
  "result": {
    "total": {
      "impressions": 9772192,
      "uniqueUsers": 2665288
    },
    "grouped": [
      {
        "key": {
          "$site": 1234567
        },
        "value": {
          "impressions": 6976,
          "uniqueUsers": 1456
        }
      },
      {
        "key": {
          "$site": 1234568
        },
        "value": {
          "impressions": 221696,
          "uniqueUsers": 92184
        }
      },
      {
        "key": {
          "$site": 1234569
        },
        "value": {
          "impressions": 7192,
          "uniqueUsers": 2456
        }
      },
      (...)
  },
  "id": "5cd77b8e-4271-4f68-8914-f23104cfd907",
  "status": "finished",
  "progress": 100.0,
  "desc": "Forecast is finished"
}

We can narrow our ad definition to only target decision requests of a particular site:

{
  "type": "eligible",
  "endDate": "2023-03-20",
  "ad": {
    "id": 1,
    "flight": {
      "id": 1,
      "goalType": 1,
      "goalAmount": 10000,
      "networkId": 12345,
      "advertiserId": 1,
      "priorityId": 1,
      "startDate": "2023-03-13T00:00:00",
      "priority": {
        "id": 1,
        "order": 5,
        "type": "lottery"
      },
      "siteZoneTargeting": {
        "include": [
          {
            "siteId": 1234569
          }
        ]
      }
    },
    "creative": {
      "id": 1,
      "adType": 1
    }
  },
  "params": {
    "sampling": 3
  }
}

We can also narrow down the ad definition to only target specific keywords:

{
  "type": "eligible",
  "endDate": "2023-03-20",
  "ad": {
    "id": 1,
    "flight": {
      "id": 1,
      "goalType": 1,
      "goalAmount": 10000,
      "networkId": 12345,
      "advertiserId": 1,
      "priorityId": 1,
      "startDate": "2023-03-13T00:00:00",
      "priority": {
        "id": 1,
        "order": 5,
        "type": "lottery"
      },
      "siteZoneTargeting": {
        "include": [
          {
            "siteId": 1234569
          }
        ]
      },
      "keywordTargeting": {
        "include": [
          [
            "keyword1"
          ],
          [
            "keyword2"
          ]
        ]
      }
    },
    "creative": {
      "id": 1,
      "adType": 1
    }
  },
  "params": {
    "sampling": 3
  }
}

And to include custom targeting and creative templates to be used in AdQuery filters, grouping results by the local date of each request:

{
  "type": "eligible",
  "endDate": "2023-03-20",
  "ad": {
    "id": 1,
    "flight": {
      "id": 1,
      "goalType": 1,
      "goalAmount": 10000,
      "networkId": 12345,
      "advertiserId": 1,
      "priorityId": 1,
      "startDate": "2023-03-13T00:00:00",
      "priority": {
        "id": 1,
        "order": 5,
        "type": "lottery"
      },
      "siteZoneTargeting": {
        "include": [
          {
            "siteId": 1234569
          }
        ]
      },
      "keywordTargeting": {
        "include": [
          [
            "keyword1"
          ],
          [
            "keyword2"
          ]
        ]
      },
      "customTargeting": "[\"custom_page_name\"] contains homepage"
    },
    "creative": {
      "id": 1,
      "adType": 1, 
      "queryableFields": {
        "ctSize": {
          "type": "String",
          "value": "large"
        },
        "ctPrice": {
          "type": "Number",
          "value": 42
        }
      }
    }
  },
  "params": {
    "sampling": 3,
    "groupBy": ["$datetime.date"]
  }
}

The above forecast request should produce results in a schema similar to the following:

{
  "resultStatus": "success",
  "result": {
    "total": {
      "impressions": 10504,
      "uniqueUsers": 3568
    },
    "grouped": [
      {
        "key": {
          "$datetime.date": "2023-03-19"
        },
        "value": {
          "impressions": 1496,
          "uniqueUsers": 672
        }
      },
      {
        "key": {
          "$datetime.date": "2023-03-20"
        },
        "value": {
          "impressions": 1416,
          "uniqueUsers": 624
        }
      },
      {
        "key": {
          "$datetime.date": "2023-03-15"
        },
        "value": {
          "impressions": 1400,
          "uniqueUsers": 600
        }
      },
      {
        "key": {
          "$datetime.date": "2023-03-14"
        },
        "value": {
          "impressions": 1176,
          "uniqueUsers": 632
        }
      },
      {
        "key": {
          "$datetime.date": "2023-03-17"
        },
        "value": {
          "impressions": 1736,
          "uniqueUsers": 744
        }
      },
      {
        "key": {
          "$datetime.date": "2023-03-18"
        },
        "value": {
          "impressions": 1704,
          "uniqueUsers": 768
        }
      },
      {
        "key": {
          "$datetime.date": "2023-03-16"
        },
        "value": {
          "impressions": 1576,
          "uniqueUsers": 680
        }
      }
    ]
  },
  "id": "98e2af73-8d23-40fd-a760-d5741ac94d41",
  "status": "finished",
  "progress": 100.0,
  "desc": "Forecast is finished"
}

Eligibility forecasts are the quickest to complete since they don’t take into account existing ads.