Skip to content

Commit

Permalink
Adding Remaining Native Parameters from AppNexus Native response (#3387)
Browse files Browse the repository at this point in the history
* Adding remaining missing parameters from AppNexus Native response

* Removed native video, renamed sale and clickLabel to RTB spec names

* drop video from tests
  • Loading branch information
aneuway2 authored and jsnellbaker committed Jan 8, 2019
1 parent 41af500 commit e9dea17
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 5 deletions.
13 changes: 11 additions & 2 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@ const NATIVE_MAPPING = {
minimumParams: { sizes: [{}] },
},
sponsoredBy: 'sponsored_by',
privacyLink: 'privacy_link'
privacyLink: 'privacy_link',
salePrice: 'saleprice',
displayUrl: 'displayurl'
};
const SOURCE = 'pbjs';

Expand Down Expand Up @@ -338,10 +340,17 @@ function newBid(serverBid, rtbBid, bidderRequest) {
rating: nativeAd.rating,
sponsoredBy: nativeAd.sponsored,
privacyLink: nativeAd.privacy_link,
address: nativeAd.address,
downloads: nativeAd.downloads,
likes: nativeAd.likes,
phone: nativeAd.phone,
price: nativeAd.price,
salePrice: nativeAd.saleprice,
clickUrl: nativeAd.link.url,
displayUrl: nativeAd.displayurl,
clickTrackers: nativeAd.link.click_trackers,
impressionTrackers: nativeAd.impression_trackers,
javascriptTrackers: nativeAd.javascript_trackers,
javascriptTrackers: nativeAd.javascript_trackers
};
if (nativeAd.main_img) {
bid['native'].image = {
Expand Down
9 changes: 8 additions & 1 deletion src/constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,15 @@
"image": "hb_native_image",
"icon": "hb_native_icon",
"clickUrl": "hb_native_linkurl",
"displayUrl": "hb_native_displayurl",
"cta": "hb_native_cta",
"rating": "hb_native_rating"
"rating": "hb_native_rating",
"address": "hb_native_address",
"downloads": "hb_native_downloads",
"likes": "hb_native_likes",
"phone": "hb_native_phone",
"price": "hb_native_price",
"salePrice": "hb_native_saleprice"
},
"S2S" : {
"SRC" : "s2s",
Expand Down
28 changes: 26 additions & 2 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,14 @@ describe('AppNexusAdapter', function () {
cta: {required: false},
rating: {required: true},
sponsoredBy: {required: true},
privacyLink: {required: true}
privacyLink: {required: true},
displayUrl: {required: true},
address: {required: true},
downloads: {required: true},
likes: {required: true},
phone: {required: true},
price: {required: true},
salePrice: {required: true}
}
}
);
Expand All @@ -200,7 +207,14 @@ describe('AppNexusAdapter', function () {
ctatext: {required: false},
rating: {required: true},
sponsored_by: {required: true},
privacy_link: {required: true}
privacy_link: {required: true},
displayurl: {required: true},
address: {required: true},
downloads: {required: true},
likes: {required: true},
phone: {required: true},
price: {required: true},
saleprice: {required: true}
});
});

Expand Down Expand Up @@ -536,6 +550,7 @@ describe('AppNexusAdapter', function () {
response1.tags[0].ads[0].rtb.native = {
'title': 'Native Creative',
'desc': 'Cool description great stuff',
'desc2': 'Additional body text',
'ctatext': 'Do it',
'sponsored': 'AppNexus',
'icon': {
Expand All @@ -554,6 +569,15 @@ describe('AppNexusAdapter', function () {
'click_trackers': ['http://nym1-ib.adnxs.com/click']
},
'impression_trackers': ['http://example.com'],
'rating': '5',
'displayurl': 'http://AppNexus.com/?url=display_url',
'likes': '38908320',
'downloads': '874983',
'price': '9.99',
'saleprice': 'FREE',
'phone': '1234567890',
'address': '28 W 23rd St, New York, NY 10010',
'privacy_link': 'http://appnexus.com/?url=privacy_url'
};
let bidderRequest = {
bids: [{
Expand Down

0 comments on commit e9dea17

Please sign in to comment.