키워드
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
기존 광고그룹에서 키워드 만들기
function createHatsKeyword() {
// This example snippet creates a broad match keyword for "hats". Keywords
// can be created with many optional settings, such as a max CPC bid, tracking
// URL templates, and more. Please customize this example for your specific
// use case. For more details about keyword builder options, see
// https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_keywordbuilder.
const adGroupName = 'Ad group 1';
const adGroupIterator = AdsApp.adGroups()
.withCondition(`ad_group.name = "${adGroupName}"`)
.get();
if (!adGroupIterator.hasNext()) {
throw new Error(`No ad group found with name "${adGroupName}"`);
}
const adGroup = adGroupIterator.next();
if (adGroupIterator.totalNumEntities() > 1) {
console.warn(`Multiple ad groups named "${adGroupName}" found.
Using the one from campaign "${adGroup.getCampaign().getName()}".`);
}
const keywordOperation = adGroup.newKeywordBuilder()
.withText('hats')
.withCpc(1.25)
.withFinalUrl('https://www.example.com')
.build();
return keywordOperation;
}
광고그룹에 있는 기존 키워드 일시중지
function pauseKeywordInAdGroup(keywordText, adGroupName) {
const adGroupIterator = AdsApp.adGroups()
.withCondition(`ad_group.name = "${adGroupName}"`)
.get();
if (!adGroupIterator.hasNext()) {
throw new Error(`No ad group found with name "${adGroupName}"`);
}
const adGroup = adGroupIterator.next();
if (adGroupIterator.totalNumEntities() > 1) {
console.warn(`Multiple ad groups named "${adGroupName}" found.
Using the one from campaign "${adGroup.getCampaign().getName()}".`);
}
for (const keyword of adGroup.keywords().withCondition(
`ad_group_criterion.keyword.text = "${keywordText}"`)) {
keyword.pause();
}
}
광고그룹에 있는 모든 키워드 가져오기
function getKeywordsInAdGroup(adGroupName) {
const keywordIterator = AdsApp.keywords()
.withCondition(`ad_group.name = "${adGroupName}"`)
.get();
console.log(`Ad Group "${adGroupName}" has ${
keywordIterator.totalNumEntities()} keywords`);
return keywordIterator;
}
광고그룹의 모든 키워드에 대한 통계 기록
function logKeywordStatsForAdGroup() {
// This example snippet prints click and impression statistics to the script
// execution log. Please customize this example for your specific use case.
// For all the kinds of statistics that can be logged, see
// https://developers.google.com/google-ads/scripts/docs/reference/adsapp/adsapp_stats.
const adGroupName = 'Ad group 1';
const adGroupIterator = AdsApp.adGroups()
.withCondition(`ad_group.name = "${adGroupName}"`)
.get();
if (!adGroupIterator.hasNext()) {
throw new Error(`No ad group found with name "${adGroupName}"`);
}
const adGroup = adGroupIterator.next();
if (adGroupIterator.totalNumEntities() > 1) {
console.warn(`Multiple ad groups named "${adGroupName}" found.
Using the one from campaign "${adGroup.getCampaign().getName()}".`);
}
for (const keyword of adGroup.keywords()) {
let stats = keyword.getStatsFor('LAST_MONTH');
console.log(`Ad Group: "${adGroup.getName()}"`);
console.log(`Keyword: "${keyword.getText()}"`);
console.log(`Clicks: ${stats.getClicks()}`);
console.log(`Impressions: ${stats.getImpressions()}`);
console.log('--------------------');
}
}
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2024-09-12(UTC)
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2024-09-12(UTC)"],[[["This webpage provides Google Ads Scripts examples for managing keywords within an ad group."],["You can use these scripts to create new keywords, specifying attributes like match type, bid, and final URL."],["The scripts also demonstrate how to pause existing keywords based on their text and ad group."],["You can retrieve and iterate through all keywords within a specific ad group using the provided functions."],["Examples for logging key performance statistics, such as clicks and impressions, for keywords in an ad group are included."]]],[]]