This page discusses the change_spec
in more detail, specifically on how to construct the execution option and how to use the more advanced features.
The change_spec
is used for execution types such as CHANGE_BUDGET
and CHANGE_BID
, and contains the following parameters: amount
, limit
, unit
, target_field
.
Field | Description |
---|---|
| Required. Determines the amount to change the budget or bid. The values of other parameters in the Supported Values: A numeric value, such as |
| Optional. Specifies the maximum or minimum budget or bid amount. For example, if budget or bid are being increased, this number acts as an upper limit. If Supported Values: Currency, such as |
| Required, unless Specifies the unit of the Supported Values: |
| Optional. Specifies whether or not to scale budgets or bids by a target value. If this is present, Supported Values: An Insights field, such as |
Here's an example of a CHANGE_BUDGET
rule that decreases budgets by 30% for all under-performing ad sets, where we define under-performing as stably having a high lifetime frequency
. This rule only runs at midnight on Tuesdays and Fridays.
curl \ -F 'name=Test Change Budget Rule' \ -F 'schedule_spec={ "schedule_type": "CUSTOM", "schedule": [ { "start_minute": 0, "days": [2, 5] } ] }' \ -F 'evaluation_spec={ "evaluation_type": "SCHEDULE", "filters": [ { "field": "entity_type", "value": "ADSET", "operator": "EQUAL" }, { "field": "time_preset", "value": "LIFETIME", "operator": "EQUAL" }, { "field": "impressions", "value": 8000, "operator": "GREATER_THAN" }, { "field": "frequency", "value": 5.0, "operator": "GREATER_THAN" } ] }' \ -F 'execution_spec={ "execution_type": "CHANGE_BUDGET", "execution_options": [ { "field": "change_spec", "value": { "amount": -30, "unit": "PERCENTAGE" }, "operator": "EQUAL" }, ] }' \ -F "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<VERSION>/<AD_ACCOUNT_ID>/adrules_library
Here's another example, where the bid is scaled daily based on a target cost_per_mobile_app_install
value for ad set 123
.
We also add a range filter for cost_per_mobile_app_install
to introduce a 10% tolerance window. By having this, minor proportional changes are not done, if current value is close enough to the target value.
curl \ -F 'name=Test Change Bid Rule' \ -F 'schedule_spec={ "schedule_type": "DAILY" }' \ -F 'evaluation_spec={ "evaluation_type": "SCHEDULE", "filters": [ { "field": "id", "value": [123], "operator": "IN" }, { "field": "time_preset", "value": "LIFETIME", "operator": "EQUAL" }, { "field": "mobile_app_install", "value": 100, "operator": "GREATER_THAN" }, { "field": "cost_per_mobile_app_install", "value": [4.5, 5.5], "operator": "NOT_IN_RANGE" } ] }' \ -F 'execution_spec={ "execution_type": "CHANGE_BID", "execution_options": [ { "field": "change_spec", "value": { "amount": 5.0, "limit": [2.0, 10.0], "target_field": "cost_per_mobile_app_install" }, "operator": "EQUAL" }, ] }' \ -F "access_token=<ACCESS_TOKEN>" \ https://graph.facebook.com/<VERSION>/<AD_ACCOUNT_ID>/adrules_library
For example, if current value is 4.0
, the bid is increased by 25%
, since that is the proportional difference between the target value of 5.0
and the current value.
The limit keeps the bid from increasing above 10.0
and decreasing below 2.0
.