광고 항목에는 설정을 상속받는 상위 리소스가 너무 많고 있습니다. 이러한 리소스의 대부분은 다음을 사용하여 생성, 검색 및 업데이트할 수 있습니다. 디스플레이 및 Video 360 API 이 페이지에서는 리소스 계층 구조를 설명하고 예시를 제공합니다. 디스플레이 및 Video 360 API
리소스 계층 구조
디스플레이 및 동영상 360에는 설정 요소가 포함된 리소스 계층 구조가 있습니다. 광고를 게재할 수 있습니다. 각 리소스는 있습니다. 가장 낮은 계층 구조에서 시작:
- 광고 항목은 게재되는 광고를 제어하는 리소스입니다.
제공받을 수 있게 해 줍니다.
- YouTube 및 파트너 광고 항목에는 광고 그룹도 있습니다. 및 광고 하위 리소스를 참조하세요. 이들은 추가적인 수준의 단일 광고 항목 예산 내에서 타겟팅할 수 있습니다. YouTube 및 파트너 라인 수정할 수 없는 항목, 광고 그룹, 광고, 타겟팅은 API.
- 게재 신청서에 여러 광고 항목이 있습니다. 기본값을 제공합니다. 확인할 수 있습니다
- 캠페인에 여러 게재 신청서가 포함되어 있습니다. 설정을 시행하지 않음 게재 신청서에서 확인할 수 있습니다. 기본 설정은 게재되는 광고의 진행 상황과 실적을 측정할 수 있습니다.
- 광고주는 여러 광고 캠페인을 소유합니다. 브랜드 안전성 강화 기타 일반 설정을 변경할 수 없습니다. 또한 그 아래에 게재되는 광고에 사용되는 광고 소재 객체를 관리하고 모든 리소스를 지정할 수 있습니다.
- 파트너는 여러 광고주를 소유합니다. 브랜드 안전성을 강화합니다. 기타 설정을 변경할 수 있습니다. 또한 타겟팅에 사용된 리소스 및 전환에 사용된 플러드라이트 활동 있습니다. API를 통해 파트너를 수정할 수 없습니다.
상속
광고 항목은 상위 리소스로부터 수많은 설정과 액세스 권한을 상속받습니다. 광고 항목 및 광고 게재를 관리할 때 고려해야 할 상속된 품질은 다음과 같습니다.
- 사용 가능한 광고 소재 및 플러드라이트 활동: 광고 항목에서만 액세스할 수 있습니다.
할 수 있습니다. 광고 소재
는 광고주 아래에 생성되며 플러드라이트 활동은 파트너가 소유합니다.
LineItem
리소스 필드에 할당된 리소스creativeIds
및conversionCounting
에서 동일한 상위 항목을 공유해야 합니다. 확인할 수 있습니다. - 액세스 가능한 타겟팅 가능한 항목: channel, 통합 잠재고객 등 기타 항목이 타겟팅에 사용됩니다. 광고 항목은 선택할 수 있습니다.
- 브랜드 안전성 타겟팅: 광고 항목이 파트너에서 설정한 타겟팅을 상속합니다.
확인할 수 있습니다 상속된 타겟팅은 삭제할 수 없습니다. 기존의
타겟팅은 할당된 타겟팅 옵션
inheritance
필드에 추가하며, 이 필드는 타겟팅을 적용할 수 있습니다
리소스 만들기
위에 나열된 모든 리소스는 Display &Video 360 및 Video 360 API 미만 은 제공된 코드를 사용하여 이러한 각 리소스를 만드는 방법을 보여주는 간단한 코드 예제입니다. 클라이언트 라이브러리를 사용해 만들 수 있습니다.
광고주 만들기
다음은 광고주를 만드는 방법의 예입니다.
자바
// Create an advertiser object. Advertiser advertiser = new Advertiser(); advertiser.setPartnerId(partner-id); advertiser.setDisplayName(display-name); advertiser.setEntityStatus("ENTITY_STATUS_ACTIVE"); // Create and set the advertiser general configuration. AdvertiserGeneralConfig advertiserGeneralConfig = new AdvertiserGeneralConfig(); advertiserGeneralConfig.setDomainUrl(domain-url); advertiserGeneralConfig.setCurrencyCode("USD"); advertiser.setGeneralConfig(advertiserGeneralConfig); // Create the ad server configuration structure. AdvertiserAdServerConfig advertiserAdServerConfig = new AdvertiserAdServerConfig(); // Create and add the third party only configuration to the ad server // configuration. advertiserAdServerConfig.setThirdPartyOnlyConfig(new ThirdPartyOnlyConfig()); // Set the ad server configuration. advertiser.setAdServerConfig(advertiserAdServerConfig); // Create and set the creative configuration. advertiser.setCreativeConfig(new AdvertiserCreativeConfig()); // Create and set the billing configuration. AdvertiserBillingConfig advertiserBillingConfig = new AdvertiserBillingConfig(); advertiserBillingConfig.setBillingProfileId(billing-profile-id); advertiser.setBillingConfig(advertiserBillingConfig); // Configure the create request. Advertisers.Create request = service.advertisers().create(advertiser); // Create the advertiser. Advertiser response = request.execute(); // Display the new advertiser. System.out.printf("Advertiser %s was created.", response.getName());
Python
# Create an advertiser object. advertiser_obj = { 'partnerId': partner-id, 'displayName': display-name, 'entityStatus': "ENTITY_STATUS_ACTIVE", 'generalConfig': { 'domainUrl' : domain-url, 'currencyCode' : 'USD' }, 'adServerConfig': { 'thirdPartyOnlyConfig' : {} }, 'creativeConfig': {}, 'billingConfig': { 'billingProfileId' : billing-profile-id } } # Create the advertiser. advertiser = service.advertisers().create( body=advertiser_obj ).execute() # Display the new advertiser. print("Advertiser %s was created." % advertiser["name"])
PHP
// Create an advertiser object. $advertiser = new Google_Service_DisplayVideo_Advertiser(); $advertiser->setPartnerId(partner-id); $advertiser->setDisplayName(display-name); $advertiser->setEntityStatus('ENTITY_STATUS_ACTIVE'); // Create and set the advertiser general configuration. $generalConfig = new Google_Service_DisplayVideo_AdvertiserGeneralConfig(); $generalConfig->setDomainUrl(domain-url); $generalConfig->setCurrencyCode('USD'); $advertiser->setGeneralConfig($generalConfig); // Create the ad server configuration structure. $adServerConfig = new Google_Service_DisplayVideo_AdvertiserAdServerConfig(); // Create and add the third party only configuration to the ad server // configuration. $adServerConfig->setThirdPartyOnlyConfig( new Google_Service_DisplayVideo_ThirdPartyOnlyConfig() ); // Set the ad server configuration. $advertiser->setAdServerConfig($adServerConfig); // Create and set the creative configuration. $advertiser->setCreativeConfig( new Google_Service_DisplayVideo_AdvertiserCreativeConfig() ); // Create and set the billing configuration. $billingConfig = new Google_Service_DisplayVideo_AdvertiserBillingConfig(); $billingConfig->setBillingProfileId(billing-profile-id); $advertiser->setBillingConfig($billingConfig); // Call the API, creating the advertiser. $result = $this->service->advertisers->create($advertiser); printf('Advertiser %s was created.\n', $result['name']);
캠페인 만들기
다음은 캠페인을 만드는 방법의 예입니다.
자바
// Create a campaign object. Campaign campaign = new Campaign(); campaign.setDisplayName(display-name); campaign.setEntityStatus("ENTITY_STATUS_PAUSED"); // Create a campaign goal object. CampaignGoal campaignGoal = new CampaignGoal(); campaignGoal.setCampaignGoalType("CAMPAIGN_GOAL_TYPE_BRAND_AWARENESS"); // Create and add a performance goal to the campaign goal object. PerformanceGoal performanceGoal = new PerformanceGoal(); performanceGoal.setPerformanceGoalType("PERFORMANCE_GOAL_TYPE_CPC"); performanceGoal.setPerformanceGoalAmountMicros(1000000L); campaignGoal.setPerformanceGoal(performanceGoal); // Set the campaign goal. campaign.setCampaignGoal(campaignGoal); // Create a campaign flight object. // This object details the planned spend and duration of the campaign. CampaignFlight campaignFlight = new CampaignFlight(); campaignFlight.setPlannedSpendAmountMicros(1000000L); // Create the date range for the campaign flight. DateRange dateRange = new DateRange(); // Set the start date to one week from now and the end date to two weeks // from now. Calendar calendarStartDate = Calendar.getInstance().add(Calendar.DATE, 7); Calendar calendarEndDate = Calendar.getInstance().add(Calendar.DATE, 14); dateRange.setStartDate( new Date() .setYear(calendarStartDate.get(Calendar.YEAR)) .setMonth(calendarStartDate.get(Calendar.MONTH)) .setDay(calendarStartDate.get(Calendar.DAY_OF_MONTH))); dateRange.setEndDate( new Date() .setYear(calendarEndDate.get(Calendar.YEAR)) .setMonth(calendarEndDate.get(Calendar.MONTH)) .setDay(calendarEndDate.get(Calendar.DAY_OF_MONTH))); // Add the planned date range to the campaign flight object. campaignFlight.setPlannedDates(dateRange); // Set the campaign flight. campaign.setCampaignFlight(campaignFlight); // Create and set the frequency cap. FrequencyCap frequencyCap = new FrequencyCap(); frequencyCap.setMaxImpressions(10); frequencyCap.setTimeUnit("TIME_UNIT_DAYS"); frequencyCap.setTimeUnitCount(1); campaign.setFrequencyCap(frequencyCap); // Configure the create request. Campaigns.Create request = service.advertisers().campaigns() .create(advertiser-id, campaign); // Create the campaign. Campaign response = request.execute(); // Display the new campaign. System.out.printf("Campaign %s was created.", response.getName());
Python
# Create a future campaign flight start and end dates. startDate = date.today() + timedelta(days=7) endDate = date.today() + timedelta(days=14) # Create a campaign object. campaign_obj = { 'displayName': display-name, 'entityStatus': 'ENTITY_STATUS_PAUSED', 'campaignGoal': { 'campaignGoalType' : 'CAMPAIGN_GOAL_TYPE_BRAND_AWARENESS', 'performanceGoal': { 'performanceGoalType': 'PERFORMANCE_GOAL_TYPE_CPC', 'performanceGoalAmountMicros': 1000000 } }, 'campaignFlight': { 'plannedSpendAmountMicros': 1000000, 'plannedDates': { 'startDate': { 'year': startDate.year, 'month': startDate.month, 'day': startDate.day }, 'endDate': { 'year': endDate.year, 'month': endDate.month, 'day': endDate.day } } }, 'frequencyCap': { 'maxImpressions': 10, 'timeUnit': 'TIME_UNIT_DAYS', 'timeUnitCount': 1 } } # Create the campaign. campaign = service.advertisers().campaigns().create( advertiserId=advertiser-id, body=campaign_obj ).execute() # Display the new campaign. print("Campaign %s was created." % campaign["name"])
PHP
// Create a campaign object. $campaign = new Google_Service_DisplayVideo_Campaign(); $campaign->setDisplayName(display-name); $campaign->setEntityStatus('ENTITY_STATUS_ACTIVE'); // Create a campaign goal object. $campaignGoal = new Google_Service_DisplayVideo_CampaignGoal(); $campaignGoal->setCampaignGoalType( 'CAMPAIGN_GOAL_TYPE_BRAND_AWARENESS' ); // Create and add a performance goal to the campaign goal object. $performanceGoal = new Google_Service_DisplayVideo_PerformanceGoal(); $performanceGoal->setPerformanceGoalType('PERFORMANCE_GOAL_TYPE_CPC'); $performanceGoal->setPerformanceGoalAmountMicros(1000000); // Set the campaign goal. $campaignGoal->setPerformanceGoal($performanceGoal); $campaign->setCampaignGoal($campaignGoal); // Create a campaign flight object. // This object details the planned spend and duration of the campaign. $campaignFlight = new Google_Service_DisplayVideo_CampaignFlight(); $campaignFlight->setPlannedSpendAmountMicros(1000000); // Create a date range object for the flight. $dateRange = new Google_Service_DisplayVideo_DateRange(); // Create and assign a start date one week from now. $startDateTime = new DateTime('today + 7 days'); $startDate = new Google_Service_DisplayVideo_Date(); $startDate->setYear($startDateTime->format('Y')); $startDate->setMonth($startDateTime->format('n')); $startDate->setDay($startDateTime->format('j')); $dateRange->setStartDate($startDate); // Create and assign an end date two weeks from now. $endDateTime = new DateTime('today + 14 days'); $endDate = new Google_Service_DisplayVideo_Date(); $endDate->setYear($endDateTime->format('Y')); $endDate->setMonth($endDateTime->format('n')); $endDate->setDay($endDateTime->format('j')); $dateRange->setendDate($endDate); // Assign date range to flight. $campaignFlight->setPlannedDates($dateRange); // Assign flight to campaign. $campaign->setCampaignFlight($campaignFlight); // Create and set the frequency cap. $frequencyCap = new Google_Service_DisplayVideo_FrequencyCap(); $frequencyCap->setMaxImpressions(10); $frequencyCap->setTimeUnit('TIME_UNIT_DAYS'); $frequencyCap->setTimeUnitCount(1); $campaign->setFrequencyCap($frequencyCap); // Call the API, creating the campaign under the given advertiser. $result = $this->service->advertisers_campaigns->create( advertiser-id, $campaign ); // Display the new campaign. printf('Campaign %s was created.\n', $result['name']);
게재 신청서 만들기
다음은 게재 신청서를 만드는 방법의 예입니다.
자바
// Create an insertion order object. InsertionOrder insertionOrder = new InsertionOrder(); insertionOrder.setCampaignId(campaign-id); insertionOrder.setDisplayName(display-name); insertionOrder.setEntityStatus("ENTITY_STATUS_DRAFT"); // Create and add the pacing setting. Pacing pacing = new Pacing(); pacing.setPacingPeriod("PACING_PERIOD_DAILY"); pacing.setPacingType("PACING_TYPE_EVEN"); pacing.setDailyMaxMicros(10000L); insertionOrder.setPacing(pacing); // Create and set the frequency cap. FrequencyCap frequencyCap = new FrequencyCap(); frequencyCap.setTimeUnit("TIME_UNIT_DAYS"); frequencyCap.setTimeUnitCount(1); frequencyCap.setMaxImpressions(10); insertionOrder.setFrequencyCap(frequencyCap); // Create and set the key performance indicator (KPI). Kpi kpi = new Kpi(); kpi.setKpiType("KPI_TYPE_CPC"); kpi.setKpiAmountMicros(1000000L); insertionOrder.setKpi(kpi); // Create a budget object. InsertionOrderBudget insertionOrderBudget = new InsertionOrderBudget(); insertionOrderBudget.setBudgetUnit("BUDGET_UNIT_CURRENCY"); // Create a budget segment object. InsertionOrderBudgetSegment insertionOrderBudgetSegment = new InsertionOrderBudgetSegment(); insertionOrderBudgetSegment.setBudgetAmountMicros(100000L); // Create the date range for the budget segment. DateRange dateRange = new DateRange(); // Set the start date to one week from now and the end date to two weeks // from now. Calendar calendarStartDate = Calendar.getInstance().add(Calendar.DATE, 7); Calendar calendarEndDate = Calendar.getInstance().add(Calendar.DATE, 14); dateRange.setStartDate( new Date() .setYear(calendarStartDate.get(Calendar.YEAR)) .setMonth(calendarStartDate.get(Calendar.MONTH)) .setDay(calendarStartDate.get(Calendar.DAY_OF_MONTH))); dateRange.setEndDate( new Date() .setYear(calendarEndDate.get(Calendar.YEAR)) .setMonth(calendarEndDate.get(Calendar.MONTH)) .setDay(calendarEndDate.get(Calendar.DAY_OF_MONTH))); // Add the date range to the budget segment. insertionOrderBudgetSegment.setDateRange(dateRange); // Add budget segment list to the budget. insertionOrderBudget .setBudgetSegments(ImmutableList.of(insertionOrderBudgetSegment)); // Set budget. insertionOrder.setBudget(insertionOrderBudget); // Configure the create request. InsertionOrders.Create request = service.advertisers().insertionOrders() .create(advertiser-id, insertionOrder); // Create the insertion order. InsertionOrder response = request.execute(); // Display the new insertion order. System.out.printf("InsertionOrder %s was created.", response.getName());
Python
# Create a future budget segment start and end dates. startDate = date.today() + timedelta(days=7) endDate = date.today() + timedelta(days=14) # Create an insertion order object. insertion_order_obj = { 'campaignId' : campaign-id, 'displayName': display-name, 'entityStatus': 'ENTITY_STATUS_DRAFT', 'pacing': { 'pacingPeriod': 'PACING_PERIOD_DAILY', 'pacingType': 'PACING_TYPE_EVEN', 'dailyMaxMicros': 10000 }, 'frequencyCap': { 'maxImpressions': 10, 'timeUnit': 'TIME_UNIT_DAYS', 'timeUnitCount': 1 }, 'kpi' : { 'kpiType': 'KPI_TYPE_CPC', 'kpiAmountMicros': 1000000 }, 'budget': { 'budgetUnit': 'BUDGET_UNIT_CURRENCY', 'budgetSegments': [ { 'budgetAmountMicros': 100000, 'dateRange': { 'startDate': { 'year': startDate.year, 'month': startDate.month, 'day': startDate.day }, 'endDate': { 'year': endDate.year, 'month': endDate.month, 'day': endDate.day } } } ] } } # Create the insertion order. insertionOrder = service.advertisers().insertionOrders().create( advertiserId=advertiser-id, body=insertion_order_obj ).execute() # Display the new insertion order. print("Insertion Order %s was created." % insertionOrder["name"])
PHP
// Create an insertion order object. $insertionOrder = new Google_Service_DisplayVideo_InsertionOrder(); $insertionOrder->setCampaignId(campaign-id); $insertionOrder->setDisplayName(display-name); $insertionOrder->setEntityStatus('ENTITY_STATUS_DRAFT'); // Create and add the pacing setting. $pacing = new Google_Service_DisplayVideo_Pacing(); $pacing->setPacingPeriod('PACING_PERIOD_DAILY'); $pacing->setPacingType('PACING_TYPE_EVEN'); $pacing->setDailyMaxMicros(10000); $insertionOrder->setPacing($pacing); // Create and set the frequency cap. $frequencyCap = new Google_Service_DisplayVideo_FrequencyCap(); $frequencyCap->setMaxImpressions(10); $frequencyCap->setTimeUnit('TIME_UNIT_DAYS'); $frequencyCap->setTimeUnitCount(1); $insertionOrder->setFrequencyCap($frequencyCap); // Create and set the key performance indicator (KPI). $kpi = new Google_Service_DisplayVideo_Kpi(); $kpi->setKpiType('KPI_TYPE_CPC'); $kpi->setKpiAmountMicros(1000000); $insertionOrder->setKpi($kpi); // Create a budget object. $budget = new Google_Service_DisplayVideo_InsertionOrderBudget(); $budget->setBudgetUnit('BUDGET_UNIT_CURRENCY'); // Create a budget segment object. $budgetSegment = new Google_Service_DisplayVideo_InsertionOrderBudgetSegment(); $budgetSegment->setBudgetAmountMicros(100000); // Create a date range object for the budget segment. $dateRange = new Google_Service_DisplayVideo_DateRange(); // Create and assign a start date one week from now. $startDateTime = new DateTime('today + 7 days'); $startDate = new Google_Service_DisplayVideo_Date(); $startDate->setYear($startDateTime->format('Y')); $startDate->setMonth($startDateTime->format('n')); $startDate->setDay($startDateTime->format('j')); $dateRange->setStartDate($startDate); // Create and assign an end date two weeks from now. $endDateTime = new DateTime('today + 14 days'); $endDate = new Google_Service_DisplayVideo_Date(); $endDate->setYear($endDateTime->format('Y')); $endDate->setMonth($endDateTime->format('n')); $endDate->setDay($endDateTime->format('j')); $dateRange->setendDate($endDate); // Assign date range to budget segment. $budgetSegment->setDateRange($dateRange); // Set budget segment. $budget->setBudgetSegments(array($budgetSegment)); // Set budget object. $insertionOrder->setBudget($budget); // Call the API, creating the insertion order under the advertiser and // campaign given. $result = $this->service->advertisers_insertionOrders->create( advertiser-id, $insertionOrder ); printf('Insertion Order %s was created.\n', $result['name']);
광고 항목 만들기
다음은 광고 항목을 만드는 방법의 예입니다.
자바
// Create a line item object. LineItem lineItem = new LineItem(); lineItem.setInsertionOrderId(insertion-order-id); lineItem.setDisplayName(display-name); lineItem.setLineItemType("LINE_ITEM_TYPE_DISPLAY_DEFAULT"); lineItem.setEntityStatus("ENTITY_STATUS_DRAFT"); // Create and set the line item flight. LineItemFlight lineItemFlight = new LineItemFlight(); lineItemFlight .setFlightDateType("LINE_ITEM_FLIGHT_DATE_TYPE_INHERITED"); lineItem.setFlight(lineItemFlight); // Create and set the line item budget. LineItemBudget lineItemBudget = new LineItemBudget(); lineItemBudget .setBudgetAllocationType("LINE_ITEM_BUDGET_ALLOCATION_TYPE_FIXED"); lineItem.setBudget(lineItemBudget); // Create and set the pacing setting. Pacing pacing = new Pacing(); pacing.setPacingPeriod("PACING_PERIOD_DAILY"); pacing.setPacingType("PACING_TYPE_EVEN"); pacing.setDailyMaxMicros(10000L); lineItem.setPacing(pacing); // Create and set the frequency cap. FrequencyCap frequencyCap = new FrequencyCap(); frequencyCap.setTimeUnit("TIME_UNIT_DAYS"); frequencyCap.setTimeUnitCount(1); frequencyCap.setMaxImpressions(10); lineItem.setFrequencyCap(frequencyCap); // Create and set the partner revenue model. PartnerRevenueModel partnerRevenueModel = new PartnerRevenueModel(); partnerRevenueModel .setMarkupType("PARTNER_REVENUE_MODEL_MARKUP_TYPE_CPM"); partnerRevenueModel.setMarkupAmount(10L); lineItem.setPartnerRevenueModel(partnerRevenueModel); // Set the list of IDs of the creatives associated with the line item. lineItem.setCreativeIds(creative-ids); // Create and set the bidding strategy. BiddingStrategy biddingStrategy = new BiddingStrategy(); biddingStrategy .setFixedBid(new FixedBidStrategy().setBidAmountMicros(100000L)); lineItem.setBidStrategy(biddingStrategy); // Configure the create request. LineItems.Create request = service.advertisers().lineItems().create(advertiser-id, lineItem); // Create the line item. LineItem response = request.execute(); // Display the new line item. System.out.printf("LineItem %s was created.", response.getName());
Python
# Create an line item object. line_item_obj = { 'insertionOrderId' : insertion-order-id, 'displayName': display-name, 'lineItemType': 'LINE_ITEM_TYPE_DISPLAY_DEFAULT', 'entityStatus': 'ENTITY_STATUS_DRAFT', 'flight': { 'flightDateType': 'LINE_ITEM_FLIGHT_DATE_TYPE_INHERITED' }, 'budget': { 'budgetAllocationType': 'LINE_ITEM_BUDGET_ALLOCATION_TYPE_FIXED' }, 'pacing': { 'pacingPeriod': 'PACING_PERIOD_DAILY', 'pacingType': 'PACING_TYPE_EVEN', 'dailyMaxMicros': 10000 }, 'frequencyCap': { 'timeUnit': 'TIME_UNIT_DAYS', 'timeUnitCount': 1, 'maxImpressions': 10 }, 'partnerRevenueModel': { 'markupType': 'PARTNER_REVENUE_MODEL_MARKUP_TYPE_CPM', 'markupAmount': 10 }, 'creativeIds': creative-ids, 'bidStrategy': { 'fixedBid': { 'bidAmountMicros': 100000 } } } # Create the line item. lineItem = service.advertisers().lineItems().create( advertiserId=advertiser-id, body=line_item_obj ).execute() # Display the new line item. print("Line Item %s was created." % lineItem["name"])
PHP
// Create a line item object. $lineItem = new Google_Service_DisplayVideo_LineItem(); $lineItem->setInsertionOrderId(insertion-order-id); $lineItem->setDisplayName(display-name); $lineItem->setLineItemType('LINE_ITEM_TYPE_DISPLAY_DEFAULT'); $lineItem->setEntityStatus('ENTITY_STATUS_DRAFT'); // Create and set the line item flight. $flight = new Google_Service_DisplayVideo_LineItemFlight(); $flight->setFlightDateType('LINE_ITEM_FLIGHT_DATE_TYPE_INHERITED'); $lineItem->setFlight($flight); // Create and set the line item budget. $budget = new Google_Service_DisplayVideo_LineItemBudget(); $budget->setBudgetAllocationType( 'LINE_ITEM_BUDGET_ALLOCATION_TYPE_FIXED' ); $lineItem->setBudget($budget); // Create and set the pacing setting. $pacing = new Google_Service_DisplayVideo_Pacing(); $pacing->setPacingPeriod('PACING_PERIOD_DAILY'); $pacing->setPacingType('PACING_TYPE_EVEN'); $pacing->setDailyMaxMicros(10000); $lineItem->setPacing($pacing); // Create and set the frequency cap. $frequencyCap = new Google_Service_DisplayVideo_FrequencyCap(); $frequencyCap->setMaxImpressions(10); $frequencyCap->setTimeUnit('TIME_UNIT_DAYS'); $frequencyCap->setTimeUnitCount(1); $lineItem->setFrequencyCap($frequencyCap); // Create and set the partner revenue model. $partnerRevenueModel = new Google_Service_DisplayVideo_PartnerRevenueModel(); $partnerRevenueModel->setMarkupType( 'PARTNER_REVENUE_MODEL_MARKUP_TYPE_CPM' ); $partnerRevenueModel->setMarkupAmount(10); $lineItem->setPartnerRevenueModel($partnerRevenueModel); // Set the list of IDs of the creatives associated with the line item. lineItem >setCreativeIds(creative-ids); // Create and set the bidding strategy. $biddingStrategy = new Google_Service_DisplayVideo_BiddingStrategy(); $fixedBidStrategy = new Google_Service_DisplayVideo_FixedBidStrategy(); $fixedBidStrategy->setBidAmountMicros(100000); $biddingStrategy->setFixedBid($fixedBidStrategy); $lineItem->setBidStrategy($biddingStrategy); // Create the line item. $result = $this->service->advertisers_lineItems->create( advertiser-id, $lineItem ); printf('Line Item %s was created.\n', $result['name']);
기본 광고 항목 생성
광고 항목은 기본 구성으로 생성할 수 있습니다.
지정된 LineItemType
및 기존
상위 게재 신청서 구성을 확인할 수 있습니다. 표준 API 라인과 달리
기본 광고 항목에
UI에서 발생하는 것과 비슷하게 상위 게재 신청서가 생성됩니다.
게재 신청서를 사용하여 관리
AssignedTargetingOptions
서비스
다음은 기본 광고 항목을 생성하는 방법의 예입니다.
자바
// Create a default line item generation request. GenerateDefaultLineItemRequest defaultLineItemRequest = new GenerateDefaultLineItemRequest(); defaultLineItemRequest.setInsertionOrderId(insertion-order-id); defaultLineItemRequest.setDisplayName(display-name); defaultLineItemRequest.setLineItemType("LINE_ITEM_TYPE_DISPLAY_DEFAULT"); // Configure the request. LineItems.GenerateDefault request = service .advertisers() .lineItems() .generateDefault(advertiser-id, defaultLineItemRequest); // Generate the default line item. LineItem response = request.execute(); // Display the new line item. System.out.printf("LineItem %s was created.", response.getName());
Python
# Create a default line item generation request. default_li_request = { 'insertionOrderId' : insertion-order-id, 'displayName': display-name, 'lineItemType': 'LINE_ITEM_TYPE_DISPLAY_DEFAULT' } # Generate the default line item. line_item = service.advertisers().lineItems().generateDefault( advertiserId=advertiser-id, body=default_li_request ).execute() # Display the new line item. print("Line Item %s was created." % lineItem["name"])
PHP
// Create a default line item generation request. $defaultLineItemRequest = new Google_Service_DisplayVideo_GenerateDefaultLineItemRequest(); $defaultLineItemRequest->setInsertionOrderId(insertion-order-id); $defaultLineItemRequest->setDisplayName(display-name); $defaultLineItemRequest->setLineItemType('LINE_ITEM_TYPE_DISPLAY_DEFAULT'); // Generate the default line item. $result = $this->service->advertisers_lineItems->generateDefault( advertiser-id, $defaultLineItemRequest ); // Display the new line item. printf('Line Item %s was created.\n', $result['name']);
광고 항목 중복
기존 광고 항목이 중복되어 새 광고 항목이 생성될 수 있음 기존 광고 항목과 동일한 구성 및 타겟팅 설정으로 생성할 수 있습니다
다음은 기존 광고 항목을 복제하는 방법의 예입니다.
자바
// Create the duplicate line item request body. DuplicateLineItemRequest requestBody = new DuplicateLineItemRequest(); requestBody.setTargetDisplayName(target-display-name); // Configure the request. LineItems.Duplicate request = service.advertisers().lineItems() .duplicate(advertiser-id, line-item-id, requestBody); // Duplicate the line item. DuplicateLineItemResponse response = request.execute(); // Display the line item ID of the new duplicate line item. System.out.printf("A duplicate line item with the ID %s was created.", response.getDuplicateLineItemId());
Python
# Create the duplicate line item request body. duplicate_request = { 'targetDisplayName': target-display-name } # Duplicate the line item. response = service.advertisers().lineItems().duplicate( advertiserId=advertiser-id, lineItemId=line-item-id, body=duplicate_request ).execute() # Display the line item ID of the new duplicate line item. print("A duplicate line item with the ID %s was created." % response["duplicateLineItemId"])
PHP
// Create the duplicate line item request body. $requestBody = new Google_Service_DisplayVideo_DuplicateLineItemRequest(); $requestBody->setTargetDisplayName(target-display-name); // Call the API, duplicating the line item. $response = $service ->advertisers_lineItems ->duplicate( advertiser-id, line-item-id, $requestBody ); // Display the line item ID of the new duplicate line item. printf( 'A duplicate line item with the ID %s was created.', $response->getDuplicateLineItemId() );