Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding native parameters: body2, rating, privacyLink #3348

Merged
merged 1 commit into from
Dec 10, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions modules/appnexusBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const USER_PARAMS = ['age', 'external_uid', 'segments', 'gender', 'dnt', 'langua
const APP_DEVICE_PARAMS = ['geo', 'device_id']; // appid is collected separately
const NATIVE_MAPPING = {
body: 'description',
body2: 'desc2',
cta: 'ctatext',
image: {
serverName: 'main_image',
Expand All @@ -25,6 +26,7 @@ const NATIVE_MAPPING = {
minimumParams: { sizes: [{}] },
},
sponsoredBy: 'sponsored_by',
privacyLink: 'privacy_link'
};
const SOURCE = 'pbjs';

Expand Down Expand Up @@ -283,8 +285,11 @@ function newBid(serverBid, rtbBid, bidderRequest) {
bid[NATIVE] = {
title: nativeAd.title,
body: nativeAd.desc,
body2: nativeAd.desc2,
cta: nativeAd.ctatext,
rating: nativeAd.rating,
sponsoredBy: nativeAd.sponsored,
privacyLink: nativeAd.privacy_link,
clickUrl: nativeAd.link.url,
clickTrackers: nativeAd.link.click_trackers,
impressionTrackers: nativeAd.impression_trackers,
Expand Down
5 changes: 4 additions & 1 deletion src/constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,14 @@
"NATIVE_KEYS": {
"title": "hb_native_title",
"body": "hb_native_body",
"body2": "hb_native_body2",
"privacyLink": "hb_native_privacy",
"sponsoredBy": "hb_native_brand",
"image": "hb_native_image",
"icon": "hb_native_icon",
"clickUrl": "hb_native_linkurl",
"cta": "hb_native_cta"
"cta": "hb_native_cta",
"rating": "hb_native_rating"
},
"S2S" : {
"SRC" : "s2s",
Expand Down
10 changes: 8 additions & 2 deletions test/spec/modules/appnexusBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -179,9 +179,12 @@ describe('AppNexusAdapter', function () {
nativeParams: {
title: {required: true},
body: {required: true},
body2: {required: true},
image: {required: true, sizes: [{ width: 100, height: 100 }]},
cta: {required: false},
sponsoredBy: {required: true}
rating: {required: true},
sponsoredBy: {required: true},
privacyLink: {required: true}
}
}
);
Expand All @@ -192,9 +195,12 @@ describe('AppNexusAdapter', function () {
expect(payload.tags[0].native.layouts[0]).to.deep.equal({
title: {required: true},
description: {required: true},
desc2: {required: true},
main_image: {required: true, sizes: [{ width: 100, height: 100 }]},
ctatext: {required: false},
sponsored_by: {required: true}
rating: {required: true},
sponsored_by: {required: true},
privacy_link: {required: true}
});
});

Expand Down