ID
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
대부분의 Google Ads 항목은 식별자를 반환하는 getId()
메서드를 노출합니다. 대부분의 경우 ID가 꼭 필요한 것은 아니지만 다음과 같은 경우에는 ID가 유용할 수 있습니다.
- 보고서 작업
- ID는 보고서 행을 실제 Google Ads 항목에 연결하는 좋은 방법입니다.
- 외부 데이터 저장소와 매핑을 유지 관리하는 경우
- 자체 데이터베이스에 ID 기반 정보가 이미 저장되어 있을 수 있습니다.
- 성능 향상을 꾀하는 경우
ID를 사용하여 가져오는 것이 다른 방법보다 빠른 경우가 많습니다. 단일 항목을 가져오는 코드도 조금 더 쉽습니다.
let campaigns = AdsApp.campaigns()
.withIds([678678])
.get();
// vs.
let campaigns = AdsApp.campaigns()
.withCondition("Name='My Campaign'")
.get();
고유성
캠페인 ID와 광고 그룹 ID는 고유합니다. 두 캠페인 또는 광고 그룹이 동일한 ID를 공유할 수 없습니다. 그러나 광고와 키워드에는 복합 ID가 있습니다. 키워드의 고유 식별자는 광고 그룹 ID와 키워드 ID의 조합입니다.
마찬가지로 광고의 고유 식별자는 광고 그룹 ID와 광고 ID의 조합입니다. 이는 selector.withIds()
가 호출되는 방식에 영향을 미칩니다.
캠페인 및 광고 그룹의 경우 selector.withIds()
는 숫자 배열을 예상합니다.
let ids = [123123, 234234, 345345];
let campaignSelector = AdsApp.campaigns().withIds(ids);
그러나 광고 및 키워드의 경우 selector.withIds()
에는 두 요소 배열의 배열이 필요하며 첫 번째 요소는 광고 그룹 ID입니다. 다음 스니펫은 광고 그룹에서 세 개의 키워드를 검색합니다.
let adGroupId = 123123;
let keywordSelector = AdsApp.keywords().withIds([
[adGroupId, 234234],
[adGroupId, 345345],
[adGroupId, 456456]
]);
광고를 가져올 때도 동일한 구성이 적용됩니다.
달리 명시되지 않는 한 이 페이지의 콘텐츠에는 Creative Commons Attribution 4.0 라이선스에 따라 라이선스가 부여되며, 코드 샘플에는 Apache 2.0 라이선스에 따라 라이선스가 부여됩니다. 자세한 내용은 Google Developers 사이트 정책을 참조하세요. 자바는 Oracle 및/또는 Oracle 계열사의 등록 상표입니다.
최종 업데이트: 2025-03-29(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"]],["최종 업데이트: 2025-03-29(UTC)"],[[["Most Google Ads entities have a `getId()` method, which returns a unique identifier that can be useful for linking data, improving performance, and referencing external databases."],["When working with reports, IDs can connect report rows to specific Google Ads entities."],["Fetching entities by ID is often faster than using other methods like filtering by name."],["Campaign and ad group IDs are unique, while ad and keyword IDs are composite, requiring both the ad group ID and their individual ID for unique identification."],["The `selector.withIds()` method is used to fetch entities by ID, taking an array of numbers for campaigns and ad groups and an array of two-element arrays (ad group ID and entity ID) for ads and keywords."]]],[]]