제외 지역
캠페인에 제외 위치 추가
function excludeTennessee(campaignName) {
const campaignIterator = AdsApp.campaigns()
.withCondition(`campaign.name = "${campaignName}"`)
.get();
if (!campaignIterator.hasNext()) {
throw new Error(`No campaign with name "${campaignName}" found`);
}
const campaign = campaignIterator.next();
// Exclude Tennessee, United States (location id = 21175) See
// https://developers.google.com/google-ads/api/reference/data/geotargets
// for list of all supported geo codes.
// You could pass either the location code, or a TargetedLocation or
// ExcludedLocation object from an existing campaign.
const tennesseeId = 21175;
campaign.excludeLocation(tennesseeId);
}
캠페인에서 제외 위치 가져오기
function getExcludedLocations(campaignName) {
const campaignIterator = AdsApp.campaigns()
.withCondition(`campaign.name = "${campaignName}"`)
.get();
if (!campaignIterator.hasNext()) {
throw new Error(`No campaign with name "${campaignName}" found`);
}
const campaign = campaignIterator.next();
return campaign.targeting().excludedLocations().get();
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-09-11(UTC)
[null,null,["최종 업데이트: 2024-09-11(UTC)"],[[["This script demonstrates how to add or retrieve excluded locations for Google Ads campaigns using the Google Ads scripts."],["`excludeTennessee` function adds Tennessee as an excluded location for a specific campaign by its name."],["`getExcludedLocations` function retrieves and returns all excluded locations for a given campaign."],["Both functions utilize campaign iterators to locate the target campaign and leverage campaign targeting methods to manage excluded locations."]]],[]]