Skip to content

Commit

Permalink
Lane4 Bid Adapter : initial release (#12749)
Browse files Browse the repository at this point in the history
* Audiencelogy Bid Adapter : Initial Release

* removed duplicates

* removed duplicates

* added common code in library libraries/audiencelogyUtils

* solved linter issues

* imported getRequest from library and solved linting issue

* solved trailing space issue

* new adapter : lane4

* new adapter : lane4

* removed linter errors

* removed trailing space
  • Loading branch information
hasanideepak authored Feb 20, 2025
1 parent 589f8c0 commit cacab4f
Show file tree
Hide file tree
Showing 4 changed files with 430 additions and 0 deletions.
6 changes: 6 additions & 0 deletions libraries/audUtils/bidderUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ export const getBannerRequest = (bidRequests, bidderRequest, ENDPOINT) => {
deepSetValue(req, 'regs.ext.us_privacy', bidderRequest.uspConsent);
}
req.MediaType = getMediaType(bidReq);
// Adding eids if passed
if (bidReq.userIdAsEids) {
req.user.ext.eids = bidReq.userIdAsEids;
}
request.push(req);
});
// Return the array of request
Expand Down Expand Up @@ -167,11 +171,13 @@ const getUserDetails = (bidReq) => {
user.buyeruid = bidReq.ortb2.user.buyeruid ? bidReq.ortb2.user.buyeruid : '';
user.keywords = bidReq.ortb2.user.keywords ? bidReq.ortb2.user.keywords : '';
user.customdata = bidReq.ortb2.user.customdata ? bidReq.ortb2.user.customdata : '';
user.ext = bidReq.ortb2.user.ext ? bidReq.ortb2.user.ext : '';
} else {
user.id = '';
user.buyeruid = '';
user.keywords = '';
user.customdata = '';
user.ext = {};
}
return user;
}
Expand Down
41 changes: 41 additions & 0 deletions modules/lane4BidAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
import {
BANNER,
NATIVE
} from '../src/mediaTypes.js';
import {
registerBidder
} from '../src/adapters/bidderFactory.js';
import {
getBannerRequest,
getBannerResponse,
getNativeResponse,
} from '../libraries/audUtils/bidderUtils.js';

const EP = 'https://rtb.lane4.io/hb';
// Export const spec
export const spec = {
code: 'lane4',
supportedMediaTypes: [BANNER, NATIVE],
// Determines whether or not the given bid request is valid
isBidRequestValid: (bidRequestParam) => {
return !!(bidRequestParam.params.placement_id);
},
// Make a server request from the list of BidRequests
buildRequests: (bidR, serverR) => {
// Get Requests based on media types
return getBannerRequest(bidR, serverR, EP);
},
// Unpack the response from the server into a list of bids.
interpretResponse: (bidRS, bidRQ) => {
let Response = {};
const mediaType = JSON.parse(bidRQ.data)[0].MediaType;
if (mediaType == BANNER) {
Response = getBannerResponse(bidRS, BANNER);
} else if (mediaType == NATIVE) {
Response = getNativeResponse(bidRS, bidRQ, NATIVE);
}
return Response;
}
}

registerBidder(spec);
61 changes: 61 additions & 0 deletions modules/lane4BidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# Overview

```
Module Name: Lane4 Bidder Adapter
Module Type: Bidder Adapter
Maintainer: adsupport@lane4.io
```

# Description

Lane4 currently supports the BANNER and NATIVE type ads through prebid js

Module that connects to Lane4's demand sources.

# Test Request
```
var adUnits = [
{
code: 'display-ad',
mediaTypes: {
banner: {
sizes: [[300, 250]],
}
}
bids: [
{
bidder: 'lane4',
params: {
placement_id: 5550, // Required parameter
width: 300, // Optional parameter
height: 250, // Optional parameter
bid_floor: 0.5 // Optional parameter
}
}
]
},
{
code: 'native-ad-container',
mediaTypes: {
native: {
title: { required: true, len: 100 },
image: { required: true, sizes: [300, 250] },
sponsored: { required: false },
clickUrl: { required: true },
desc: { required: true },
icon: { required: false, sizes: [50, 50] },
cta: { required: false }
}
},
bids: [
{
bidder: 'lane4',
params: {
placement_id: 5551, // Required parameter
bid_floor: 1 // Optional parameter
}
}
]
}
];
```
Loading

0 comments on commit cacab4f

Please # to comment.