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

AdMatic Bid Adapter : gvlid and video renderer feature added #11212

Merged
merged 68 commits into from
Mar 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
d49b56a
Admatic Bidder Adaptor
fatihkaya84 Oct 19, 2022
e582645
Update admaticBidAdapter.md
fatihkaya84 Oct 19, 2022
4c4c06a
Update admaticBidAdapter.md
fatihkaya84 Oct 28, 2022
7a23b05
remove floor parameter
fatihkaya84 Oct 31, 2022
7a845b7
Update admaticBidAdapter.js
fatihkaya84 Oct 31, 2022
7a2e0e2
Admatic Bid Adapter: alias and bid floor features activated
fatihkaya84 Nov 4, 2022
de7ac85
Admatic adapter: host param control changed
fatihkaya84 Nov 4, 2022
661c54f
Alias name changed.
fatihkaya84 Nov 4, 2022
42675a0
Revert "Admatic adapter: host param control changed"
fatihkaya84 Nov 4, 2022
6ec8f45
added alias feature and host param
fatihkaya84 Nov 4, 2022
63e1fc6
Revert "added alias feature and host param"
fatihkaya84 Nov 5, 2022
6da6565
Revert "Alias name changed."
fatihkaya84 Nov 5, 2022
549f349
Revert "Admatic Bid Adapter: alias and bid floor features activated"
fatihkaya84 Nov 5, 2022
0b8718e
Revert "Update admaticBidAdapter.js"
fatihkaya84 Nov 5, 2022
e7f6902
Revert "remove floor parameter"
fatihkaya84 Nov 5, 2022
3c797b1
Admatic adapter: host param control && Add new Bidder
fatihkaya84 Nov 5, 2022
f44bbeb
Revert "Admatic adapter: host param control && Add new Bidder"
fatihkaya84 Nov 5, 2022
fb6e36e
Merge branch 'prebid:master' into master
fatihkaya84 Nov 5, 2022
68f2596
commit new features
fatihkaya84 Nov 5, 2022
7fd1f26
Update admaticBidAdapter.js
fatihkaya84 Nov 6, 2022
e883ef6
updated for coverage
fatihkaya84 Nov 12, 2022
6961cae
sync updated
fatihkaya84 Nov 14, 2022
a3b299f
Update adloader.js
fatihkaya84 Nov 14, 2022
84c7b7b
Merge branch 'prebid:master' into master
fatihkaya84 Nov 18, 2022
e254707
AdMatic Bidder: development of user sync url
fatihkaya84 Nov 18, 2022
ba99adf
Update admaticBidAdapter.js
fatihkaya84 Nov 18, 2022
4083ae0
Merge branch 'prebid:master' into master
fatihkaya84 Jan 23, 2023
2fc2b1c
Set currency for AdserverCurrency: bug fix
fatihkaya84 Jan 23, 2023
325d94d
Merge branch 'prebid:master' into master
fatihkaya84 Apr 17, 2023
74f135b
Update admaticBidAdapter.js
fatihkaya84 Apr 17, 2023
e6b1672
update
fatihkaya84 Apr 17, 2023
dcfc9fe
Merge branch 'prebid:master' into master
fatihkaya84 Apr 26, 2023
31e69e8
admatic adapter video params update
fatihkaya84 Apr 26, 2023
60a28ca
Update admaticBidAdapter.js
fatihkaya84 Apr 26, 2023
a5316e7
update
fatihkaya84 Apr 26, 2023
38fd7ab
Update admaticBidAdapter.js
fatihkaya84 Apr 27, 2023
f381a45
update
fatihkaya84 Apr 27, 2023
689ce9d
update
fatihkaya84 Apr 27, 2023
1ca6597
Update admaticBidAdapter_spec.js
fatihkaya84 Apr 27, 2023
b1929ec
Update admaticBidAdapter.js
fatihkaya84 Apr 27, 2023
1216892
Update admaticBidAdapter.js
fatihkaya84 Apr 28, 2023
5d486e3
Revert "Update admaticBidAdapter.js"
fatihkaya84 Apr 28, 2023
473e417
Revert "Update admaticBidAdapter.js"
fatihkaya84 Apr 28, 2023
13b25ff
Revert "Update admaticBidAdapter_spec.js"
fatihkaya84 Apr 28, 2023
93b0e7d
Revert "update"
fatihkaya84 Apr 28, 2023
1c904d1
Revert "update"
fatihkaya84 Apr 28, 2023
c762aeb
Revert "Update admaticBidAdapter.js"
fatihkaya84 Apr 28, 2023
0520e1c
Revert "update"
fatihkaya84 Apr 28, 2023
578c49b
Revert "Update admaticBidAdapter.js"
fatihkaya84 Apr 28, 2023
6b04200
Revert "admatic adapter video params update"
fatihkaya84 Apr 28, 2023
246787c
Merge branch 'prebid:master' into master
fatihkaya84 Apr 28, 2023
941bb03
update
fatihkaya84 Apr 28, 2023
151ba7a
Merge branch 'prebid:master' into master
fatihkaya84 Jun 15, 2023
bbbf361
Update admaticBidAdapter.js
fatihkaya84 Jun 15, 2023
63c6ada
Merge branch 'prebid:master' into master
fatihkaya84 Jul 17, 2023
5ec51d4
Merge branch 'prebid:master' into master
fatihkaya84 Jul 29, 2023
4639682
Merge branch 'prebid:master' into master
fatihkaya84 Aug 8, 2023
2999463
Update admaticBidAdapter_spec.js
fatihkaya84 Aug 8, 2023
3bcbe0f
Merge branch 'prebid:master' into master
fatihkaya84 Oct 7, 2023
090397e
mime_type add
fatihkaya84 Oct 7, 2023
ee09d90
Merge branch 'prebid:master' into master
fatihkaya84 Oct 26, 2023
bd0d50c
add native adapter
fatihkaya84 Oct 26, 2023
8347749
Merge branch 'prebid:master' into master
fatihkaya84 Oct 30, 2023
00bb9b5
Merge branch 'prebid:master' into master
fatihkaya84 Dec 8, 2023
5d9ea45
AdMatic Adapter: Consent Management
fatihkaya84 Dec 9, 2023
8a03c3f
Merge branch 'prebid:master' into master
fatihkaya84 Mar 4, 2024
d3a0f62
Merge branch 'prebid:master' into master
fatihkaya84 Mar 14, 2024
7273ec5
added gvlid
fatihkaya84 Mar 14, 2024
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
104 changes: 74 additions & 30 deletions modules/admaticBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {getValue, formatQS, logError, deepAccess, isArray, getBidIdParameter} fr
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import { BANNER, VIDEO, NATIVE } from '../src/mediaTypes.js';
import { Renderer } from '../src/Renderer.js';

/**
* @typedef {import('../src/adapters/bidderFactory.js').BidRequest} BidRequest
Expand Down Expand Up @@ -33,11 +34,13 @@ export const OPENRTB = {

let SYNC_URL = '';
const BIDDER_CODE = 'admatic';
const RENDERER_URL = 'https://acdn.adnxs.com/video/outstream/ANOutstreamVideo.js';

export const spec = {
code: BIDDER_CODE,
gvlid: 1281,
aliases: [
{code: 'pixad'}
{code: 'pixad', gvlid: 1281}
],
supportedMediaTypes: [BANNER, VIDEO, NATIVE],
/**
Expand Down Expand Up @@ -190,38 +193,45 @@ export const spec = {
interpretResponse: (response, request) => {
const body = response.body;
const bidResponses = [];

if (body && body?.data && isArray(body.data)) {
body.data.forEach(bid => {
const resbid = {
requestId: bid.id,
cpm: bid.price,
width: bid.width,
height: bid.height,
currency: body.cur || 'TRY',
netRevenue: true,
creativeId: bid.creative_id,
meta: {
model: bid.mime_type,
advertiserDomains: bid && bid.adomain ? bid.adomain : []
},
bidder: bid.bidder,
mediaType: bid.type,
ttl: 60
};

if (resbid.mediaType === 'video' && isUrl(bid.party_tag)) {
resbid.vastUrl = bid.party_tag;
resbid.vastImpUrl = bid.iurl;
} else if (resbid.mediaType === 'video') {
resbid.vastXml = bid.party_tag;
resbid.vastImpUrl = bid.iurl;
} else if (resbid.mediaType === 'banner') {
resbid.ad = bid.party_tag;
} else if (resbid.mediaType === 'native') {
resbid.native = interpretNativeAd(bid.party_tag)
};
const bidRequest = getAssociatedBidRequest(request.data.imp, bid);
if (bidRequest) {
const resbid = {
requestId: bid.id,
cpm: bid.price,
width: bid.width,
height: bid.height,
currency: body.cur || 'TRY',
netRevenue: true,
creativeId: bid.creative_id,
meta: {
model: bid.mime_type,
advertiserDomains: bid && bid.adomain ? bid.adomain : []
},
bidder: bid.bidder,
mediaType: bid.type,
ttl: 60
};

if (resbid.mediaType === 'video' && isUrl(bid.party_tag)) {
resbid.vastUrl = bid.party_tag;
} else if (resbid.mediaType === 'video') {
resbid.vastXml = bid.party_tag;
} else if (resbid.mediaType === 'banner') {
resbid.ad = bid.party_tag;
} else if (resbid.mediaType === 'native') {
resbid.native = interpretNativeAd(bid.party_tag)
};

const context = deepAccess(bidRequest, 'mediatype.context');
if (resbid.mediaType === 'video' && context === 'outstream') {
resbid.renderer = createOutstreamVideoRenderer(bid);
}

bidResponses.push(resbid);
bidResponses.push(resbid);
}
});
}
return bidResponses;
Expand Down Expand Up @@ -272,6 +282,40 @@ function isUrl(str) {
}
};

function outstreamRender (bid) {
bid.renderer.push(() => {
window.ANOutstreamVideo.renderAd({
targetId: bid.adUnitCode,
adResponse: bid.adResponse
});
});
}

function createOutstreamVideoRenderer(bid) {
const renderer = Renderer.install({
id: bid.bidId,
url: RENDERER_URL,
loaded: false
});

try {
renderer.setRender(outstreamRender);
} catch (err) {
logError('Prebid Error calling setRender on renderer' + err);
}

return renderer;
}

function getAssociatedBidRequest(bidRequests, bid) {
for (const request of bidRequests) {
if (request.id === bid.id) {
return request;
}
}
return undefined;
}

function enrichSlotWithFloors(slot, bidRequest) {
try {
const slotFloors = {};
Expand Down
Loading