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

HTB-0001 DeepIntent: New Adapter #186

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions deep-intent/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 1.0.0

- Initial Version, implemented the adapter
180 changes: 180 additions & 0 deletions deep-intent/DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,180 @@
# DeepIntent
## General Compatibility
|Feature| |
|---|---|
| Consent | Y |
| Native Ad Support | N |
| SafeFrame Support | Y |
| PMP Support | N |

## Browser Compatibility
| Browser | |
|--- |---|
| Chrome | Y |
| Edge | Y |
| Firefox | Y |
| Internet Explorer 9 | N |
| Internet Explorer 10 | Y |
| Internet Explorer 11 | Y |
| Safari | Y |
| Mobile Chrome | Y |
| Mobile Safari | Y |
| UC Browser | N |
| Samsung Internet | N |
| Opera | Y |

## Adapter Information
| Info | |
|---|---|
| Partner Id | DeepIntentHtb |
| Ad Server Responds in (Cents, Dollars, etc) | Dollars |
| Bid Type (Gross / Net) | Net |
| GAM Key (Open Market) | ix_dee_om |
| GAM Key (Private Market) | ix_dee_om |
| Ad Server URLs | https://prebid.deepintent.com/prebid |
| Slot Mapping Style (Size / Multiple Sizes / Slot) | Slot |
| Request Architecture (MRA / SRA) | MRA |

## Currencies Supported
USD

## Bid Request Information
### Parameters
| Key | Required | Type | Description |
|---|---|---|---|
|id|Yes|string|Identifier|
|at|Yes|Integer|Default Value 1 (Hardcoded)|
|imp|Yes|Object|ortb request containing slot and impressions information|
|site|Yes|Object|Contains site page and domain information|
|device|Yes|Object|Contains device data: browser, width & height of device, DONOTTRACK flag and language|
|user|No|Object|Contains user information: userid, buyeruid, yob, gender, keywords, customdata, eids (Unified Id data), gdpr consent string|
|regs|No|Object|Contains information if GDPR status is applicable and ccpa consent|

### Example
```javascript
{
"id": "9LKgIp41",
"at": 1,
"imp": [
{
"id": "htSlotDesktopAId",
"tagid": "/43743431/DMDemo",
"secure": 1,
"banner": {
"h": 600,
"w": 160,
"pos": 0
},
"displaymanager": "di_indexexchange",
"displaymanagerver": "1.0.0",
"ext": {}
},
{
"id": "htSlotDesktopAId",
"tagid": "/43743431/DMDemo1",
"secure": 1,
"banner": {
"h": 90,
"w": 728,
"pos": 0
},
"displaymanager": "di_indexexchange",
"displaymanagerver": "1.0.0",
"ext": {}
}
],
"site": {
"page": "http://test.com/test.html",
"domain": "test.com"
},
"device": {
"ua": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.122 Safari/537.36",
"js": 1,
"dnt": 1,
"h": 900,
"w": 1440,
"language": "en-US"
},
"user": {
"id": "di_testuid",
"buyeruid": "di_testbuyeruid",
"yob": 2002,
"gender": "F",
"ext": {
"gdpr_consent": ""
}
},
"regs": {
"ext": {
"gdpr": 0,
"is_privacy": "1NYN"
}
}
}
```

## Bid Response Information
### Bid Example
```javascript
{
"id": "4E733404-CC2E-48A2-BC83-4DD5F38FE9BB",
"bidId": "0b08b09f-aaa1-4c14-b1c8-7debb1a7c1cd",
"seatbid": [
{
"seat": "12345",
"bid": [
{
"id": "4E733404-CC2E-48A2-BC83-4DD5F38FE9BB",
"impid": "htSlotDesktopAId",
"price": 2,
"adid": "10001",
"adm": "<div id=\"default-creative\"><img alt='here is your ad' src=\"https:...\" /></div>",
"adomain": [
"test.com"
],
"cid": "16981",
"crid": "13665",
"h": 600,
"w": 160
},
{
"id": "4E733404-CC2E-48A2-BC83-4DD5F38FE9BC",
"impid": "htSlotDesktopAId",
"price": 2,
"adid": "10001",
"adm": "<div id=\"default-creative\"><img alt='here is your ad' src=\"https:...\" /></div>",
"adomain": [
"test.com"
],
"cid": "16981",
"crid": "13665",
"h": 250,
"w": 300
}
]
}
]
}
```
### Pass Example
```javascript
HTTP status code - 204 No Content
```

## Configuration Information
### Configuration Keys
| Key | Required | Type | Description |
|---|---|---|---|
|pubId|Yes|string|Publisher ID|
|yob|No|string|Year of Birth|
|gender|No|string|Gender Information|
|version|No|string|version number|
### Example
```javascript
{
pubId: '10001',
yob: '1990',
gender: 'F',
version: '1.0.0'
}
```
10 changes: 10 additions & 0 deletions deep-intent/deep-intent-htb-exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//? if (FEATURES.GPT_LINE_ITEMS) {
shellInterface.DeepIntentHtb = {
render: SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'DeepIntentHtb')
};


shellInterface.DeepIntentModule = {
render: SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'DeepIntentHtb')
};
//? }
202 changes: 202 additions & 0 deletions deep-intent/deep-intent-htb-system-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,202 @@
'use strict';

function getPartnerId() {
return 'DeepIntentHtb';
}

function getStatsId() {
return 'DEE';
}

function getCallbackType() {
return 'NONE';
}

function getArchitecture() {
return 'SRA';
}

function getConfig() {
return {
tagId: '100013',
pos: 1,
user: {
id: 'di_testuid',
buyeruid: 'di_testbuyeruid',
yob: 2002,
gender: 'F'
},
xSlots: {
1: {
adUnitName: '/43743431/DMDemo',

// Winning bid for [160x600]
sizes: [[160, 600], [300, 250]]
},
2: {
adUnitName: '/43743431/DMDemo1',

// Winning bid for [300x250]
sizes: [
[728, 90],
[800, 250],
[300, 250]
]
}
}
};
}

function getBidRequestRegex() {
return {
method: 'POST',
urlRegex: /https:\/\/prebid\.deepintent\.com\/prebid/
};
}

function validateBidRequest(request) {
// Expect(request.host).toEqual('deepintent.com');
expect(request.host).toEqual('prebid.deepintent.com');
var config = getConfig();
var sizes1 = config.xSlots[1].sizes;
var sizes2 = config.xSlots[2].sizes;

var body = request.body;
if (body) {
body = JSON.parse(body);
expect(body.id).toBeDefined();
expect(body.imp.length).toEqual(2);
expect(body.imp[0].banner).toBeDefined();
expect(body.imp[0].secure).toEqual(1);
expect(body.imp[0].banner.w).toEqual(sizes1[0][0]);
expect(body.imp[0].banner.h).toEqual(sizes1[0][1]);
expect(body.imp[0].tagid).toEqual(config.xSlots['1'].adUnitName);

expect(body.imp[1].banner).toBeDefined();
expect(body.imp[1].banner.w).toEqual(sizes2[0][0]);
expect(body.imp[1].banner.h).toEqual(sizes2[0][1]);
expect(body.imp[1].tagid).toEqual(config.xSlots['2'].adUnitName);

expect(body.at).toEqual(1);

expect(body.site).toBeDefined();
expect(body.site.page).toBeDefined();
expect(body.site.domain).toBeDefined();

expect(body.user.id).toBeDefined();
expect(body.user.buyeruid).toBeDefined();
expect(body.user.yob).toEqual(config.user.yob);
expect(body.user.gender).toEqual(config.user.gender);

expect(body.device).toBeDefined();
expect(body.device.ua).toBeDefined();
expect(body.device.js).toBeDefined();
expect(body.device.js).toEqual(1);
expect(body.device.dnt).toBeDefined();
expect(body.device.h).toBeDefined();
expect(body.device.w).toBeDefined();
expect(body.device.language).toBeDefined();
}
}

function getValidResponse(request, creative) {
var body = JSON.parse(request.body);
var response = {
id: '4E733404-CC2E-48A2-BC83-4DD5F38FE9BB',
bidId: '0b08b09f-aaa1-4c14-b1c8-7debb1a7c1cd',
seatbid: [
{
seat: '12345',
bid: [
{
id: '4E733404-CC2E-48A2-BC83-4DD5F38FE9BB',
impid: body.imp[0].id,
price: 2,
adid: '10001',
adm: creative,
adomain: ['test.com'],
cid: '16981',
crid: '13665',
h: 600,
w: 160
},
{
id: '4E733404-CC2E-48A2-BC83-4DD5F38FE9BC',
impid: body.imp[1].id,
price: 2,
adid: '10001',
adm: creative,
adomain: ['test.com'],
cid: '16981',
crid: '13665',
h: 250,
w: 300
}
]
}
]
};

return JSON.stringify(response);
}

function validateTargeting(targetingMap) {
var isObjEmpty = Object.keys(targetingMap).length === 0 && targetingMap.constructor === Object;
if (!isObjEmpty) {
expect(targetingMap).toEqual(jasmine.objectContaining({
ix_dee_om: jasmine.arrayContaining([jasmine.any(String), jasmine.any(String)]),
ix_dee_id: jasmine.arrayContaining([jasmine.any(String), jasmine.any(String)])
}));
}
}

function getPassResponse() {
return JSON.stringify({ bids: [] });
}

function validateBidRequestWithPrivacy(request) {
var r = JSON.parse(request.body);

expect(r.regs.ext.gdpr).toEqual(1);

expect(r.user).toEqual(jasmine.objectContaining({
ext: {
gdpr_consent: 'TEST_GDPR_CONSENT_STRING'
}
}));
}

function validateBidRequestWithAdSrvrOrg(request) {
var body = JSON.parse(request.body);
expect(body.user.eids[0].source).toEqual('adserver.org');
expect(body.user.eids[0].uids).toEqual(jasmine.arrayContaining([
{
id: 'TEST_ADSRVR_ORG_STRING',
ext: {
rtiPartner: 'TDID'
}
}
]));
}

function validateBidRequestWithUspapi(request) {
var r = JSON.parse(request.body);

expect(r.regs.ext.us_privacy).toEqual('TEST_USPAPI_CONSENT_STRING');
}

module.exports = {
getPartnerId: getPartnerId,
getStatsId: getStatsId,
getCallbackType: getCallbackType,
getArchitecture: getArchitecture,
getConfig: getConfig,
getBidRequestRegex: getBidRequestRegex,
validateBidRequest: validateBidRequest,
getValidResponse: getValidResponse,
validateTargeting: validateTargeting,
getPassResponse: getPassResponse,
validateBidRequestWithAdSrvrOrg: validateBidRequestWithAdSrvrOrg,
validateBidRequestWithPrivacy: validateBidRequestWithPrivacy,
validateBidRequestWithUspapi: validateBidRequestWithUspapi
};
Loading