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

OFF-372 Support DTX/Hero in flippBidAdapter #2

Merged
merged 2 commits into from
Mar 15, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
17 changes: 17 additions & 0 deletions modules/flippBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ 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 +19,20 @@ 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;
}
};

export const spec = {
code: BIDDER_CODE,
supportedMediaTypes: [BANNER],
Expand Down Expand Up @@ -52,6 +68,7 @@ export const spec = {
...(!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