forked from indexexchange/ix-library-adapters
-
Notifications
You must be signed in to change notification settings - Fork 0
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
Add triplelift adapter #1
Open
davidwoodsandersen
wants to merge
11
commits into
master
Choose a base branch
from
triplelift-adapter
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+736
−1
Open
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
60b81b4
Add triplelift adapter
davidwoodsandersen d803d45
Add tmax query param
davidwoodsandersen 5e4efe9
Hardcode HTTPS protocol for API request
davidwoodsandersen 4076aa4
Add CCPA query param
davidwoodsandersen 3f4ba06
Update adapter version
davidwoodsandersen 0e5b78a
Consolidate version information
davidwoodsandersen 0ac6a10
Remove obsolete query param
davidwoodsandersen 843c8f4
Add documentation
davidwoodsandersen 1fda9e1
Correct formatting
davidwoodsandersen b92f737
Enable linter and fix errors
davidwoodsandersen bb7fd09
Update timeout value
davidwoodsandersen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,3 @@ just-premium/ | |
kargo/ | ||
rtk/ | ||
share-through/ | ||
triple-lift/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# 2.1.2 | ||
- Added tmax support | ||
- Added CCPA support | ||
- Hardcoded HTTPS protocol for API endpoint |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# TripleLift | ||
## 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 | TripleLiftHtb | | ||
| Ad Server Responds in (Cents, Dollars, etc) | cents | | ||
| Bid Type (Gross / Net) | net | | ||
| GAM Key (Open Market) | ix_tpl_cpm | | ||
| GAM Key (Private Market) | ix_tpl_cpm | | ||
| Ad Server URLs | https://tlx.3lift.com/header/auction | | ||
| Slot Mapping Style (Size / Multiple Sizes / Slot) | slot | | ||
| Request Architecture (MRA / SRA) | MRA | | ||
|
||
## Currencies Supported | ||
|
||
## Bid Request Information | ||
### Parameters | ||
| Key | Required | Type | Description | | ||
|---|---|---|---| | ||
| inv_code | true | string | supply inventory code | | ||
| lib | true | string | supply source ("ix") | | ||
| size | true | string | supply dimensions (e.g. "300x250") | | ||
| referrer | true | string | document referrer URL | | ||
| v | true | number | adapter version number | | ||
|
||
### Example | ||
``` | ||
HTTP GET https://tlx.3lift.com/header/auction?inv_code=DailyBeast_ROS_Desktop_728x90&lib=ix&fe=0&size=728x90&referrer=https%3A%2F%2Fwww.thedailybeast.com%2Fukrainian-plane-crash-in-iran-raises-issue-of-flaw-in-another-boeing-737-model%3Fref%3Dwrap&v=2.1 | ||
``` | ||
|
||
## Bid Response Information | ||
### Bid Example | ||
```javascript | ||
{ | ||
"ad": "[HTML AD MARKUP]", | ||
"cpm": 3.651, | ||
"crid": "3335_18160_T4915441", | ||
"height": 250, | ||
"imp_id": "1", | ||
"tl_source": "tlx", | ||
"width": 300 | ||
} | ||
``` | ||
### Pass Example | ||
```javascript | ||
{"status":"no_bid"} | ||
``` | ||
|
||
## Configuration Information | ||
### Configuration Keys | ||
| Key | Required | Type | Description | | ||
|---|---|---|---| | ||
| inventoryCode | yes | string | placement identifier | | ||
| sizes | yes | array | ad slot dimensions | | ||
### Example | ||
```javascript | ||
{ | ||
"inventoryCode": "DailyBeast_ROS_Desktop_300x250", | ||
"sizes": [[300, 250]] | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
//? if(FEATURES.GPT_LINE_ITEMS) { | ||
shellInterface.TripleLiftHtb = { | ||
render: SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'TripleLiftHtb') | ||
}; | ||
|
||
shellInterface.TPL = { | ||
render: SpaceCamp.services.RenderService.renderDfpAd.bind(null, 'TripleLiftHtb') | ||
}; | ||
//? } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
'use strict'; | ||
|
||
function getPartnerId() { | ||
return 'TripleLiftHtb'; | ||
} | ||
|
||
function getStatsId() { | ||
return 'TPL'; | ||
} | ||
|
||
function getCallbackType() { | ||
return 'NONE'; | ||
} | ||
|
||
function getArchitecture() { | ||
return 'MRA'; | ||
} | ||
|
||
function getConfig() { | ||
return { | ||
xSlots: { | ||
1: { | ||
inventoryCode: 'test', | ||
sizes: [[300, 250]] | ||
} | ||
} | ||
}; | ||
} | ||
|
||
function getBidRequestRegex() { | ||
return { | ||
method: 'GET', | ||
urlRegex: /https:\/\/tlx\.3lift\.com\/header\/auction/ | ||
}; | ||
} | ||
|
||
function validateBidRequest(request) { | ||
var r = request.query; | ||
expect(r.v).toBe('2.1.2'); | ||
expect(r.lib).toBe('ix'); | ||
expect(r.inv_code).toBe('test'); | ||
expect(r.size).toBe('300x250'); | ||
expect(r.cmp_cs).toBe(''); | ||
expect(r.gdpr).toBe('false'); | ||
expect(r.referrer).toBe(document.URL); | ||
expect(r.tmax).toBe('100000'); | ||
} | ||
|
||
function validateBidRequestWithPrivacy(request) { | ||
var r = request.query; | ||
expect(r.v).toBe('2.1.2'); | ||
expect(r.lib).toBe('ix'); | ||
expect(r.inv_code).toBe('test'); | ||
expect(r.size).toBe('300x250'); | ||
expect(r.gdpr).toBe('true'); | ||
expect(r.cmp_cs).toBe('TEST_GDPR_CONSENT_STRING'); | ||
expect(r.referrer).toBe(document.URL); | ||
expect(r.tmax).toBe('100000'); | ||
} | ||
|
||
function getValidResponse(request, creative) { | ||
return JSON.stringify({ | ||
ad: creative, | ||
cpm: 2.00, | ||
crid: '3898_17463_747551', | ||
width: 300, | ||
height: 250, | ||
imp_id: '1', | ||
tl_source: 'hdx' | ||
}); | ||
} | ||
|
||
function validateTargeting(targetingMap) { | ||
expect(targetingMap).toEqual(jasmine.objectContaining({ | ||
ix_tpl_cpm: jasmine.arrayContaining(['300x250_200']), | ||
ix_tpl_id: jasmine.arrayContaining([jasmine.any(String)]) | ||
})); | ||
} | ||
|
||
function getPassResponse() { | ||
return JSON.stringify({ | ||
status: 'no_bid' | ||
}); | ||
} | ||
|
||
function getValidResponseWithDeal(request, creative) { | ||
return JSON.stringify({ | ||
ad: creative, | ||
cpm: 2.00, | ||
crid: '3898_17463_747551', | ||
width: 300, | ||
height: 250, | ||
imp_id: '1', | ||
deal_id: 'TEST_DEAL_ID', | ||
tl_source: 'hdx' | ||
}); | ||
} | ||
|
||
function validateTargetingWithDeal(targetingMap) { | ||
expect(targetingMap).toEqual(jasmine.objectContaining({ | ||
ix_tpl_cpm: jasmine.arrayContaining(['300x250_200']), | ||
ix_tpl_dealid: jasmine.arrayContaining(['TEST_DEAL_ID']), | ||
ix_tpl_id: jasmine.arrayContaining([jasmine.any(String)]) | ||
})); | ||
} | ||
|
||
module.exports = { | ||
getPartnerId: getPartnerId, | ||
getStatsId: getStatsId, | ||
getCallbackType: getCallbackType, | ||
getArchitecture: getArchitecture, | ||
getConfig: getConfig, | ||
getBidRequestRegex: getBidRequestRegex, | ||
validateBidRequest: validateBidRequest, | ||
validateBidRequestWithPrivacy: validateBidRequestWithPrivacy, | ||
getValidResponse: getValidResponse, | ||
validateTargeting: validateTargeting, | ||
getPassResponse: getPassResponse, | ||
getValidResponseWithDeal: getValidResponseWithDeal, | ||
validateTargetingWithDeal: validateTargetingWithDeal | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,78 @@ | ||
/** | ||
* @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: { | ||
inventoryCode: { | ||
type: 'string', | ||
minLength: 1 | ||
}, | ||
sizes: { | ||
type: 'array', | ||
items: { | ||
type: 'array', | ||
exactLength: 2, | ||
items: { | ||
type: 'integer' | ||
} | ||
} | ||
}, | ||
floor: { | ||
type: 'number', | ||
optional: true, | ||
gt: 0 | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
}, configs); | ||
|
||
if (!result.valid) { | ||
return result.format(); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
module.exports = partnerValidator; |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm assuming the ix system uses all these?