The ad rules engine is a central rule management service that helps you easily, efficiently, and intelligently manage ads. Without it, you must query the Marketing API to monitor an ad's performance and manually take actions on certain conditions.
Since we can express most conditions as logical expressions, we can automate management in two ways: Schedule-based rules or Trigger-based rules.
Ad rules are standalone objects created and stored in the ad rules library and minimally contain a name, an evaluation_spec and an execution_spec.
curl -X POST \
-F 'name=Rule 1' \
-F 'evaluation_spec={
...
}' \
-F 'execution_spec={
...
}' \
-F "access_token=<ACCESS_TOKEN>" \
https://graph.facebook.com/v24.0/act_<AD_ACCOUNT_ID>/adrules_library
Monitor the state of your ads in real-time. A trigger-based rule is evaluated as soon as its pertinent ad objects' metadata or Ad Insights data are changed.
Monitor the state of your ads by checking them at a set time interval to see if they meet the evaluation_spec criteria.
The main purpose of the evaluation_spec of a rule is to determine the objects upon which the rule should execute its action.
The execution_spec of a rule determines the action that applies to all objects that pass evaluation.
The status of a rule determines whether the rule should be running.
To temporarily turn off a rule, set its status to DISABLED. To reactivate a rule, set its status to ENABLED. To permanently remove a rule, delete it.