Create a Demand Gen line item

A Demand Gen line item serves ad groups and ads in multiple formats across Google's most impactful surfaces, including YouTube, Discover, Gmail, and the Google Display Network. Demand Gen line items, like other types of line items, are managed using LineItem resources and operate based on set budget, bid strategy, and targeting. There are also settings specific to Demand Gen line items available in the demandGenSettings field.

Demand Gen line items have child resources called ad groups. Ad groups provide another level of control under the individual line item.

Choose configurations

Before creating a Demand Gen line item, review and decide on relevant settings.

For Demand Gen line items:

The following fields are required for Demand Gen line items and operate the same as they would in other types of line items:

The LineItem resource also has many optional fields which may be set. Read the reference documentation for more information.

Create a line item

Here's how to create a Demand Gen line item with the following settings:

  • An inherited flight and a budget of $100.
  • A partner revenue model of 0.1% of total media cost.
  • A bid strategy that optimizes towards an average cost of $10 per conversion.
  • The preference for assigning location and language targeting directly to ad groups under the line item.

Python

 # Provide the ID of the parent advertiser. 
 advertiser_id 
 = 
  advertiser 
 - 
 id 
 
 # Provide the ID of the parent insertion order. 
 insertion_order_id 
 = 
  insertion 
 - 
 order 
 - 
 id 
 
 # Provide the display name of the line item. 
 display_name 
 = 
  display 
 - 
 video 
 
 # Provide the Floodlight activity ID to use for conversion tracking. 
 floodlight_activity_id 
 = 
  floodlight 
 - 
 activity 
 - 
 id 
 
 # Provide whether the line item will serve EU political ads. 
 contains_eu_political_ads 
 = 
  contains 
 - 
 eu 
 - 
 political 
 - 
 ads 
 
 # Create a line item object with example values. 
 line_item_obj 
 = 
 { 
 "insertionOrderId" 
 : 
 insertion_order_id 
 , 
 "displayName" 
 : 
 display_name 
 , 
 "lineItemType" 
 : 
 "LINE_ITEM_TYPE_DEMAND_GEN" 
 , 
 "entityStatus" 
 : 
 "ENTITY_STATUS_DRAFT" 
 , 
 "flight" 
 : 
 { 
 "flightDateType" 
 : 
 "LINE_ITEM_FLIGHT_DATE_TYPE_INHERITED" 
 }, 
 "budget" 
 : 
 { 
 "budgetAllocationType" 
 : 
 "LINE_ITEM_BUDGET_ALLOCATION_TYPE_FIXED" 
 , 
 "maxAmount" 
 : 
 100000000 
 }, 
 "pacing" 
 : 
 { 
 "pacingPeriod" 
 : 
 "PACING_PERIOD_FLIGHT" 
 , 
 "pacingType" 
 : 
 "PACING_TYPE_EVEN" 
 , 
 "dailyMaxMicros" 
 : 
 10000 
 , 
 }, 
 "partnerRevenueModel" 
 : 
 { 
 "markupType" 
 : 
 ( 
 "PARTNER_REVENUE_MODEL_MARKUP_TYPE_TOTAL_MEDIA_COST_MARKUP" 
 ), 
 "markupAmount" 
 : 
 100 
 , 
 }, 
 "bidStrategy" 
 : 
 { 
 "demandGenBid" 
 : 
 { 
 "type" 
 : 
 "DEMAND_GEN_BIDDING_STRATEGY_TYPE_TARGET_CPA" 
 , 
 "value" 
 : 
 "10000000" 
 } 
 }, 
 "conversionCounting" 
 : 
 { 
 "postViewCountPercentageMillis" 
 : 
 "100000" 
 , 
 "floodlightActivityConfigs" 
 : 
 [ 
 { 
 "floodlightActivityId" 
 : 
 floodlight_activity_id 
 , 
 "postClickLookbackWindowDays" 
 : 
 90 
 , 
 "postViewLookbackWindowDays" 
 : 
 90 
 } 
 ] 
 }, 
 "containsEuPoliticalAds" 
 : 
 contains_eu_political_ads 
 , 
 "demandGenSettings" 
 : 
 { 
 "geoLanguageTargetingEnabled" 
 : 
 False 
 } 
 } 
 # Build and execute request. 
 response 
 = 
 ( 
 service 
 . 
 advertisers 
 () 
 . 
 lineItems 
 () 
 . 
 create 
 ( 
 advertiserId 
 = 
 advertiser_id 
 , 
 body 
 = 
 line_item_obj 
 ) 
 . 
 execute 
 () 
 ) 
 # Display the new line item. 
 print 
 ( 
 f 
 "Demand Gen line Item 
 { 
 response 
 [ 
 'name' 
 ] 
 } 
 was created." 
 ) 
Create a Mobile Website
View Site in Mobile | Classic
Share by: