-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
e-volution-tech: change file names (#5060)
* initial * fix * fix * fix * fix * fix * fix * fix * fix * fix * fixes * navigator check * navigator.language check * fix namings * fix namings
- Loading branch information
1 parent
95c0d4a
commit 10ea486
Showing
3 changed files
with
399 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
import {registerBidder} from '../src/adapters/bidderFactory.js'; | ||
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js'; | ||
import * as utils from '../src/utils.js'; | ||
|
||
const BIDDER_CODE = 'e_volution'; | ||
const AD_URL = 'https://service.e-volution.ai/?c=o&m=multi'; | ||
const URL_SYNC = 'https://service.e-volution.ai/?c=o&m=sync'; | ||
const NO_SYNC = true; | ||
|
||
function isBidResponseValid(bid) { | ||
if (!bid.requestId || !bid.cpm || !bid.creativeId || | ||
!bid.ttl || !bid.currency) { | ||
return false; | ||
} | ||
switch (bid.mediaType) { | ||
case BANNER: | ||
return Boolean(bid.width && bid.height && bid.ad); | ||
case VIDEO: | ||
return Boolean(bid.vastUrl); | ||
case NATIVE: | ||
return Boolean(bid.native && bid.native.title && bid.native.image && bid.native.impressionTrackers); | ||
default: | ||
return false; | ||
} | ||
} | ||
|
||
export const spec = { | ||
code: BIDDER_CODE, | ||
supportedMediaTypes: [BANNER, VIDEO, NATIVE], | ||
noSync: NO_SYNC, | ||
|
||
isBidRequestValid: (bid) => { | ||
return Boolean(bid.bidId && bid.params && !isNaN(parseInt(bid.params.placementId))); | ||
}, | ||
|
||
buildRequests: (validBidRequests = [], bidderRequest) => { | ||
let winTop = window; | ||
let location; | ||
try { | ||
location = new URL(bidderRequest.refererInfo.referer) | ||
winTop = window.top; | ||
} catch (e) { | ||
location = winTop.location; | ||
utils.logMessage(e); | ||
}; | ||
let placements = []; | ||
let request = { | ||
'deviceWidth': winTop.screen.width, | ||
'deviceHeight': winTop.screen.height, | ||
'language': (navigator && navigator.language) ? navigator.language.split('-')[0] : '', | ||
'secure': 1, | ||
'host': location.host, | ||
'page': location.pathname, | ||
'placements': placements | ||
}; | ||
if (bidderRequest) { | ||
if (bidderRequest.uspConsent) { | ||
request.ccpa = bidderRequest.uspConsent; | ||
} | ||
if (bidderRequest.gdprConsent) { | ||
request.gdpr = bidderRequest.gdprConsent | ||
} | ||
} | ||
const len = validBidRequests.length; | ||
|
||
for (let i = 0; i < len; i++) { | ||
let bid = validBidRequests[i]; | ||
let traff = bid.params.traffic || BANNER | ||
|
||
placements.push({ | ||
placementId: bid.params.placementId, | ||
bidId: bid.bidId, | ||
sizes: bid.mediaTypes && bid.mediaTypes[traff] && bid.mediaTypes[traff].sizes ? bid.mediaTypes[traff].sizes : [], | ||
traffic: traff | ||
}); | ||
if (bid.schain) { | ||
placements.schain = bid.schain; | ||
} | ||
} | ||
return { | ||
method: 'POST', | ||
url: AD_URL, | ||
data: request | ||
}; | ||
}, | ||
|
||
interpretResponse: (serverResponse) => { | ||
let response = []; | ||
for (let i = 0; i < serverResponse.body.length; i++) { | ||
let resItem = serverResponse.body[i]; | ||
if (isBidResponseValid(resItem)) { | ||
response.push(resItem); | ||
} | ||
} | ||
return response; | ||
}, | ||
|
||
getUserSyncs: (syncOptions, serverResponses) => { | ||
if (NO_SYNC) { | ||
return false | ||
} else { | ||
return [{ | ||
type: 'image', | ||
url: URL_SYNC | ||
}]; | ||
} | ||
} | ||
|
||
}; | ||
|
||
registerBidder(spec); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# Overview | ||
|
||
``` | ||
Module Name: e_volution Bidder Adapter | ||
Module Type: Bidder Adapter | ||
``` | ||
|
||
# Description | ||
|
||
Module that connects to e-volution-tech demand sources | ||
|
||
# Test Parameters | ||
``` | ||
var adUnits = [ | ||
// Will return static test banner | ||
{ | ||
code: 'placementId_0', | ||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250]], | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'e_volution', | ||
params: { | ||
placementId: 0, | ||
traffic: 'banner' | ||
} | ||
} | ||
] | ||
}, | ||
// Will return test vast xml. All video params are stored under placement in publishers UI | ||
{ | ||
code: 'placementId_0', | ||
mediaTypes: { | ||
video: { | ||
playerSize: [640, 480], | ||
context: 'instream' | ||
} | ||
}, | ||
bids: [ | ||
{ | ||
bidder: 'e_volution', | ||
params: { | ||
placementId: 0, | ||
traffic: 'video' | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
``` |
Oops, something went wrong.