diff --git a/modules/appnexusAstBidAdapter.js b/modules/appnexusAstBidAdapter.js index 5e7ee0e0609..94a028f9868 100644 --- a/modules/appnexusAstBidAdapter.js +++ b/modules/appnexusAstBidAdapter.js @@ -211,8 +211,16 @@ function newBid(serverBid, rtbBid) { body: nativeAd.desc, cta: nativeAd.ctatext, sponsoredBy: nativeAd.sponsored, - image: nativeAd.main_img && nativeAd.main_img.url, - icon: nativeAd.icon && nativeAd.icon.url, + image: { + url: nativeAd.main_img && nativeAd.main_img.url, + height: nativeAd.main_img && nativeAd.main_img.height, + width: nativeAd.main_img && nativeAd.main_img.width, + }, + icon: { + url: nativeAd.icon && nativeAd.icon.url, + height: nativeAd.icon && nativeAd.icon.height, + width: nativeAd.icon && nativeAd.icon.width, + }, clickUrl: nativeAd.link.url, clickTrackers: nativeAd.link.click_trackers, impressionTrackers: nativeAd.impression_trackers, diff --git a/src/native.js b/src/native.js index c992cf9ad61..9c591aa539c 100644 --- a/src/native.js +++ b/src/native.js @@ -146,7 +146,13 @@ export function getNativeTargeting(bid) { Object.keys(bid['native']).forEach(asset => { const key = NATIVE_KEYS[asset]; - const value = bid['native'][asset]; + let value = bid['native'][asset]; + + // native image-type assets can be a string or an object with a url prop + if (typeof value === 'object' && value.url) { + value = value.url; + } + if (key) { keyValues[key] = value; } diff --git a/test/spec/modules/appnexusAstBidAdapter_spec.js b/test/spec/modules/appnexusAstBidAdapter_spec.js index bfd15710db4..660ecfc507a 100644 --- a/test/spec/modules/appnexusAstBidAdapter_spec.js +++ b/test/spec/modules/appnexusAstBidAdapter_spec.js @@ -422,7 +422,7 @@ describe('AppNexusAdapter', () => { expect(result[0].native.title).to.equal('Native Creative'); expect(result[0].native.body).to.equal('Cool description great stuff'); expect(result[0].native.cta).to.equal('Do it'); - expect(result[0].native.image).to.equal('http://cdn.adnxs.com/img.png'); + expect(result[0].native.image.url).to.equal('http://cdn.adnxs.com/img.png'); }); }); });