-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Adspirit Bid Adapter: initial release #10939
Merged
+484
−0
Merged
Changes from 8 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6fb02f9
Add files via upload
carsten1980 a65f77b
Add files via upload
carsten1980 07723bd
Merge branch 'prebid:master' into master
carsten1980 e2c0c53
Merge branch 'prebid:master' into master
carsten1980 7698a85
Merge branch 'prebid:master' into master
carsten1980 1222251
Update adspiritBidAdapter.js
carsten1980 37d0787
Update adspiritBidAdapter.md
carsten1980 757ff8e
testcases for adspirit adapter 1/2024
carsten1980 63fd4c8
Update adspiritBidAdapter_spec.js
patmmccann 037509d
kick of circleci
ChrisHuie 8b34829
Merge branch 'prebid:master' into master
carsten1980 fea4664
Update adspiritBidAdapter.js
carsten1980 6498855
Update adspiritBidAdapter.md
patmmccann 8be33df
Merge branch 'prebid:master' into master
carsten1980 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,137 @@ | ||
import * as utils from '../src/utils.js'; | ||
import { registerBidder } from '../src/adapters/bidderFactory.js'; | ||
import { BANNER, NATIVE } from '../src/mediaTypes.js'; | ||
|
||
const RTB_URL = '/rtb/getbid.php?rtbprovider=prebid'; | ||
const SCRIPT_URL = '/adasync.min.js'; | ||
|
||
export const spec = { | ||
|
||
code: 'adspirit', | ||
aliases: ['twiago'], | ||
supportedMediaTypes: [BANNER, NATIVE], | ||
|
||
isBidRequestValid: function (bid) { | ||
let host = spec.getBidderHost(bid); | ||
if (!host || !bid.params.placementId) { | ||
return false; | ||
} | ||
return true; | ||
}, | ||
|
||
buildRequests: function (validBidRequests, bidderRequest) { | ||
let requests = []; | ||
for (let i = 0; i < validBidRequests.length; i++) { | ||
let bidRequest = validBidRequests[i]; | ||
bidRequest.adspiritConId = spec.genAdConId(bidRequest); | ||
let reqUrl = spec.getBidderHost(bidRequest); | ||
let placementId = utils.getBidIdParameter('placementId', bidRequest.params); | ||
reqUrl = '//' + reqUrl + RTB_URL + '&pid=' + placementId + | ||
'&ref=' + encodeURIComponent(bidderRequest.refererInfo.topmostLocation) + | ||
'&scx=' + (screen.width) + | ||
'&scy=' + (screen.height) + | ||
'&wcx=' + (window.innerWidth || document.documentElement.clientWidth) + | ||
'&wcy=' + (window.innerHeight || document.documentElement.clientHeight) + | ||
'&async=' + bidRequest.adspiritConId + | ||
'&t=' + Math.round(Math.random() * 100000); | ||
|
||
let data = {}; | ||
|
||
if (bidderRequest && bidderRequest.gdprConsent) { | ||
const gdprConsentString = bidderRequest.gdprConsent.consentString; | ||
reqUrl += '&gdpr=' + encodeURIComponent(gdprConsentString); | ||
} | ||
|
||
if (bidRequest.schain && bidderRequest.schain) { | ||
data.schain = bidRequest.schain; | ||
} | ||
|
||
requests.push({ | ||
method: 'GET', | ||
url: reqUrl, | ||
data: data, | ||
bidRequest: bidRequest | ||
}); | ||
} | ||
return requests; | ||
}, | ||
|
||
interpretResponse: function (serverResponse, bidRequest) { | ||
const bidResponses = []; | ||
let bidObj = bidRequest.bidRequest; | ||
|
||
if (!serverResponse || !serverResponse.body || !bidObj) { | ||
utils.logWarn(`No valid bids from ${spec.code} bidder!`); | ||
return []; | ||
} | ||
|
||
let adData = serverResponse.body; | ||
let cpm = adData.cpm; | ||
|
||
if (!cpm) { | ||
return []; | ||
} | ||
|
||
let host = spec.getBidderHost(bidObj); | ||
let bidResponse; | ||
if ('mediaTypes' in bidObj && 'native' in bidObj.mediaTypes) { | ||
bidResponse = { | ||
requestId: bidObj.bidId, | ||
cpm: cpm, | ||
width: adData.w, | ||
height: adData.h, | ||
creativeId: bidObj.params.placementId, | ||
currency: 'EUR', | ||
netRevenue: true, | ||
ttl: 300, | ||
meta: { | ||
advertiserDomains: bidObj && bidObj.adomain ? bidObj.adomain : [] | ||
}, | ||
native: { | ||
title: adData.title, | ||
body: adData.body, | ||
cta: adData.cta, | ||
image: { url: adData.image }, | ||
clickUrl: adData.click, | ||
impressionTrackers: [adData.view] | ||
}, | ||
mediaType: NATIVE | ||
}; | ||
} else { | ||
let adm = '<script>window.inDapIF=false</script><script src="//' + host + SCRIPT_URL + '"></script><ins id="' + bidObj.adspiritConId + '"></ins>' + adData.adm; | ||
bidResponse = { | ||
requestId: bidObj.bidId, | ||
cpm: cpm, | ||
width: adData.w, | ||
height: adData.h, | ||
creativeId: bidObj.params.placementId, | ||
currency: 'EUR', | ||
netRevenue: true, | ||
ttl: 300, | ||
meta: { | ||
advertiserDomains: bidObj && bidObj.adomain ? bidObj.adomain : [] | ||
}, | ||
ad: adm, | ||
mediaType: BANNER | ||
}; | ||
} | ||
mmoschovas marked this conversation as resolved.
Show resolved
Hide resolved
|
||
bidResponses.push(bidResponse); | ||
return bidResponses; | ||
}, | ||
|
||
getBidderHost: function (bid) { | ||
if (bid.bidder === 'adspirit') { | ||
return utils.getBidIdParameter('host', bid.params); | ||
} | ||
if (bid.bidder === 'twiago') { | ||
return 'a.twiago.com'; | ||
} | ||
return null; | ||
}, | ||
|
||
genAdConId: function (bid) { | ||
return bid.bidder + Math.round(Math.random() * 100000); | ||
} | ||
}; | ||
|
||
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,68 @@ | ||
# Overview | ||
|
||
``` | ||
Module Name: Adspirit Bid Adapter | ||
Module Type: Bidder Adapter | ||
Maintainer: prebid@adspirit.de | ||
|
||
``` | ||
# Description | ||
|
||
Connects to Adspirit exchange for bids. | ||
|
||
Each adunit with `adspirit` adapter has to have `placementId` and `host`. | ||
|
||
|
||
### Supported Features; | ||
|
||
1. Media Types: Banner & native | ||
2. Multi-format: adUnits | ||
3. Schain module | ||
4. Advertiser domains | ||
|
||
|
||
## Sample Banner Ad Unit | ||
```javascript | ||
var adUnits = [ | ||
{ | ||
code: 'display-div', | ||
|
||
mediaTypes: { | ||
banner: { | ||
sizes: [[300, 250]] //a display size | ||
} | ||
}, | ||
|
||
bids: [ | ||
{ | ||
bidder: "adspirit", | ||
params: { | ||
placementId: '7', //Please enter your placementID | ||
host: 'test.adspirit.de' //your host details from Adspirit | ||
} | ||
} | ||
] | ||
} | ||
]; | ||
|
||
``` | ||
|
||
|
||
### Privacy Policies | ||
|
||
General Data Protection Regulation(GDPR) supported by default. | ||
|
||
Complete informationavilable on this url-- https://support.adspirit.de/hc/en-us/categories/115000453312-General | ||
|
||
|
||
### CMP (Consent Management Provider) | ||
CMP stands for Consent Management Provider. In simple terms, this is a service provider that obtains and processes the consent of the user, makes it available to the advertisers and, if necessary, logs it for later control. We recommend using a provider with IAB certification or CMP based on the IAB CMP Framework. A list of IAB CMPs can be found at https://iabeurope.eu/cmp-list/. AdSpirit recommends the use of | ||
www.consentmanager.de . | ||
|
||
### List of functions that require consent | ||
|
||
Please visit our page- https://support.adspirit.de/hc/en-us/articles/360014631659-List-of-functions-that-require-consent | ||
|
||
|
||
|
||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whats the difference if the server responds with a script or if the code creates the script?