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

gjirafa Bid Adapter: add biskoID and segmeents #7409

Merged
merged 7 commits into from Sep 15, 2021
Merged
Changes from all commits
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
13 changes: 11 additions & 2 deletions modules/gjirafaBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { getStorageManager } from '../src/storageManager.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';

const BIDDER_CODE = 'gjirafa';
const ENDPOINT_URL = 'https://central.gjirafa.com/bid';
const DIMENSION_SEPARATOR = 'x';
const SIZE_SEPARATOR = ';';
const BISKO_ID = 'biskoId';
const STORAGE_ID = 'bisko-sid';
const SEGMENTS = 'biskoSegments';
const storage = getStorageManager();

export const spec = {
code: BIDDER_CODE,
Expand All @@ -25,9 +30,12 @@ export const spec = {
* @return ServerRequest Info describing the request to the server.
*/
buildRequests: function (validBidRequests, bidderRequest) {
const storageId = storage.localStorageIsEnabled() ? storage.getDataFromLocalStorage(STORAGE_ID) || '' : '';
const biskoId = storage.localStorageIsEnabled() ? storage.getDataFromLocalStorage(BISKO_ID) || '' : '';
const segments = storage.localStorageIsEnabled() ? JSON.parse(storage.getDataFromLocalStorage(SEGMENTS)) || [] : [];

let propertyId = '';
let pageViewGuid = '';
let storageId = '';
let bidderRequestId = '';
let url = '';
let contents = [];
Expand All @@ -36,7 +44,6 @@ export const spec = {
let placements = validBidRequests.map(bidRequest => {
if (!propertyId) { propertyId = bidRequest.params.propertyId; }
if (!pageViewGuid && bidRequest.params) { pageViewGuid = bidRequest.params.pageViewGuid || ''; }
if (!storageId && bidRequest.params) { storageId = bidRequest.params.storageId || ''; }
if (!bidderRequestId) { bidderRequestId = bidRequest.bidderRequestId; }
if (!url && bidderRequest) { url = bidderRequest.refererInfo.referer; }
if (!contents.length && bidRequest.params.contents && bidRequest.params.contents.length) { contents = bidRequest.params.contents; }
Expand All @@ -60,6 +67,8 @@ export const spec = {
propertyId: propertyId,
pageViewGuid: pageViewGuid,
storageId: storageId,
biskoId: biskoId,
segments: segments,
url: url,
requestid: bidderRequestId,
placements: placements,
Expand Down