Sự kiện lập hóa đơn

billing_event xác định sự kiện mà bạn muốn chi trả, chẳng hạn như lượt hiển thị, lượt click hoặc nhiều hành động khác. Việc lập hóa đơn tùy thuộc vào quy mô đối tượng và ngân sách của bạn.

Ví dụ: để tối ưu hóa cho POST_ENGAGEMENT và chi trả trên mỗi IMPRESSIONS:

curl -X POST \ -F 'name="My First Adset"' \ -F 'lifetime_budget=20000' \ -F 'start_time="2024-05-18T09:58:56-0700"' \ -F 'end_time="2024-05-28T09:58:56-0700"' \ -F 'campaign_id="<AD_CAMPAIGN_ID>"' \ -F 'bid_amount=500' \ -F 'billing_event="IMPRESSIONS"' \ -F 'optimization_goal="POST_ENGAGEMENT"' \ -F 'targeting={ "facebook_positions": [ "feed" ], "geo_locations": { "countries": [ "US" ], "regions": [ { "key": "4081" } ], "cities": [ { "key": 777934, "radius": 10, "distance_unit": "mile" } ] }, "genders": [ 1 ], "age_max": 24, "age_min": 20, "behaviors": [ { "id": 6002714895372, "name": "All travelers" } ], "life_events": [ { "id": 6002714398172, "name": "Newlywed (1 year)" } ], "publisher_platforms": [ "facebook" ], "device_platforms": [ "desktop" ] }' \ -F 'status="PAUSED"' \ -F 'access_token=<ACCESS_TOKEN>' \ https://graph.facebook.com/v19.0/act_<AD_ACCOUNT_ID>/adsets
'use strict'; const bizSdk = require('facebook-nodejs-business-sdk'); const AdAccount = bizSdk.AdAccount; const AdSet = bizSdk.AdSet; const access_token = '<ACCESS_TOKEN>'; const app_secret = '<APP_SECRET>'; const app_id = '<APP_ID>'; const id = '<AD_ACCOUNT_ID>'; const api = bizSdk.FacebookAdsApi.init(access_token); const showDebugingInfo = true; // Setting this to true shows more debugging info. if (showDebugingInfo) { api.setDebug(true); } const logApiCallResult = (apiCallName, data) => { console.log(apiCallName); if (showDebugingInfo) { console.log('Data:' + JSON.stringify(data)); } }; let fields, params; fields = [ ]; params = { 'name' : 'My First Adset', 'lifetime_budget' : '20000', 'start_time' : '2024-04-01T11:26:40-0700', 'end_time' : '2024-04-11T11:26:40-0700', 'campaign_id' : '<adCampaignLinkClicksID>', 'bid_amount' : '500', 'billing_event' : 'IMPRESSIONS', 'optimization_goal' : 'POST_ENGAGEMENT', 'targeting' : {'facebook_positions':['feed'],'geo_locations':{'countries':['US'],'regions':[{'key':'4081'}],'cities':[{'key':777934,'radius':10,'distance_unit':'mile'}]},'genders':[1],'age_max':24,'age_min':20,'behaviors':[{'id':6002714895372,'name':'All travelers'}],'life_events':[{'id':6002714398172,'name':'Newlywed (1 year)'}],'publisher_platforms':['facebook'],'device_platforms':['desktop']}, 'status' : 'PAUSED', }; const adsets = (new AdAccount(id)).createAdSet( fields, params ); logApiCallResult('adsets api call complete.', adsets);
require __DIR__ . '/vendor/autoload.php'; use FacebookAds\Object\AdAccount; use FacebookAds\Object\AdSet; use FacebookAds\Api; use FacebookAds\Logger\CurlLogger; $access_token = '<ACCESS_TOKEN>'; $app_secret = '<APP_SECRET>'; $app_id = '<APP_ID>'; $id = '<AD_ACCOUNT_ID>'; $api = Api::init($app_id, $app_secret, $access_token); $api->setLogger(new CurlLogger()); $fields = array( ); $params = array( 'name' => 'My First Adset', 'lifetime_budget' => '20000', 'start_time' => '2024-04-01T11:26:40-0700', 'end_time' => '2024-04-11T11:26:40-0700', 'campaign_id' => '<adCampaignLinkClicksID>', 'bid_amount' => '500', 'billing_event' => 'IMPRESSIONS', 'optimization_goal' => 'POST_ENGAGEMENT', 'targeting' => array('facebook_positions' => array('feed'),'geo_locations' => array('countries' => array('US'),'regions' => array(array('key' => '4081')),'cities' => array(array('key' => 777934,'radius' => 10,'distance_unit' => 'mile'))),'genders' => array(1),'age_max' => 24,'age_min' => 20,'behaviors' => array(array('id' => 6002714895372,'name' => 'All travelers')),'life_events' => array(array('id' => 6002714398172,'name' => 'Newlywed (1 year)')),'publisher_platforms' => array('facebook'),'device_platforms' => array('desktop')), 'status' => 'PAUSED', ); echo json_encode((new AdAccount($id))->createAdSet( $fields, $params )->exportAllData(), JSON_PRETTY_PRINT);
from facebook_business.adobjects.adaccount import AdAccount from facebook_business.adobjects.adset import AdSet from facebook_business.api import FacebookAdsApi access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAdsApi.init(access_token=access_token) fields = [ ] params = { 'name': 'My First Adset', 'lifetime_budget': '20000', 'start_time': '2024-04-01T11:26:40-0700', 'end_time': '2024-04-11T11:26:40-0700', 'campaign_id': '<adCampaignLinkClicksID>', 'bid_amount': '500', 'billing_event': 'IMPRESSIONS', 'optimization_goal': 'POST_ENGAGEMENT', 'targeting': {'facebook_positions':['feed'],'geo_locations':{'countries':['US'],'regions':[{'key':'4081'}],'cities':[{'key':777934,'radius':10,'distance_unit':'mile'}]},'genders':[1],'age_max':24,'age_min':20,'behaviors':[{'id':6002714895372,'name':'All travelers'}],'life_events':[{'id':6002714398172,'name':'Newlywed (1 year)'}],'publisher_platforms':['facebook'],'device_platforms':['desktop']}, 'status': 'PAUSED', } print AdAccount(id).create_ad_set( fields=fields, params=params, )
import com.facebook.ads.sdk.*; import java.io.File; import java.util.Arrays; public class SAMPLE_CODE_EXAMPLE { public static void main (String args[]) throws APIException { String access_token = \"<ACCESS_TOKEN>\"; String app_secret = \"<APP_SECRET>\"; String app_id = \"<APP_ID>\"; String id = \"<AD_ACCOUNT_ID>\"; APIContext context = new APIContext(access_token).enableDebug(true); new AdAccount(id, context).createAdSet() .setName(\"My First Adset\") .setLifetimeBudget(20000L) .setStartTime(\"2024-04-01T11:26:40-0700\") .setEndTime(\"2024-04-11T11:26:40-0700\") .setCampaignId(\"<adCampaignLinkClicksID>\") .setBidAmount(500L) .setBillingEvent(AdSet.EnumBillingEvent.VALUE_IMPRESSIONS) .setOptimizationGoal(AdSet.EnumOptimizationGoal.VALUE_POST_ENGAGEMENT) .setTargeting( new Targeting() .setFieldAgeMax(24L) .setFieldAgeMin(20L) .setFieldBehaviors(Arrays.asList( new IDName() .setFieldId(6002714895372L) .setFieldName(\"All travelers\") )) .setFieldDevicePlatforms(Arrays.asList(Targeting.EnumDevicePlatforms.VALUE_DESKTOP)) .setFieldFacebookPositions(Arrays.asList(\"feed\")) .setFieldGenders(Arrays.asList(1L)) .setFieldGeoLocations( new TargetingGeoLocation() .setFieldCities(Arrays.asList( new TargetingGeoLocationCity() .setFieldDistanceUnit(\"mile\") .setFieldKey(777934L) .setFieldRadius(10L) )) .setFieldCountries(Arrays.asList(\"US\")) .setFieldRegions(Arrays.asList( new TargetingGeoLocationRegion() .setFieldKey(\"4081\") )) ) .setFieldLifeEvents(Arrays.asList( new IDName() .setFieldId(6002714398172L) .setFieldName(\"Newlywed (1 year)\") )) .setFieldPublisherPlatforms(Arrays.asList(\"facebook\")) ) .setStatus(AdSet.EnumStatus.VALUE_PAUSED) .execute(); } }
require 'facebook_ads' access_token = '<ACCESS_TOKEN>' app_secret = '<APP_SECRET>' app_id = '<APP_ID>' id = '<AD_ACCOUNT_ID>' FacebookAds.configure do |config| config.access_token = access_token config.app_secret = app_secret end ad_account = FacebookAds::AdAccount.get(id) adsets = ad_account.adsets.create({ name: 'My First Adset', lifetime_budget: '20000', start_time: '2024-04-01T11:26:40-0700', end_time: '2024-04-11T11:26:40-0700', campaign_id: '<adCampaignLinkClicksID>', bid_amount: '500', billing_event: 'IMPRESSIONS', optimization_goal: 'POST_ENGAGEMENT', targeting: {'facebook_positions':['feed'],'geo_locations':{'countries':['US'],'regions':[{'key':'4081'}],'cities':[{'key':777934,'radius':10,'distance_unit':'mile'}]},'genders':[1],'age_max':24,'age_min':20,'behaviors':[{'id':6002714895372,'name':'All travelers'}],'life_events':[{'id':6002714398172,'name':'Newlywed (1 year)'}],'publisher_platforms':['facebook'],'device_platforms':['desktop']}, status: 'PAUSED', })

Sau khi chọn optimization_goal, bạn có thể có một hoặc nhiều tùy chọn billing_event. Hãy xem phần Mục tiêu tối ưu hóa và sự kiện lập hóa đơnCPA.

Xác thực

Sự kiện lập hóa đơn và cách mua

buying_type là cách mà nhà quảng cáo chi trả cho việc phân phối quảng cáo, được xác định ở cấp độ chiến dịch. Thông thường, chúng tôi chỉ sử dụng AUCTION, nhưng trong một số trường hợp đặc biệt, chúng tôi lập hóa đơn dựa trên dự đoán (gọi là RESERVED) hoặc dùng phương pháp giá cố định để đàm phán giá mà nhà quảng cáo sẽ thanh toán (gọi là FIXED_CPM). Chiến dịch có buying_type yêu cầu nhóm quảng cáo với billing_event được xác định.

Các billing_event hợp lệ cho từng buying_type:

AUCTION RESERVED FIXED_CPM

IMPRESSIONS

LINK_CLICKS

PAGE_LIKES

POST_ENGAGEMENT

VIDEO_VIEWS

Mục tiêu tối ưu hóa và sự kiện lập hóa đơn

Đối với chiến dịchbuying_type=AUCTION có nhóm optimization_goal, chúng tôi áp đặt hạn chế đối với billing_event mà bạn có thể chọn cho nhóm quảng cáo của mình.

Trong các hạn chế bên dưới, chúng tôi giả định bạn đã chỉ định objective ở cấp độ chiến dịch.

"optimization_goal" "billing_event" của nhóm quảng cáo hợp lệ

APP_INSTALLS

IMPRESSIONS

AD_RECALL_LIFT

IMPRESSIONS

ENGAGED_USERS

IMPRESSIONS

EVENT_RESPONSES

IMPRESSIONS

IMPRESSIONS

IMPRESSIONS

LEAD_GENERATION

IMPRESSIONS

LINK_CLICKS

LINK_CLICKS, IMPRESSIONS

OFFSITE_CONVERSIONS

IMPRESSIONS

PAGE_LIKES

IMPRESSIONS

POST_ENGAGEMENT

IMPRESSIONS. Kể từ v2.11 POST_ENGAGEMENT sẽ không được chọn nữa.

REACH

IMPRESSIONS

REPLIES

IMPRESSIONS

SOCIAL_IMPRESSIONS

IMPRESSIONS

THRUPLAY

IMPRESSIONS, THRUPLAY

TWO_SECOND_CONTINUOUS_VIDEO_VIEWS

IMPRESSIONS, TWO_SECOND_CONTINUOUS_VIDEO_VIEWS

IMPRESSIONSVIDEO_VIEWS

VALUE

IMPRESSIONS

LANDING_PAGE_VIEWS

IMPRESSIONS