시작하기
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
다음 단계에 따라 첫 번째 스크립트를 실행하세요.
Google Ads 계정
- Google Ads 계정에 로그인합니다.
- 왼쪽 탐색의 도구 메뉴에서 일괄 작업, 스크립트를 차례로 선택합니다. Google Ads 검색창에서 '스크립트'를 검색하여 이 페이지로 이동할 수도 있습니다.
- + 아이콘
을 눌러 스크립트를 추가합니다. 드롭다운 메뉴에서 스크립트 템플릿을 찾아볼 수 있지만 이 연습에서는 '새 스크립트'를 선택합니다.
- '스크립트 이름' 텍스트 필드에 스크립트 이름을 입력할 수 있습니다(선택사항). 이렇게 하면 정리된 상태를 유지하고 스크립트의 기능을 기억하는 데 도움이 됩니다.
다음 코드를 복사하여 편집기 영역에 붙여넣고 기본 함수를 바꿉니다.
function main() {
// Get the campaign names from all the campaigns
const rows = AdsApp.search('SELECT campaign.name FROM campaign');
console.log('My campaigns:');
// Iterate through the campaigns and print the campaign names
for (const row of rows) {
console.log(row.campaign.name);
}
}
메시지가 표시되면 스크립트가 사용자를 대신하여 계정에 액세스할 수 있도록 승인을 클릭합니다. 각 스크립트에 대해 한 번씩 실행해야 합니다.
미리보기를 클릭하여 미리보기 모드로 스크립트를 실행합니다.
결과가 변경사항 / 로그 패널에 표시됩니다. 이 예에서는 로그에 캠페인 이름이 표시됩니다.
미리보기 결과가 만족스러우면 실행을 클릭하여 스크립트를 실행하고 스크립트 기록 페이지를 엽니다. 이 페이지에는 가장 최근에 실행된 스크립트가 상태 및 결과에 관한 정보와 함께 표시됩니다.
변경사항과 로그를 자세히 보려면 방금 실행한 스크립트에 해당하는 변경사항 열의 링크를 클릭합니다. 이전에 미리 본 것과 동일한 로그 출력이 표시됩니다.
관리자 계정
Google Ads 스크립트를 실행하려면 먼저 Google Ads 관리자 계정이 있어야 합니다.
- Google Ads 관리자 계정에 로그인합니다.
- 왼쪽 탐색의 도구 메뉴에서 일괄 작업, 스크립트를 차례로 선택합니다. Google Ads 검색창에서 '스크립트'를 검색하여 이 페이지로 이동할 수도 있습니다.
- + 아이콘
을 눌러 스크립트를 추가합니다. 드롭다운 메뉴에서 스크립트 템플릿을 찾아볼 수 있지만 이 연습에서는 '새 스크립트'를 선택합니다.
- '스크립트 이름' 텍스트 필드에 스크립트 이름을 입력할 수 있습니다(선택사항). 이렇게 하면 정리된 상태를 유지하고 스크립트의 기능을 기억하는 데 도움이 됩니다.
다음 코드를 복사하여 편집기 영역에 붙여넣고 기본 함수를 바꿉니다.
function main() {
// Retrieve all children accounts.
const accountIterator = AdsManagerApp.accounts().get();
// Iterate through the account list.
for (const account of accountIterator) {
// Get stats for the child account.
const stats = account.getStatsFor("THIS_MONTH");
// And log it.
console.log(`${account.getCustomerId()},${stats.getClicks()},` +
`${stats.getImpressions()},${stats.getCost()}`);
}
}
메시지가 표시되면 스크립트가 사용자를 대신하여 계정에 액세스할 수 있도록 승인을 클릭합니다. 각 스크립트에 대해 한 번씩 실행해야 합니다.
미리보기를 클릭하여 미리보기 모드로 스크립트를 실행합니다.
결과가 변경사항 / 로그 패널에 표시됩니다. 이 예에서는 하위 계정과 측정항목이 로그에 표시됩니다.
미리보기 결과가 만족스러우면 실행을 클릭하여 스크립트를 실행하고 스크립트 기록 페이지를 엽니다. 이 페이지에는 가장 최근에 실행된 스크립트가 상태 및 결과에 관한 정보와 함께 표시됩니다.
변경사항과 로그를 자세히 보려면 방금 실행한 스크립트에 해당하는 변경사항 열의 링크를 클릭합니다. 이전에 미리 본 것과 동일한 로그 출력이 표시됩니다.
더 많은 샘플 스크립트 스니펫은 예시 페이지를 참고하세요.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-08-27(UTC)
[null,null,["최종 업데이트: 2025-08-27(UTC)"],[[["\u003cp\u003eLaunching your first Google Ads script involves signing in, navigating to the Scripts section, and adding a new script.\u003c/p\u003e\n"],["\u003cp\u003eYou need to copy and paste provided code snippets into the script editor to define its functionality, such as analyzing keywords or account statistics.\u003c/p\u003e\n"],["\u003cp\u003eAuthorization is necessary for the script to access your account data, and preview mode allows for testing before full execution.\u003c/p\u003e\n"],["\u003cp\u003eGoogle Ads manager accounts are required to run Ads Manager scripts, which can access and process data from multiple child accounts.\u003c/p\u003e\n"],["\u003cp\u003eMore script examples and resources are available on the Google Ads Scripts examples page for further exploration and customization.\u003c/p\u003e\n"]]],[],null,["# Get started\n\nFollow these steps to launch your first script. \n\n### Google Ads accounts\n\n1. [Sign in](//ads.google.com/) to your Google Ads account.\n2. From the Tools menu in the left navigation, select **Bulk actions** , then **Scripts**. You can also navigate to this page by searching for \"Scripts\" in the Google Ads search bar.\n3. Press the + icon to add a script. You can browse script templates from the drop-down menu, but for the sake of this exercise, select \"New script\".\n4. You can optionally provide a name for your script in the \"Script name\" text field. This can help you stay organized and remember what the script does.\n5. Copy and paste the following code into the editor area, replacing the main\n function:\n\n function main() {\n // Get the campaign names from all the campaigns\n const rows = AdsApp.search('SELECT campaign.name FROM campaign');\n\n console.log('My campaigns:');\n // Iterate through the campaigns and print the campaign names\n for (const row of rows) {\n console.log(row.campaign.name);\n }\n }\n\n6. When prompted, click **Authorize** so the script can access the account on\n your behalf. This has to be done once for each script.\n\n7. Click **Preview** to run the script in [preview mode](/google-ads/scripts/docs/concepts/preview).\n Results will appear in the **Changes** / **Logs** panel. For this example,\n you should see your campaign names displayed in the Logs.\n\n8. When you're happy with the preview results, click **Run** to run your\n script and open the **Script history** page. This page displays the\n most recently run scripts, with information on their status and results.\n\n9. To get a detailed view of changes and logs, click the link in the\n **Changes** column that corresponds to the script you just ran. You should\n see the same log output that was previewed before.\n\n### Manager accounts\n\nYou must first have a\n[Google Ads manager account](//support.google.com/google-ads/answer/6139186)\nto run Ads Manager scripts.\n\n1. [Sign in](//ads.google.com/) to your Google Ads manager account.\n2. From the Tools menu in the left navigation, select **Bulk actions** , then **Scripts**. You can also navigate to this page by searching for \"Scripts\" in the Google Ads search bar.\n3. Press the + icon to add a script. You can browse script templates from the drop-down menu, but for the sake of this exercise, select \"New script\".\n4. You can optionally provide a name for your script in the \"Script name\" text field. This can help you stay organized and remember what the script does.\n5. Copy and paste the following code into the editor area, replacing the main\n function:\n\n function main() {\n // Retrieve all children accounts.\n const accountIterator = AdsManagerApp.accounts().get();\n\n // Iterate through the account list.\n for (const account of accountIterator) {\n // Get stats for the child account.\n const stats = account.getStatsFor(\"THIS_MONTH\");\n // And log it.\n console.log(`${account.getCustomerId()},${stats.getClicks()},` +\n `${stats.getImpressions()},${stats.getCost()}`);\n }\n }\n\n6. When prompted, click **Authorize** so the script can access the account on\n your behalf. This has to be done once for each script.\n\n7. Click **Preview** to run the script in [preview mode](/google-ads/scripts/docs/concepts/preview).\n Results will appear in the **Changes** / **Logs** panel. For this example,\n you should see your children accounts and their metrics displayed in the\n Logs.\n\n8. When you're happy with the preview results, click **Run** to run your\n script and open the **Script history** page. This page displays the\n most recently run scripts, with information on their status and results.\n\n9. To get a detailed view of changes and logs, click the link in the\n **Changes** column that corresponds to the script you just ran. You should\n see the same log output that was previewed before.\n\nFor more sample script snippets, check out our\n[examples page](/google-ads/scripts/docs/examples)."]]