디스플레이
    
    
      
    
    
      
      컬렉션을 사용해 정리하기
    
    
      
      내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
    
  
  
      
    
  
  
  
  
  
    
  
  
    
    
    
기존 광고그룹에 게재위치 추가
function addPlacementToAdGroup(adGroupName, url, cpc) {
  const adGroups = AdsApp.adGroups()
      .withCondition(`ad_group.name = '${adGroupName}'`)
      .get();
  if (!adGroups.hasNext()) {
    throw new Error(`No ad group with the name '${adGroupName}' was found.`);
  }
  const adGroup = adGroups.next();
  if (adGroups.totalNumEntities() > 1) {
    console.warn(`Found ${adGroups.totalNumEntities()} ad groups with the ` +
      `name '${adGroupName}'. Adding placement to the ad group in campaign ` +
      `'${adGroup.getCampaign().getName()}'.`);
  }
  // Other display criteria can be built in a similar manner using the
  // corresponding builder method in the AdsApp.CampaignDisplay or
  // AdsApp.AdGroupDisplay class.
  const placementBuilder = adGroup.display()
      .newPlacementBuilder()
      .withUrl(url);  // required
  if (cpc) {
    placementBuilder.withCpc(cpc); // optional
  }
  const operation = placementBuilder.build();
  if (operation.getStatus() == 'SUCCESS') {
    const placement = operation.getResult();
    console.log(`Placement with id = ${placement.getId()} and url = ${placement.getUrl()} was created.`);
  } else {
    console.warn(`Failed to create placement. Errors = ${operation.getErrors().join(', ')}`);
  }
}
기존 광고그룹에 있는 주제 모두 가져오기
function getAllTopics(campaignName, adGroupName) {
  return AdsApp.display()
      .topics()
      .withCondition(`campaign.name = '${campaignName}'`)
      .withCondition(`ad_group.name = '${adGroupName}'`);
}
기존 광고그룹의 모든 잠재고객에 대한 통계 기록
function logAudienceStats(campaignName, adGroupName, dateRange = 'LAST_MONTH') {
  // Other display criteria can be retrieved in a similar manner using
  // the corresponding selector methods in the AdsApp.Display,
  // AdsApp.CampaignDisplay or AdsApp.AdGroupDisplay class.
  const audienceIterator = AdsApp.display()
      .audiences()
      .withCondition(`campaign.name = '${campaignName}'`)
      .withCondition(`ad_group.name = '${adGroupName}'`)
      .get();
  console.log('ID, Audience ID, Clicks, Impressions, Cost');
  for (const audience of audienceIterator) {
    const stats = audience.getStatsFor(dateRange);
    // User List IDs (List IDs) are available on the details page of
    // a User List (found under the Audiences section of the Shared
    // Library)
    console.log(`${audience.getId().toFixed(0)}, ${audience.getAudienceId()}, `
        + `${stats.getClicks()}, ${stats.getImpressions()}, ${stats.getCost()}`);
  }
}
  
  
  
  
    
  
 
  
    
    
      
       
    
    
  
  
  달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
  최종 업데이트: 2025-08-21(UTC)
  
  
  
    
      [null,null,["최종 업데이트: 2025-08-21(UTC)"],[],[]]