Skip to content
Open
Show file tree
Hide file tree
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
1 change: 0 additions & 1 deletion modules/adtelligentBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ export const spec = {
aliases: [
'streamkey',
'janet',
{ code: 'selectmedia', gvlid: 775 },
{ code: 'ocm', gvlid: 1148 },
'9dotsmedia',
'indicue',
Expand Down
79 changes: 79 additions & 0 deletions modules/selectmediaBidAdapter.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
\# Overview

```
Module Name: Selectmedia Bidder Adapter
Module Type: Selectmedia Bidder Adapter
Maintainer: prebid@selectmedia.asia
```

# Description

Connects to Selectmedia exchange for bids.
Selectmedia bid adapter supports Banner, Video (instream and outstream) and Native.

# Test Parameters
```
var adUnits = [
// Will return static test banner
{
code: 'adunit1',
mediaTypes: {
banner: {
sizes: [ [300, 250], [320, 50] ],
}
},
bids: [
{
bidder: 'selectmedia',
params: {
placementId: 'testBanner',
}
}
]
},
{
code: 'addunit2',
mediaTypes: {
video: {
playerSize: [ [640, 480] ],
context: 'instream',
minduration: 5,
maxduration: 60,
}
},
bids: [
{
bidder: 'selectmedia',
params: {
placementId: 'testVideo',
}
}
]
},
{
code: 'addunit3',
mediaTypes: {
native: {
title: {
required: true
},
body: {
required: true
},
icon: {
required: true,
size: [64, 64]
}
}
},
bids: [
{
bidder: 'selectmedia',
params: {
placementId: 'testNative',
}
}
]
}
];
```
56 changes: 56 additions & 0 deletions modules/selectmediaBidAdapter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
import { AdapterRequest, BidderSpec, registerBidder } from '../src/adapters/bidderFactory.js';
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js';
import {
interpretResponse,
isBidRequestValid,
getUserSyncs,
buildRequestsBase,
type TeqBlazeBidParams,
} from '../libraries/teqblazeUtils/bidderUtils.ts';
import type { BidRequest, BaseBidderRequest } from '../src/adapterManager.ts';

const BIDDER_CODE = 'selectmedia';
const AD_URL = 'https://#{REGION}#.zxyvrtd.com/pbjs';
const GVLID = 775;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this appears to be the gvlid of a different company

const SYNC_URL = 'https://sync.zxyvrtd.com';

type Region = 'eu' | 'us-east';
type SelectmediaBidParams = TeqBlazeBidParams & { region: Region };

const VALID_REGIONS = new Set<string>(['eu', 'us-east'] satisfies Region[]);

declare module '../src/adUnits' {
interface BidderParams {
[BIDDER_CODE]: SelectmediaBidParams;
}
}

const regionMap: Record<string, string> = {
eu: 'eu',
'us-east': 'us-east'
};

const baseIsBidRequestValid = isBidRequestValid();

const buildRequests = (
validBidRequests: BidRequest<typeof BIDDER_CODE>[],
bidderRequest: BaseBidderRequest<typeof BIDDER_CODE>
): AdapterRequest => {
const region = validBidRequests[0]?.params?.region;
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not base this on the user timezone instead of the config?

const adUrl = AD_URL.replace('#{REGION}#', region != null ? (regionMap[region] ?? region) : '');
Comment thread
patmmccann marked this conversation as resolved.

return buildRequestsBase({ adUrl, validBidRequests, bidderRequest });
};

export const spec: BidderSpec<typeof BIDDER_CODE> = {
code: BIDDER_CODE,
gvlid: GVLID,
supportedMediaTypes: [BANNER, VIDEO, NATIVE],

isBidRequestValid: (bid) => baseIsBidRequestValid(bid) && VALID_REGIONS.has(bid.params?.region),
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is region required? your md file never mentions it. also if you need the pub to fill it in perhaps tell them how to do so based on Intl.DateTimeFormat().resolvedOptions().timeZone or preferably, import

return Intl.DateTimeFormat().resolvedOptions().timeZone;
and examine this function from smartyads
export function getAdUrlByRegion(bid) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

or this one from escalax

function getSubdomain() {

buildRequests,
interpretResponse,
getUserSyncs: getUserSyncs(SYNC_URL)
};

registerBidder(spec);
Loading
Loading