Skip to content

Commit

Permalink
Merge pull request #165 from rtk-io/rtk-ccpa
Browse files Browse the repository at this point in the history
RTK: add CCPA support
  • Loading branch information
ix-certification authored Mar 6, 2020
2 parents aec233e + ebf5f71 commit 38e55a8
Show file tree
Hide file tree
Showing 7 changed files with 932 additions and 1 deletion.
1 change: 0 additions & 1 deletion .eslintignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,4 @@ b-real-time/
district-m/
just-premium/
kargo/
rtk/
share-through/
12 changes: 12 additions & 0 deletions rtk/CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# 2.0.2

- Add CCPA support

# 2.0.1

- Add publisher defined categories
- Add width & height params
- PageURL instead of Hostname for rtkreferer
- gdpr true/false instead of 1/0
- Fix eslint
- System tests
93 changes: 93 additions & 0 deletions rtk/DOCUMENTATION.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
# Rtk
## General Compatibility
|Feature| |
|---|---|
| Consent | Yes |
| Native Ad Support | No |
| SafeFrame Support | No |
| PMP Support | Yes |

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

## Adapter Information
| Info | |
|---|---|
| Partner Id | RtkHtb |
| Ad Server Responds in (Cents, Dollars, etc) | hundreds of a cent |
| Bid Type (Gross / Net) | Net |
| GAM Key (Open Market) | `ix_rtk_cpm` |
| GAM Key (Private Market) | `ix_rtk_dealid` |
| Ad Server URLs | `bidder.rtk.io` |
| Slot Mapping Style (Size / Multiple Sizes / Slot) | slot |
| Request Architecture (MRA / SRA) | SRA |

## Currencies Supported

- Dollars

## Bid Request Information
### Parameters
| Key | Required | Type | Description |
|---|---|---|---|
| `ai` | yes | string | The rtk auction ID |
| `sc` | yes | string | The rtk shortcode |
| `categories` | no | array | Deal ID Categories |

### Example
```javascript
https://bidder.rtk.io/0000/1234/aardvark?1234=1234&jsonp=false&rtkreferer=http%3A%2F%2Flocalhost%3A5837%2Fpublic%2Fdebugger%2Fadapter-debugger.html&categories=sport&gdpr=true&consent=TEST_GDPR_CONSENT_STRING&w=875&h=497
```

## Bid Response Information
### Bid Example
```javascript
[
{
"ex": "demo_exchange",
"width": 300,
"cpm": 1.0,
"cid": "1234",
"media": "banner",
"adm": "<html>.....</html>",
"id": "1234",
"height": 250
}
]
```
### Pass Example
```javascript
200 OK
```

## Configuration Information
### Configuration Keys
| Key | Required | Type | Description |
|---|---|---|---|
| `ai` | yes | string | The rtk auction ID |
| `sc` | yes | string | The rtk shortcode |
| `categories` | no | array | Deal ID Categories |
| `host` | no | string | custom ALIAS for the bidder hostname |

### Example
```javascript
{
"ai": "0000",
"sc": "1234",
"categories": ["sport"],
"host": "somealias.com"
}
```
13 changes: 13 additions & 0 deletions rtk/rtk-htb-exports.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
/**
* This file contains any necessary functions that need to be exposed to the outside world.
* Things like (render functions) will be exposed by adding them to the shellInterface variable, under the partners
* profile name. This function will then be accessible through the window.headertag.RtkHtb object.
* If necessary for backwards compatibility with old creatives, you can also add things directly to the
* window namespace here, but this is discouraged if it's not strictly needed.
*/

//? if (FEATURES.GPT_LINE_ITEMS) {
shellInterface.RtkHtb = {
render: SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'RtkHtb')
};
//? }
134 changes: 134 additions & 0 deletions rtk/rtk-htb-system-tests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
'use strict';

function getPartnerId() {
return 'RtkHtb';
}

function getStatsId() {
return 'RTK';
}

function getCallbackType() {
return 'NONE';
}

function getArchitecture() {
return 'SRA';
}

function getConfig() {
return {
host: 'bidder.rtk.io',
xSlots: {
1: {
ai: '0000',
sc: '1234',
categories: ['cat1', 'cat2'],
host: 'somealias.com'
},
2: {
ai: '0000',
sc: '1235',
categories: ['cat3', 'cat4']
}
}
};
}

function getBidRequestRegex() {
return {
method: 'GET',
urlRegex: /.*[bidder.rtk.io|somealias.com]\/0000\/1234_1235\/aardvark.*/
};
}

function validateBidRequest(request) {
expect(request.query.categories.split(',').length).toBe(4);
expect(request.query.jsonp).toBe('false');
expect(request.query['1234']).toBe('1234');
expect(request.query['1235']).toBe('1235');
expect(request.query.w).toBeDefined();
expect(request.query.h).toBeDefined();
expect(request.query.rtkreferer).toBeDefined();
}

function getValidResponse(request, creative) {
var adm = creative || '<a target="_blank" href="http://www.indexexchange.com"><div style="text-decoration: none; color: black; width: 300px; height:250px;background-color: #336eff;"; id="testDiv"><h1>&lt;header_tag&gt; certification testing: 1_1a1a1a1a, deal: 12346 (211474080)width: 300px; height:250px <iframe src="http://as.casalemedia.com/ifnotify?dfp_1_1a1a1a1a&referer=http://127.0.0.1:3000/p/DfpAuto/nonPrefetch/test?dev=desktop&displayMode=SRA&req=211474080" width="0" height="0" frameborder="0" scrolling="no" style="display:none;" marginheight="0" marginwidth="0"></iframe></h1></div><script>var thisDiv = document.getElementById("testDiv");thisDiv.style.fontFamily="verdana";</script></a>';
var response = [
{
id: '1234',
cpm: 2.0,
adm: adm,
width: '300',
height: '250',
ex: 'demo_exchange',
cid: '1234',
media: 'banner'
},
{
id: '1235',
cpm: 2.0,
adm: adm,
width: '300',
height: '250',
ex: 'demo_exchange',
cid: '1235',
media: 'banner'
}
];

return JSON.stringify(response);
}

function getPassResponse() {
var response = [
{
id: '1234',
cpm: 0,
adm: '',
ex: 'demo_exchange',
cid: '1234',
media: 'banner',
nurl: '',
error: 'No bids received for 1234'
},
{
id: '1235',
cpm: 0,
adm: '',
ex: 'demo_exchange',
cid: '1235',
media: 'banner',
nurl: '',
error: 'No bids received for 1235'
}
];

return JSON.stringify(response);
}

function validateTargeting(targetingMap) {
expect(targetingMap).toEqual(jasmine.objectContaining({
ix_rtk_cpm: jasmine.arrayContaining(['300x250_200']),
ix_rtk_id: jasmine.arrayContaining([jasmine.any(String)])
}));
}

function validateBidRequestWithPrivacy(request) {
expect(request.query.gdpr).toEqual('true');
expect(request.query.consent).toEqual('TEST_GDPR_CONSENT_STRING');
}

module.exports = {
getPartnerId: getPartnerId,
getStatsId: getStatsId,
getCallbackType: getCallbackType,
getArchitecture: getArchitecture,
getConfig: getConfig,
validateBidRequest: validateBidRequest,
getBidRequestRegex: getBidRequestRegex,
validateTargeting: validateTargeting,
getValidResponse: getValidResponse,
getPassResponse: getPassResponse,
validateBidRequestWithPrivacy: validateBidRequestWithPrivacy
};
74 changes: 74 additions & 0 deletions rtk/rtk-htb-validator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/**
* @author: Partner
* @license: UNLICENSED
*
* @copyright: Copyright (c) 2017 by Index Exchange. All rights reserved.
*
* The information contained within this document is confidential, copyrighted
* and or a trade secret. No part of this document may be reproduced or
* distributed in any form or by any means, in whole or in part, without the
* prior written permission of Index Exchange.
*/

'use strict';

////////////////////////////////////////////////////////////////////////////////
// Dependencies ////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

var Inspector = require('../../../libs/external/schema-inspector.js');

////////////////////////////////////////////////////////////////////////////////
// Main ////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////

/* =============================================================================
* STEP 0 | Config Validation
* -----------------------------------------------------------------------------
* This file contains the necessary validation for the partner configuration.
* This validation will be performed on the partner specific configuration object
* that is passed into the wrapper. The wrapper uses an outside library called
* schema-insepctor to perform the validation. Information about it can be found here:
* https://atinux.fr/schema-inspector/.
*/
function partnerValidator(configs) {
var result = Inspector.validate({
type: 'object',
properties: {
xSlots: {
type: 'object',
properties: {
'*': {
type: 'object',
properties: {
ai: {
type: 'string',
minLength: 4
},
sc: {
type: 'string',
minLength: 4
},
categories: {
type: 'array',
optional: true
},
host: {
type: 'string',
optional: true
}
}
}
}
}
}
}, configs);

if (!result.valid) {
return result.format();
}

return null;
}

module.exports = partnerValidator;
Loading

0 comments on commit 38e55a8

Please sign in to comment.