Skip to content

Commit

Permalink
Support 'cta' native asset
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewlane committed Aug 20, 2017
1 parent 000e453 commit 058793e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions modules/appnexusAstBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const VIDEO_TARGETING = ['id', 'mimes', 'minduration', 'maxduration',
const USER_PARAMS = ['age', 'external_uid', 'segments', 'gender', 'dnt', 'language'];
const NATIVE_MAPPING = {
body: 'description',
cta: 'ctatext',
image: {
serverName: 'main_image',
serverParams: { required: true, sizes: [{}] }
Expand Down Expand Up @@ -344,6 +345,7 @@ function AppnexusAstAdapter() {
bid.native = {
title: native.title,
body: native.desc,
cta: native.ctatext,
sponsoredBy: native.sponsored,
image: native.main_img && native.main_img.url,
icon: native.icon && native.icon.url,
Expand Down
4 changes: 2 additions & 2 deletions src/bidmanager.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { uniques, flatten, adUnitsFilter, getBidderRequest } from './utils';
import {getPriceBucketString} from './cpmBucketManager';
import {NATIVE_KEYS, nativeBidIsValid} from './native';
import { getPriceBucketString } from './cpmBucketManager';
import { NATIVE_KEYS, nativeBidIsValid } from './native';
import { store } from './videoCache';
import { Renderer } from 'src/Renderer';
import { config } from 'src/config';
Expand Down
1 change: 1 addition & 0 deletions src/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const NATIVE_KEYS = {
image: 'hb_native_image',
icon: 'hb_native_icon',
clickUrl: 'hb_native_linkurl',
cta: 'hb_native_cta',
};

export const NATIVE_TARGETING_KEYS = Object.keys(NATIVE_KEYS).map(
Expand Down
4 changes: 4 additions & 0 deletions test/spec/modules/appnexusAstBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ describe('AppNexusAdapter', () => {
REQUEST.bids[0].nativeParams = {
title: {required: true},
body: {required: true},
cta: {required: false},
sponsoredBy: {required: true}
};

Expand All @@ -143,6 +144,7 @@ describe('AppNexusAdapter', () => {
expect(request.tags[0].native.layouts[0]).to.deep.equal({
title: {required: true},
description: {required: true},
ctatext: {required: false},
sponsored_by: {required: true}
});

Expand Down Expand Up @@ -266,6 +268,7 @@ describe('AppNexusAdapter', () => {
RESPONSE.tags[0].ads[0].rtb.native = {
'title': 'Native Creative',
'desc': 'Cool description great stuff',
'ctatext': 'Do it',
'sponsored': 'AppNexus',
'icon': {
'width': 0,
Expand Down Expand Up @@ -295,6 +298,7 @@ describe('AppNexusAdapter', () => {

expect(response.native.title).to.equal('Native Creative');
expect(response.native.body).to.equal('Cool description great stuff');
expect(response.native.cta).to.equal('Do it');
expect(response.native.image).to.equal('http://cdn.adnxs.com/img.png');

RESPONSE.tags[0].ads[0].ad_type = 'banner';
Expand Down

0 comments on commit 058793e

Please sign in to comment.