Cost Per Actions (CPA) allows you to specify conversion events and get charged by the amount of conversions. CPA for video views is also called CPV.
An alternative to CPA is oCPM, which charges per impressions served.
Your bid is defined for an ad set. These fields must follow the restrictions below:
Name | Description |
---|---|
| Defines the action you pay on. Set to |
| Defines the action you optimize for. Set to same value as your |
| Value you place on the objective, specified in cents, minimum 1 cent. For example, |
| For those ads which optimize for connections including |
Starting on v9, CPA billing for app ads is deprecated, you cannot set both billing event and optimization goal to APP_INSTALLS
. Instead, we recommend using the impression
billing events. You can still specify APP_INSTALLS
under billing_event
or optimization_goal
, but not both at the same time.
See ad set document on allowed updates to ad sets.
The example below creates a CPA bidded ad set. Note that for CPA ad sets, you must set a promoted_object
.
curl -X POST \
-F 'name="A CPA Ad Set"' \
-F 'campaign_id="<AD_CAMPAIGN_ID>"' \
-F 'daily_budget=5000' \
-F 'start_time="2024-11-28T05:55:09-0800"' \
-F 'end_time="2024-12-05T05:55:09-0800"' \
-F 'billing_event="IMPRESSIONS"' \
-F 'optimization_goal="REACH"' \
-F 'bid_amount=1000' \
-F 'promoted_object={
"page_id": "<PAGE_ID>"
}' \
-F 'targeting={
"facebook_positions": [
"feed"
],
"geo_locations": {
"countries": [
"US"
]
}
}' \
-F 'user_os="iOS"' \
-F 'publisher_platforms="facebook"' \
-F 'device_platforms="mobile"' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/act_<AD_ACCOUNT_ID>/adsets
After that, you can create ads and put them into this ad set following the creation flow here.
Change the bid to a CPA ad set:
curl -X POST \
-F 'billing_event="IMPRESSIONS"' \
-F 'optimization_goal="LINK_CLICKS"' \
-F 'bid_amount=200' \
-F 'targeting={
"geo_locations": {
"countries": [
"US"
]
},
"facebook_positions": [
"feed"
]
}' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/<AD_SET_ID>/
To create an ad bidding CPV, or CPA for video views, first create an ad campaign with objective=VIDEO_VIEWS
.
curl -X POST \
-F 'name="Video Views campaign"' \
-F 'objective="OUTCOME_ENGAGEMENT"' \
-F 'status="PAUSED"' \
-F 'special_ad_categories=[]' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v21.0/act_<AD_ACCOUNT_ID>/campaigns
Then, set the CPA for video views bid_info
at the ad set:
use FacebookAds\Object\AdSet;
use FacebookAds\Object\Fields\AdSetFields;
use FacebookAds\Object\Fields\TargetingFields;
use FacebookAds\Object\Targeting;
use FacebookAds\Object\Values\AdSetBillingEventValues;
use FacebookAds\Object\Values\AdSetOptimizationGoalValues;
$adset = new AdSet(null, 'act_<AD_ACCOUNT_ID>');
$adset->setData(array(
AdSetFields::NAME => 'A CPV Ad Set',
AdSetFields::CAMPAIGN_ID => <CAMPAIGN_ID>,
AdSetFields::DAILY_BUDGET => 500,
AdSetFields::START_TIME =>
(new \DateTime("+1 week"))->format(\DateTime::ISO8601),
AdSetFields::END_TIME =>
(new \DateTime("+2 week"))->format(\DateTime::ISO8601),
AdSetFields::BILLING_EVENT => AdSetBillingEventValues::VIDEO_VIEWS,
AdSetFields::OPTIMIZATION_GOAL => AdSetOptimizationGoalValues::VIDEO_VIEWS,
AdSetFields::BID_AMOUNT => 100,
AdSetFields::TARGETING => (new Targeting())->setData(array(
TargetingFields::GEO_LOCATIONS => array(
'countries' => array(
'US',
),
),
TargetingFields::PUBLISHER_PLATFORMS => array('facebook'),
TargetingFields::DEVICE_PLATFORMS => array('mobile'),
)),
));
$adset->create(array(
AdSet::STATUS_PARAM_NAME => AdSet::STATUS_PAUSED,
));
import time
from facebookads.adobjects.adset import AdSet
adset = AdSet(parent_id='act_<AD_ACCOUNT_ID>')
adset.update({
AdSet.Field.name: 'A CPV Ad Set',
AdSet.Field.campaign_id: <CAMPAIGN_ID>,
AdSet.Field.daily_budget: 500,
AdSet.Field.start_time: int(time.time()),
AdSet.Field.end_time: int(time.time() + 100000),
AdSet.Field.optimization_goal: AdSet.OptimizationGoal.video_views,
AdSet.Field.billing_event: AdSet.BillingEvent.video_views,
AdSet.Field.bid_amount: 100,
AdSet.Field.targeting: {
'geo_locations': {
'countries': ['US'],
},
Targeting.Field.publisher_platforms: ['facebook'],
Targeting.Field.device_platforms: ['mobile'],
},
})
adset.remote_create(params={
'status': AdSet.Status.paused,
})
AdSet adSet = new AdAccount(act_<AD_ACCOUNT_ID>, context).createAdSet()
.setName("A CPV Ad Set")
.setCampaignId(<CAMPAIGN_ID>)
.setDailyBudget(500L)
.setStartTime(start_time)
.setEndTime(end_time)
.setBillingEvent(AdSet.EnumBillingEvent.VALUE_VIDEO_VIEWS)
.setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_VIDEO_VIEWS)
.setBidAmount(100L)
.setTargeting(
new Targeting()
.setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_MOBILE))
.setFieldGeoLocations(
new TargetingGeoLocation()
.setFieldCountries(Arrays.asList("US"))
)
.setFieldPublisherPlatforms(Arrays.asList("facebook"))
)
.setStatus(AdSet.EnumStatus.VALUE_PAUSED)
.execute();
String ad_set_id = adSet.getId();
curl \
-F 'name=A CPV Ad Set' \
-F 'campaign_id=<CAMPAIGN_ID>' \
-F 'daily_budget=500' \
-F 'start_time=2018-02-06T04:45:29+0000' \
-F 'end_time=2018-02-13T04:45:29+0000' \
-F 'billing_event=VIDEO_VIEWS' \
-F 'optimization_goal=VIDEO_VIEWS' \
-F 'bid_amount=100' \
-F 'targeting={
"device_platforms": ["mobile"],
"geo_locations": {"countries":["US"]},
"publisher_platforms": ["facebook"]
}' \
-F 'status=PAUSED' \
-F 'access_token=<ACCESS_TOKEN>' \
https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets