Skip to content

Commit

Permalink
OFF-372 Support DTX/Hero in flippBidAdapter (#2)
Browse files Browse the repository at this point in the history
* support creativeType

* OFF-422 flippBidAdapter handle AdTypes

---------

Co-authored-by: Jairo Panduro <[email protected]>
  • Loading branch information
mike-lei and jpanduro-blackbird committed Mar 15, 2023
1 parent 900681f commit 3e78053
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
27 changes: 26 additions & 1 deletion modules/flippBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,14 @@ import { registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER } from '../src/mediaTypes.js';
const NETWORK_ID = 11090;
const AD_TYPES = [4309, 641];
const DTX_TYPES = [5061];
const TARGET_NAME = 'inline';
const BIDDER_CODE = 'flipp';
const ENDPOINT = 'https://gateflipp.flippback.com/flyer-locator-service/prebid_campaigns';
const DEFAULT_TTL = 30;
const DEFAULT_CURRENCY = 'USD';
const DEFAULT_CREATIVE_TYPE = 'NativeX';
const VALID_CREATIVE_TYPES = ['DTX', 'NativeX'];

const generateUUID = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, c => {
Expand All @@ -17,6 +20,27 @@ const generateUUID = () => {
});
};

/**
* Determines if a creativeType is valid
*
* @param {string} creativeType The Creative Type to validate.
* @return string creativeType if this is a valid Creative Type, and 'NativeX' otherwise.
*/
const validateCreativeType = (creativeType) => {
if (creativeType && VALID_CREATIVE_TYPES.includes(creativeType)) {
return creativeType;
} else {
return DEFAULT_CREATIVE_TYPE;
}
};

const getAdTypes = (creativeType) => {
if (creativeType === 'DTX') {
return DTX_TYPES;
}
return AD_TYPES;
}

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER],
Expand Down Expand Up @@ -45,13 +69,14 @@ export const spec = {
divName: TARGET_NAME,
networkId: NETWORK_ID,
siteId: bid.params.siteId,
adTypes: AD_TYPES,
adTypes: getAdTypes(bid.params.creativeType),
count: 1,
...(!isEmpty(bid.params.zoneIds) && {zoneIds: bid.params.zoneIds}),
properties: {
...(!isEmpty(contentCode) && {contentCode: contentCode.slice(0, 32)}),
},
prebid: {
creativeType: validateCreativeType(bid.params.creativeType),
requestId: bid.bidId,
publisherNameIdentifier: bid.params.publisherNameIdentifier,
height: bid.mediaTypes.banner.sizes[index][0],
Expand Down
1 change: 1 addition & 0 deletions modules/flippBidAdapter.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ var adUnits = [
{
bidder: 'flipp',
params: {
creativeType: 'NativeX', // Optional, can be one of 'NativeX' (default) or 'DTX'
publisherNameIdentifier: 'wishabi-test-publisher', // Required
siteId: 1192075, // Required
zoneIds: [260678], // Optional
Expand Down

0 comments on commit 3e78053

Please sign in to comment.