Create an advertiser

An advertiser represents a business that runs ad campaigns. Advertiser resources do the following:

  • Host general settings used by their child resources.
  • Enforce brand safety settings on all of the ads they serve.
  • Own the creatives that are used as the ads they serve.
  • Manage entities that are used in ad targeting. These include channels and location lists.

If you are using an existing advertiser, you can skip to Create a campaign .

Choose configurations

Before creating an advertiser, review and decide on these settings:

The Advertiser resource also has many optional fields. Read the reference documentation for more information.

How to create an advertiser

Here's how to create an advertiser:

Java

 // Provide the ID of the parent partner. 
 long 
  
 partnerId 
  
 = 
  
  partner 
 - 
 id 
 
 ; 
 // Provide the display name of the advertiser. 
 String 
  
 displayName 
  
 = 
  
  display 
 - 
 name 
 
 ; 
 // Provide the ID of the billing profile for the advertiser to use. 
 long 
  
 billingProfileId 
  
 = 
  
  billing 
 - 
 profile 
 - 
 id 
 
 ; 
 // Provide whether or not the advertiser will serve EU political ads. 
 String 
  
 containsEuPoliticalAds 
  
 = 
  
  contains 
 - 
 eu 
 - 
 political 
 - 
 ads 
 
 ; 
 // Provide the domain URL and currency code of the advertiser. 
 String 
  
 domainUrl 
  
 = 
  
 "http://www.google.com" 
 ; 
 String 
  
 currencyCode 
  
 = 
  
 "USD" 
 ; 
 // Create the advertiser structure. 
 Advertiser 
  
 advertiser 
  
 = 
  
 new 
  
 Advertiser 
 () 
  
 . 
 setPartnerId 
 ( 
 partnerId 
 ) 
  
 . 
 setDisplayName 
 ( 
 displayName 
 ) 
  
 . 
 setEntityStatus 
 ( 
 "ENTITY_STATUS_ACTIVE" 
 ) 
  
 . 
 setContainsEuPoliticalAds 
 ( 
 containsEuPoliticalAds 
 ); 
 // Create and set the advertiser general configuration. 
 AdvertiserGeneralConfig 
  
 advertiserGeneralConfig 
  
 = 
  
 new 
  
 AdvertiserGeneralConfig 
 (). 
 setDomainUrl 
 ( 
 domainUrl 
 ). 
 setCurrencyCode 
 ( 
 currencyCode 
 ); 
 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. 
 ThirdPartyOnlyConfig 
  
 thirdPartyOnlyConfig 
  
 = 
  
 new 
  
 ThirdPartyOnlyConfig 
 (); 
 advertiserAdServerConfig 
 . 
 setThirdPartyOnlyConfig 
 ( 
 thirdPartyOnlyConfig 
 ); 
 // Set the ad server configuration. 
 advertiser 
 . 
 setAdServerConfig 
 ( 
 advertiserAdServerConfig 
 ); 
 // Create and set the billing configuration. 
 AdvertiserBillingConfig 
  
 advertiserBillingConfig 
  
 = 
  
 new 
  
 AdvertiserBillingConfig 
 (); 
 advertiserBillingConfig 
 . 
 setBillingProfileId 
 ( 
 billingProfileId 
 ); 
 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 ID. 
 System 
 . 
 out 
 . 
 printf 
 ( 
 "Advertiser %s was created." 
 , 
  
 response 
 . 
 getName 
 ()); 

Python

 # Provide the ID of the parent partner. 
 partner_id 
 = 
  partner 
 - 
 id 
 
 # Provide the display name of the advertiser. 
 display_name 
 = 
  display 
 - 
 name 
 
 # Provide the domain URL and currency code of the advertiser. 
 domain_url 
 = 
 "http://www.google.com" 
 currency_code 
 = 
 "USD" 
 # Provide the ID of the billing profile for the advertiser to use. 
 billing_profile_id 
 = 
  billing 
 - 
 profile 
 - 
 id 
 
 # Provide whether or not the advertiser will serve EU political ads. 
 contains_eu_political_ads 
 = 
  contains 
 - 
 eu 
 - 
 political 
 - 
 ads 
 
 # Create the advertiser object. 
 advertiser_obj 
 = 
 { 
 "partnerId" 
 : 
 partner_id 
 , 
 "displayName" 
 : 
 display_name 
 , 
 "entityStatus" 
 : 
 "ENTITY_STATUS_ACTIVE" 
 , 
 "generalConfig" 
 : 
 { 
 "domainUrl" 
 : 
 domain_url 
 , 
 "currencyCode" 
 : 
 currency_code 
 }, 
 "adServerConfig" 
 : 
 { 
 "thirdPartyOnlyConfig" 
 : 
 {}}, 
 "creativeConfig" 
 : 
 {}, 
 "billingConfig" 
 : 
 { 
 "billingProfileId" 
 : 
 billing_profile_id 
 }, 
 "containsEuPoliticalAds" 
 : 
 contains_eu_political_ads 
 , 
 } 
 # Build and execute request. 
 response 
 = 
 service 
 . 
 advertisers 
 () 
 . 
 create 
 ( 
 body 
 = 
 advertiser_obj 
 ) 
 . 
 execute 
 () 
 # Print the new advertiser. 
 print 
 ( 
 f 
 "Advertiser 
 { 
 response 
 [ 
 'name' 
 ] 
 } 
 was created." 
 ) 

PHP

 // Provide the ID of the parent partner. 
 $partnerId = $values['partner_id']; 
 // Provide the display name of the advertiser. 
 $displayName = $values['display_name']; 
 // Provide the ID of the billing profile for the advertiser to use. 
 $billingProfileId = $values['billing_profile_id']; 
 // Provide whether or not the advertiser will serve EU political ads. 
 $containsEuPoliticalAds = $values['contains_eu_political_ads']; 
 // Provide the domain URL and currency code of the advertiser. 
 $domainUrl = "http://www.google.com"; 
 $currencyCode = "USD"; 
 // Create the advertiser structure. 
 $advertiser = new Google_Service_DisplayVideo_Advertiser(); 
 $advertiser->setPartnerId($partnerId); 
 $advertiser->setDisplayName($displayName); 
 $advertiser->setEntityStatus('ENTITY_STATUS_ACTIVE'); 
 $advertiser->setContainsEuPoliticalAds($containsEuPoliticalAds); 
 // Create and set the advertiser general configuration. 
 $generalConfig = 
 new Google_Service_DisplayVideo_AdvertiserGeneralConfig(); 
 $generalConfig->setDomainUrl($domainUrl); 
 $generalConfig->setCurrencyCode($currencyCode); 
 $advertiser->setGeneralConfig($generalConfig); 
 // Create and set the ad server configuration structure. 
 $adServerConfig = 
 new Google_Service_DisplayVideo_AdvertiserAdServerConfig(); 
 $adServerConfig->setThirdPartyOnlyConfig( 
 new Google_Service_DisplayVideo_ThirdPartyOnlyConfig() 
 ); 
 $advertiser->setAdServerConfig($adServerConfig); 
 // Create and set the creative configuration structure. 
 $advertiser->setCreativeConfig( 
 new Google_Service_DisplayVideo_AdvertiserCreativeConfig() 
 ); 
 // Create and set the billing configuration. 
 $billingConfig = new Google_Service_DisplayVideo_AdvertiserBillingConfig(); 
 $billingConfig->setBillingProfileId($billingProfileId); 
 $advertiser->setBillingConfig($billingConfig); 
 // Call the API, creating the advertiser. 
 try { 
 $result = $this->service->advertisers->create($advertiser); 
 } catch (\Exception $e) { 
 $this->renderError($e); 
 return; 
 } 
 // Print the new advertiser. 
 printf('<p>Advertiser %s was created.</p>', $result['name']); 
Create a Mobile Website
View Site in Mobile | Classic
Share by: