このガイドでは、プロポーザル広告申込情報の概要と、API を使って ProposalLineItem オブジェクトを作成する手順について説明します。 説明中では、必須フィールドと、Proposal オブジェクトの下にプロポーザル広告申込情報を作成した後に行う手順も紹介します。
はじめに
まずはプロポーザル広告申込情報について確認しましょう。DFP セールス マネージャの管理画面には、Product オブジェクトのカタログが表示されます。これは、使用可能な汎用テンプレート、または事前定義のターゲティングを表すオブジェクトです。Product オブジェクトは RateCard オブジェクトと既に関連付けられています。RateCard オブジェクトにより、PremiumRate オブジェクトを価格設定に適用できます。請求と配信に関するその他の必須フィールドに入力していくと、ProposalLineItem
オブジェクトを効率的に作成できます。これは、DFP での入稿段階前の広告申込情報オブジェクトを表す Proposal
オブジェクトの下位オブジェクトです。
API を使ってプロポーザル広告申込情報を作成する
API でプロポーザル広告申込情報を作成するには、次のオブジェクトが必要です。
Proposal
: プロポーザル広告申込情報を関連付けます。RateCard
: プロポーザル広告申込情報の価格を設定します。Product
: プロポーザル広告申込情報の基盤となります。
まず、ProposalLineItem
オブジェクトをローカルで作成して、名前を割り当てます。
Java
// Get the ProposalLineItemService. ProposalLineItemServiceInterface proposalLineItemService = dfpServices.get(session, ProposalLineItemServiceInterface.class); // Create a proposal line item. ProposalLineItem proposalLineItem = new ProposalLineItem(); proposalLineItem.setName("Proposal line item #" + new Random().nextInt(Integer.MAX_VALUE));
Python
# Initialize appropriate service. proposal_line_item_service = client.GetService( 'ProposalLineItemService', version='v201711') # Create a single proposal line item. proposal_line_item = { 'name': 'Proposal line item #%s' % uuid.uuid4(), ...
PHP
$proposalLineItemService = $dfpServices->get($session, ProposalLineItemService::class); // Create a standard proposal line item. $proposalLineItem = new ProposalLineItem(); $proposalLineItem->setName('Proposal line item #' . uniqid()); $proposalLineItem->setLineItemType(LineItemType::STANDARD);
C#
using (ProposalLineItemService proposalLineItemService = (ProposalLineItemService) user.GetService(DfpService.v201711.ProposalLineItemService)) // Create a proposal line item. ProposalLineItem proposalLineItem = new ProposalLineItem(); proposalLineItem.name = "Proposal line item #" + new Random().Next(int.MaxValue);
プロポーザル広告申込情報をローカルで作成したら、それをプロポーザルに関連付けて、商品とレート表を設定できます。商品からはターゲティングを継承し、レート表からは価格を継承します。
Java
proposalLineItem.setProposalId(proposalId); proposalLineItem.setRateCardId(rateCardId); proposalLineItem.setProductId(productId); proposalLineItem.setTargeting(targeting);
Python
... 'rateCardId': rate_card_id, 'productId': product_id, 'proposalId': proposal_id, ...
PHP
$proposalLineItem->setProposalId($proposalId); $proposalLineItem->setRateCardId($rateCardId); $proposalLineItem->setProductId($productId);
C#
proposalLineItem.proposalId = proposalId; proposalLineItem.rateCardId = rateCardId; proposalLineItem.productId = productId; proposalLineItem.targeting = targeting;
プロポーザル広告申込情報では、LineItem オブジェクトと同じ方法でターゲティングのフィールドがサポートされます。同様に、InventoryTargeting オブジェクトが少なくとも 1 つ必要です。このケースでは、ネットワークのルート広告ユニットをターゲットに設定することで、ネットワーク掲載のプロポーザル広告申込情報が作成されます。
Java
// Get the NetworkService. NetworkServiceInterface networkService = dfpServices.get(session, NetworkServiceInterface.class); // Get the root ad unit ID used to target the whole site. String rootAdUnitId = networkService.getCurrentNetwork().getEffectiveRootAdUnitId(); // Create inventory targeting. InventoryTargeting inventoryTargeting = new InventoryTargeting(); // Create ad unit targeting for the root ad unit (i.e. the whole network). AdUnitTargeting adUnitTargeting = new AdUnitTargeting(); adUnitTargeting.setAdUnitId(rootAdUnitId); adUnitTargeting.setIncludeDescendants(true); inventoryTargeting.setTargetedAdUnits(new AdUnitTargeting[] {adUnitTargeting}); // Create targeting. Targeting targeting = new Targeting(); targeting.setInventoryTargeting(inventoryTargeting);
Python
... 'targeting': { 'inventoryTargeting': { 'targetedAdUnits': { 'adUnitId': root_ad_unit_id } } }, ...
PHP
// Create ad unit targeting for the root ad unit (i.e. the whole network). $rootAdUnitId = $networkService->getCurrentNetwork() ->getEffectiveRootAdUnitId(); $inventoryTargeting = new InventoryTargeting(); $adUnitTargeting = new AdUnitTargeting(); $adUnitTargeting->setAdUnitId($rootAdUnitId); $adUnitTargeting->setIncludeDescendants(true); $inventoryTargeting->setTargetedAdUnits([$adUnitTargeting]); $targeting = new Targeting(); $targeting->setInventoryTargeting($inventoryTargeting); $proposalLineItem->setTargeting($targeting);
C#
// Get the root ad unit ID used to target the whole site. String rootAdUnitId = networkService.getCurrentNetwork().effectiveRootAdUnitId; // Create inventory targeting. InventoryTargeting inventoryTargeting = new InventoryTargeting(); // Create ad unit targeting for the root ad unit (i.e. the whole network). AdUnitTargeting adUnitTargeting = new AdUnitTargeting(); adUnitTargeting.adUnitId = rootAdUnitId; adUnitTargeting.includeDescendants = true; inventoryTargeting.targetedAdUnits = new AdUnitTargeting[] { adUnitTargeting }; // Create targeting. Targeting targeting = new Targeting(); targeting.inventoryTargeting = inventoryTargeting;
必須の InventoryTargeting
オブジェクトを追加した後は、配信する調査広告申込情報の開始日と終了日、Goal オブジェクトに設定した配信情報を指定する必要があります。
Java
// Set the length of the proposal line item to run. proposalLineItem.setStartDateTime(DateTimes.toDateTime(Instant.now(), "America/New_York")); proposalLineItem.setEndDateTime( DateTimes.toDateTime(Instant.now().plus(Duration.standardDays(30L)), "America/New_York")); // Set pricing for the proposal line item for 1000 impressions at a CPM of $2 // for a total value of $2. Goal goal = new Goal(); goal.setUnits(1000L); goal.setUnitType(UnitType.IMPRESSIONS); proposalLineItem.setGoal(goal); proposalLineItem.setNetCost(new Money("USD", 2000000L)); proposalLineItem.setNetRate(new Money("USD", 2000000L)); proposalLineItem.setRateType(RateType.CPM); // Set delivery specifications for the proposal line item. proposalLineItem.setDeliveryRateType(DeliveryRateType.EVENLY); proposalLineItem.setCreativeRotationType(CreativeRotationType.OPTIMIZED);
Python
... 'startDateTime': start_datetime, 'endDateTime': end_datetime, 'goal': { 'units': '1000', 'unitType': 'IMPRESSIONS', }, 'netCost': { 'currencyCode': 'USD', 'microAmount': '2000000' }, 'netRate': { 'currencyCode': 'USD', 'microAmount': '2000000' }, 'rateType': 'CPM', 'deliveryRateType': 'EVENLY', 'creativeRotationType': 'OPTIMIZED', ...
PHP
// Set the length of the proposal line item to run. $proposalLineItem->setStartDateTime( DfpDateTimes::fromDateTime( new DateTime('now', new DateTimeZone('America/New_York')) ) ); $proposalLineItem->setEndDateTime( DfpDateTimes::fromDateTime( new DateTime('+1 month', new DateTimeZone('America/New_York')) ) ); // Set pricing for the proposal line item for 1000 impressions at a CPM of // $2 for a total value of $2. $goal = new Goal(); $goal->setUnits(1000); $goal->setUnitType(UnitType::IMPRESSIONS); $proposalLineItem->setGoal($goal); $proposalLineItem->setNetCost(new Money('USD', 2000000)); $proposalLineItem->setNetRate(new Money('USD', 2000000)); $proposalLineItem->setRateType(RateType::CPM); // Set delivery specifications for the proposal line item. $proposalLineItem->setDeliveryRateType(DeliveryRateType::EVENLY); $proposalLineItem->setCreativeRotationType(CreativeRotationType::OPTIMIZED);
C#
// Set the length of the proposal line item to run. proposalLineItem.startDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Now.AddDays(7), "America/New_York"); proposalLineItem.endDateTime = DateTimeUtilities.FromDateTime(System.DateTime.Now.AddDays(30), "America/New_York"); // Set pricing for the proposal line item for 1000 impressions at a CPM of $2 // for a total value of $2. proposalLineItem.goal = new Goal() { unitType = UnitType.IMPRESSIONS, units = 1000L }; proposalLineItem.netCost = new Money() { currencyCode = "USD", microAmount = 2000000L }; proposalLineItem.netRate = new Money() { currencyCode = "USD", microAmount = 2000000L }; proposalLineItem.rateType = RateType.CPM; // Set delivery specifications for the proposal line item. proposalLineItem.deliveryRateType = DeliveryRateType.EVENLY; proposalLineItem.creativeRotationType = CreativeRotationType.OPTIMIZED;
プロポーザル広告申込情報では、通常はプロポーザルから継承される請求情報をオーバーライドすることもできます。Proposal オブジェクトで設定可能な、同じ BillingCap、BillingSource、BillingSchedule のフィールドを設定できます。
Java
// Set billing specifications for the proposal line item. proposalLineItem.setBillingCap(BillingCap.CAPPED_CUMULATIVE); proposalLineItem.setBillingSource(BillingSource.THIRD_PARTY_VOLUME);
Python
... 'billingCap': 'CAPPED_CUMULATIVE', 'billingSource': 'THIRD_PARTY_VOLUME', ...
PHP
// Set billing specifications for the proposal line item. $proposalLineItem->setBillingCap(BillingCap::CAPPED_CUMULATIVE); $proposalLineItem->setBillingSource(BillingSource::THIRD_PARTY_VOLUME);
C#
// Set billing specifications for the proposal line item. proposalLineItem.billingCap = BillingCap.CAPPED_CUMULATIVE; proposalLineItem.billingSource = BillingSource.THIRD_PARTY_VOLUME;
これらのフィールドを設定した後、createProposalLineItems を ProposalLineItem
オブジェクトの配列に対して呼び出すと、新しいプロポーザル広告申込情報が作成されます。
Java
// Create the proposal line item on the server. ProposalLineItem[] proposalLineItems = proposalLineItemService.createProposalLineItems( new ProposalLineItem[] {proposalLineItem});
Python
# Add proposal line items. proposal_line_items = proposal_line_item_service.createProposalLineItems( [proposal_line_item])
PHP
// Create the proposal line items on the server. $results = $proposalLineItemService->createProposalLineItems([$proposalLineItem]);
C#
// Create the proposal line item on the server. ProposalLineItem[] proposalLineItems = proposalLineItemService.createProposalLineItems( new ProposalLineItem[] { proposalLineItem });
次のステップ
- プロポーザルを承認に向けて送信する
- WorkflowConditionRequests を承認する