https://developers.facebook.com/docs/marketing-api/campaign-structure
Contain just the visual elements of the ad and you can't change them once they're created. Each ad account has a creative library to store creatives for reuse in ads.
Objective | Schedule | Budget | Bidding | Targeting | Creative | |
---|---|---|---|---|---|---|
Campaign |
✓ |
|||||
Ad Set |
✓ |
✓ |
✓ |
✓ |
||
Ad |
✓ |
In the ads manager, we show all of the active and paused campaigns within an ad account.
Ad Sets
Ad sets are groups of ads, and are used to configure the budget and period the ads should run for. All ads contained within an ad set should have the same targeting, budget, billing, optimization goal, and duration.
curl -X POST \ -F 'name="My First AdSet"' \ -F 'lifetime_budget=20000' \ -F 'start_time="2021-10-22T01:34:16-0700"' \ -F 'end_time="2021-10-29T01:34:16-0700"' \ -F 'campaign_id="<AD_CAMPAIGN_ID>"' \ -F 'bid_amount=500' \ -F 'billing_event="IMPRESSIONS"' \ -F 'optimization_goal="POST_ENGAGEMENT"' \ -F 'targeting={ "age_min": 20, "age_max": 24, "behaviors": [ { "id": 6002714895372, "name": "All travelers" } ], "genders": [ 1 ], "geo_locations": { "countries": [ "US" ], "regions": [ { "key": "4081" } ], "cities": [ { "key": "777934", "radius": 10, "distance_unit": "mile" } ] }, "interests": [ { "id": "<INTEREST_ID>", "name": "<INTEREST_NAME>" } ], "life_events": [ { "id": 6002714398172, "name": "Newlywed (1 year)" } ], "facebook_positions": [ "feed" ], "publisher_platforms": [ "facebook", "audience_network" ] }' \ -F 'status="PAUSED"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v12.0/act_<AD_ACCOUNT_ID>/adsets
https://developers.facebook.com/docs/marketing-apis/get-started
Step 3: Create Ad Set and Define Budget, Billing, Optimization, and Duration
An ad set is a group of ads that share the same daily or lifetime budget, schedule, billing, optimization, and targeting data. In this step, you need to create a new object from the class AdSet
and specify:
-
Duration: How long your ads will run. Set it using
start_time
andend_time
. -
Budget: How much money you want to spend. Use
daily_budget
orlifetime_budget
. -
Optimization: What result you want to achieve with your ad. Set up using
optimization_goal
. -
Billing: How you want to pay. Use
billing_event
. -
Bid: What value you place on the occurrence of your optimization event. Use the
bid_amount
field. - Targeting: Use the targeting spec created in Step 2.
To create your ad set, you also need the ad campaign ID you saved from Step 1:
curl \ -F 'name=My Ad Set' \ -F 'optimization_goal=REACH' \ -F 'billing_event=IMPRESSIONS' \ -F 'bid_amount=2' \ -F 'daily_budget=1000' \ -F 'campaign_id=<CAMPAIGN_ID>' \ -F 'targeting={"geo_locations": {"countries":["US"]}, "interests": [{id: 6003139266461, 'name': 'Movies'}]}' \ -F 'start_time=2020-10-06T04:45:17+0000' \ -F 'status=PAUSED' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v<API_VERSION>/act_<AD_ACCOUNT_ID>/adsets // We recommend the creation of an ad set with the PAUSED status to avoid charges during your test.
Copying Ads
Alternatively, you can copy an existing ad, asset or campaign. It helps you quickly duplicate a campaign to change configurations or create test groups to extract performance knowledge. For more details, see:
Manage Your Ad Object's Status
Ad Campaign, Ad Set and Ads have one of following status types:
- Live
- Archived
- Deleted
For background see Ads Developer Blog, Deleted versus Archived.
Live
Live ad objects can have the following status:
ACTIVE
-
PAUSED
, for ad set or ad campaign PENDING_REVIEW
CREDIT_CARD_NEEDED
PREAPPROVED
DISABLED
Archived
Set the ad object to ARCHIVED
by setting status
field to ARCHIVED
. When an object status is set to ARCHIVED
, you can continue to query the details and stats based on the object id. However there is a maximum limit on the number of objects you can archive. So you should respect this limit and change status to DELETED
when you no longer need an object.
An ARCHIVED
object has only 2 fields you can change: name
and status
. You can also only change status
to DELETED
.
Deleted
Set the ad object to DELETED
by either setting status
field to DELETED
or sending an HTTP DELETE
to that object. Once an object status is set to DELETED
, you cannot set it back to ARCHIVED
.
If you keep the deleted object ID, you can continue to retrieve stats or object details by querying the object ID. However you cannot retrieve the deleted objects as a connection object from a non deleted node or object. For example, <API_VERSION>/<AD_ID>/insights
works for a deleted object but <API_VERSION>/act_<AD_ACCOUNT_ID>/insights?level=ad
does not return stats for the deleted object.
After you delete an ad, it may still track impressions, clicks, and actions for 28 days after the date of last delivery. You can query insights for DELETED
objects using the ad.effective_status
filter.
To avoid this scenario, you should delete ads 28 days after their last date of delivery to ensure stats no longer change. Also you should store the stats or ids of those objects in your own system before you delete them. This recommendation is optional:
- If your application does not show the breakdown of stats, or
- You do not care if the sum of breakdowns of stats do not match that of the parent object, due to some deleted child objects.
You cannot change any field, except name
, for a DELETED
object.
Manage Status
This is how you typically manage object status:
- You create ad objects, they run and start delivering
- When you delete an object, we automatically delete it
- When you reach the limit for achieved objects, you can no longer archive more objects.
- You should move archived deleted objects to the
deleted
state to reduce the limit.
The status on ad objects works this way for the hierarchy of ad objects:
- If you set the status to
paused
,archived
, ordeleted
for a campaign, all the objects below it automatically inherit that status. If you set an ad campaign todeleted
, you cannot retrieve the ad sets or ads below that campaign without explicitly specifying the IDs. - If you set the ad status to
paused
,archived
, ordeleted
, the ad set or ad campaign containing that ad keep its original status and is available for retrieval.
The following limits apply to ARCHIVED
objects for given ad account:
- 100,000 for Ad Campaigns
- 100,000 for Ad Sets
- 100,000 for Ads
If you read archived
edges, you must specifically filter for the archived objects since we do not return them by default. If you read stats for an ad object, we include the stats of all children objects, no matter if the child is active
, archived
, or deleted
. Therefore you need no filter for insights on child objects.
Comparisons of Different Statuses
Objects with statuses such as ACTIVE
, PAUSED
differ from those with ARCHIVED
status, and DELETED
. Here are the major differences.
Query | Live | ARCHIVED | DELETED |
---|---|---|---|
Exists in database |
Yes |
Yes |
Yes |
Maximum number per ad account |
100,000 |
No limit |
|
Query as edges without filter |
Yes |
No |
No |
Query as edges with status filter |
Yes for objects of status contained in the filter |
Yes if status filter contains |
No if status filter does not contain |
Query by its own ID |
Yes |
Yes |
Yes |
Stats aggregated in |
Yes |
Yes |
Yes |
Stats included in the result list of |
Yes |
No |
No |
Stats included in the result list of |
Yes for objects of status contained in the filter |
Yes for objects of status contained in the filter |
No |
Insights shown with |
Yes |
Yes |
Yes |
Status can be changed to |
Any valid status |
|
Cannot change |
Ad Set
An ad set is a group of ads that share the same daily or lifetime budget, schedule, bid type, bid info, and targeting data. Ad sets enable you to group ads according to your criteria, and you can retrieve the ad-related statistics that apply to a set. See Optimized CPM and Promoted Object.
For example, create an ad set with a daily budget:
curl \ -F 'name=My Ad Set' \ -F 'optimization_goal=REACH' \ -F 'billing_event=IMPRESSIONS' \ -F 'bid_amount=2' \ -F 'daily_budget=1000' \ -F 'campaign_id=<CAMPAIGN_ID>' \ -F 'targeting={"geo_locations":{"countries":["US"]}}' \ -F 'status=PAUSED' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v2.11/act_<AD_ACCOUNT_ID>/adsets
Create an ad set with a lifetime budget
curl \ -F 'name=LifetimeBudgetSet' \ -F 'lifetime_budget=100000' \ -F 'optimization_goal=POST_ENGAGEMENT' \ -F 'billing_event=IMPRESSIONS' \ -F 'bid_amount=1500' \ -F 'targeting={"geo_locations":{"countries":["US"]}}' \ -F 'campaign_id=<CAMPAIGN_ID>' \ -F 'end_time=2017-09-21T15:41:30+0000' \ -F 'status=PAUSED' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/VERSION/act_<AD_ACCOUNT_ID>/adsets
Bid/Budget Validations
When creating an ad set, from v2.4
and on, there will be a minimum budget for different billing events (clicks, impressions, actions). Minimum values are defined in terms of the daily budget but apply to lifetime budgets as well. For example, if the minimum daily budget is $5, a campaign lasting 5 days will need at least $25 for budget. All values in this section are in US Dollars. Differenct currency has different minimum daily budget limit.
If bid_strategy
is set to LOWEST_COST_WITHOUT_CAP
in the ad set:
Billing Event | Minimum Daily Budget | Notes |
---|---|---|
Impressions |
$0.50 |
|
Clicks/Likes/Video Views |
$2.50 |
|
Low-frequency Actions |
$40 |
Low-frequency actions include mobile app installs, offer claims or canvas app installs. Important: This minimum daily budget is the same for all countries. |
If bid_strategy
is set to LOWEST_COST_WITH_BID_CAP
in the ad set:
Billing Event | Minimum Daily Budget |
---|---|
Impressions |
At least the |
Clicks/Actions |
5x the |
Budgets in other non-USD currencies will be converted and validated upon time of ad set creation.
curl \ -F 'billing_event=IMPRESSIONS' \ -F 'optimization_goal=LINK_CLICKS' \ -F 'bid_amount=200' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v2.11/<AD_SET_ID>
Remarks
An archived ad set can only update two fields: name
and campaign_status
. The campaign_status
field can only be changed to DELETED
.
A deleted ad set can only change its name
.
There are two considerations to take into account when adjusting an ad set's budget value or budget type:
- When updating a set's lifetime or daily budget to a lower value, the new value must be at least 10% greater than the current amount spent already. For example: if an ad set has a $1000 lifetime budget and has spend $300 so far, the lowest new lifetime budget would be $330.
-
Since
v2.4
, ad sets have a minimum required budget. Any update must take that into consideration. Check the details at the Create Considerations section from this page.
/{ad_set_id}
.