조건이 Type = RESPONSIVE_DISPLAY_AD
인 광고 반복자를 만들면
하고 있습니다. 이 조건은 지원 중단되었습니다. Type = LEGACY_RESPONSIVE_DISPLAY_AD
를 명시적으로 사용하도록 기존 코드를 업데이트하세요. 여러 텍스트, 이미지, 동영상 확장 소재를 지원하는 광고에 광고 반복자를 만들려면 Type = MULTI_ASSET_RESPONSIVE_DISPLAY_AD
조건을 사용하세요.
다음 스니펫은 API 간의 몇 가지 차이점과 유사점을 보여줍니다. 비교해 보겠습니다. 자세한 내용은 반응형 디스플레이 광고 참조를 참고하세요.
// let legacyRdaIterator = AdsApp.ads().withCondition("Type = RESPONSIVE_DISPLAY_AD").get();
let legacyRdaIterator = AdsApp.ads().withCondition("Type = LEGACY_RESPONSIVE_DISPLAY_AD").get();
while (legacyRdaIterator.hasNext()) {
let responsiveDisplayAd = legacyRdaIterator.next().asType().responsiveDisplayAd();
// Legacy responsive display ads have just one long headline.
let longHeadline = responsiveDisplayAd.getLongHeadline();
// And they have one short headline, too.
let shortHeadline = responsiveDisplayAd.getShortHeadline();
// This call to .getHeadlines() returns null, because the method is not
// meaningful when called on a legacy responsive display ad.
assert(responsiveDisplayAd.getHeadlines() === null);
// ... etc. ...
}
let rdaIterator = AdsApp.ads().withCondition("Type = MULTI_ASSET_RESPONSIVE_DISPLAY_AD").get();
while (rdaIterator.hasNext()) {
let responsiveDisplayAd = rdaIterator.next().asType().responsiveDisplayAd();
// Responsive display ads have just one long headline.
let longHeadline = responsiveDisplayAd.getLongHeadline();
// But they can have multiple short headline text assets.
let shortHeadlineAssets = responsiveDisplayAd.getHeadlines();
// This call to .getShortHeadline() returns null, because the method is only
// meaningful when called on a legacy responsive display ad.
assert(responsiveDisplayAd.getShortHeadline() === null);
// ... etc. ...
}
let rdaAndLegacyIterator = AdsApp.ads().withCondition("Type IN [LEGACY_RESPONSIVE_DISPLAY_AD, MULTI_ASSET_RESPONSIVE_DISPLAY_AD]").get();
while (rdaAndLegacyIterator.hasNext()) {
let responsiveDisplayAd = legacyRdaIterator.next().asType().responsiveDisplayAd();
let longHeadline = responsiveDisplayAd.getLongHeadline();
// The .isLegacy() method can be used to differentiate between responsive
// display ad types within an iterator over both.
if (responsiveDisplayAd.isLegacy()) {
let shortHeadline = responsiveDisplayAd.getShortHeadline();
// ... etc. ...
} else {
let shortHeadlineAssets = responsiveDisplayAd.getHeadlines();
// ... etc. ...
}
}