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

Fix tmax support #9

Open
wants to merge 3 commits into
base: master-v2
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 CHANGES.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# 2.1.2
- Added tmax support
- Removed lint errors
42 changes: 21 additions & 21 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions triple-lift-htb-validator.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var Inspector = require('../../../libs/external/schema-inspector.js');
* https://atinux.fr/schema-inspector/.
*/

var partnerValidator = function (configs) {
function partnerValidator(configs) {
var result = Inspector.validate({
type: 'object',
properties: {
Expand All @@ -52,7 +52,7 @@ var partnerValidator = function (configs) {
type: 'array',
exactLength: 2,
items: {
type: 'integer',
type: 'integer'
}
}
},
Expand All @@ -73,6 +73,6 @@ var partnerValidator = function (configs) {
}

return null;
};
}

module.exports = partnerValidator;
54 changes: 30 additions & 24 deletions triple-lift-htb.js
Original file line number Diff line number Diff line change
Expand Up @@ -161,20 +161,22 @@ function TripleLiftHtb(configs) {
var returnParcel = returnParcels[0];
var xSlot = returnParcel.xSlotRef;

/* request params */
/* Request params */
var requestParams = {
inv_code: xSlot.inventoryCode, // jshint ignore:line
inv_code: xSlot.inventoryCode, // eslint-disable-line
lib: 'ix',
fe: Browser.isFlashSupported() ? 1 : 0,
size: Size.arrayToString(xSlot.sizes),
referrer: Browser.getPageUrl(),
v: '2.1'
v: '2.1',
tmax: configs.timeout || 0
};

if (privacyEnabled) {
requestParams.gdpr = gdprStatus.applies;
requestParams.cmp_cs = gdprStatus.consentString;
requestParams.gdpr = gdprStatus.applies;
requestParams.cmp_cs = gdprStatus.consentString; // eslint-disable-line
}

if (xSlot.floor) {
requestParams.floor = xSlot.floor;
}
Expand Down Expand Up @@ -211,17 +213,17 @@ function TripleLiftHtb(configs) {
*
*/

/* ---------- Process adResponse and extract the bids into the bids array ------------*/
/* ---------- Process adResponse and extract the bids into the bids array ------------ */

/* there is only one bid because mra */
/* There is only one bid because mra */
var bid = responseObj;

/* --------------------------------------------------------------------------------- */

/* MRA partners receive only one parcel in the array. */
var returnParcel = returnParcels[0];

/* header stats information */
/* Header stats information */
var headerStatsInfo = {
sessionId: sessionId,
statsId: __profile.statsId,
Expand All @@ -236,18 +238,23 @@ function TripleLiftHtb(configs) {
EventsService.emit('hs_slot_bid', headerStatsInfo);
}

/* ---------- Fill the bid variables with data from the bid response here. ------------*/
/* ---------- Fill the bid variables with data from the bid response here. ------------ */
/* Using the above variable, curBid, extract various information about the bid and assign it to
* these local variables */

var bidPrice = bid.cpm; /* the bid price for the given slot */
var bidCreative = bid.ad; /* the creative/adm for the given slot that will be rendered if is the winner. */
var bidSize = [Number(bid.width), Number(bid.height)]; /* the size of the given slot */
/* The bid price for the given slot */
var bidPrice = bid.cpm;

/* The creative/adm for the given slot that will be rendered if is the winner. */
var bidCreative = bid.ad;

/* The size of the given slot */
var bidSize = [Number(bid.width), Number(bid.height)];

/* the dealId if applicable for this slot. */
var bidDealId = bid.deal_id; // jshint ignore:line
/* The dealId if applicable for this slot. */
var bidDealId = bid.deal_id; // eslint-disable-line

/* ---------------------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------------------- */

returnParcel.targetingType = 'slot';
returnParcel.targeting = {};
Expand Down Expand Up @@ -283,17 +290,17 @@ function TripleLiftHtb(configs) {
adm: bidCreative,
requestId: returnParcel.requestId,
size: returnParcel.size,
price: targetingCpm ? targetingCpm : undefined,
dealId: bidDealId ? bidDealId : undefined,
timeOfExpiry: __profile.features.demandExpiry.enabled ? (__profile.features.demandExpiry.value + System.now()) : 0
price: targetingCpm ? targetingCpm : undefined, // eslint-disable-line
dealId: bidDealId ? bidDealId : undefined, // eslint-disable-line
timeOfExpiry: __profile.features.demandExpiry.enabled ? (__profile.features.demandExpiry.value + System.now()) : 0 // eslint-disable-line
});

//? if(FEATURES.INTERNAL_RENDER) {
returnParcel.targeting.pubKitAdId = pubKitAdId;
//? }
} else {
//? if (DEBUG) {
Scribe.info(__profile.partnerId + ' no bid response for { id: ' + returnParcel.xSlotRef.inventoryCode + ' }.');
Scribe.info(__profile.partnerId + ' no bid response for { id: ' + returnParcel.xSlotRef.inventoryCode + ' }.'); // eslint-disable-line
//? }

if (__profile.enabledAnalytics.requestTime) {
Expand All @@ -302,7 +309,6 @@ function TripleLiftHtb(configs) {

returnParcel.pass = true;
}

}

/* =====================================
Expand All @@ -325,7 +331,7 @@ function TripleLiftHtb(configs) {
partnerId: 'TripleLiftHtb',
namespace: 'TripleLiftHtb',
statsId: 'TPL',
version: '2.1.1',
version: '2.1.2',
targetingType: 'slot',
enabledAnalytics: {
requestTime: true
Expand Down Expand Up @@ -353,7 +359,7 @@ function TripleLiftHtb(configs) {
requestType: Partner.RequestTypes.AJAX
};

/* ---------------------------------------------------------------------------------------*/
/* --------------------------------------------------------------------------------------- */

//? if (DEBUG) {
var results = ConfigValidators.partnerBaseConfig(configs) || PartnerSpecificValidator(configs);
Expand All @@ -363,7 +369,7 @@ function TripleLiftHtb(configs) {
}
//? }

/* build base bid request url */
/* Build base bid request url */
__baseUrl = Browser.getProtocol() + '//tlx.3lift.com/header/auction';

__baseClass = Partner(__profile, configs, null, {
Expand Down Expand Up @@ -402,7 +408,7 @@ function TripleLiftHtb(configs) {
//? if (TEST) {
__generateRequestObj: __generateRequestObj,
__parseResponse: __parseResponse
//? }
//? }
};

return Classify.derive(__baseClass, derivedClass);
Expand Down