From e4f79af53bad55a8f448a2145d2288e0754c5939 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Thu, 29 Aug 2019 14:27:07 +0530 Subject: [PATCH 01/14] lemmaBidAdapter.js Added lemma bid adapter file --- modules/lemmaBidAdapter.js | 406 +++++++++++++++++++++++++++++++++++++ 1 file changed, 406 insertions(+) create mode 100644 modules/lemmaBidAdapter.js diff --git a/modules/lemmaBidAdapter.js b/modules/lemmaBidAdapter.js new file mode 100644 index 00000000000..b64dc040344 --- /dev/null +++ b/modules/lemmaBidAdapter.js @@ -0,0 +1,406 @@ +import * as utils from '../src/utils'; +import { registerBidder } from '../src/adapters/bidderFactory'; +import { BANNER, VIDEO } from '../src/mediaTypes'; + +var BIDDER_CODE = 'lemma'; +var LOG_WARN_PREFIX = 'LEMMA: '; +var ENDPOINT = '//ads.lemmatechnologies.com/lemma/servad'; +var DEFAULT_CURRENCY = 'USD'; +var AUCTION_TYPE = 2; +var DEFAULT_TMAX = 300; +var DEFAULT_NET_REVENUE = false; + +export var spec = { + + code: BIDDER_CODE, + supportedMediaTypes: [BANNER, VIDEO], + + isBidRequestValid: bid => { + if (bid && bid.params) { + if (utils.isStr(bid.params.pubId) || !bid.params.pubId) { + utils.logWarn(LOG_WARN_PREFIX + 'Error: publisherId is mandatory and cannot be string. Call to OpenBid will not be sent for ad unit: ' + JSON.stringify(bid)); + return false; + } + if (!bid.params.adunitId) { + utils.logWarn(LOG_WARN_PREFIX + 'Error: adUnitId is mandatory. Call to OpenBid will not be sent for ad unit: ' + JSON.stringify(bid)); + return false; + } + // video ad validation + if (bid.params.hasOwnProperty('video')) { + if (!bid.params.video.hasOwnProperty('mimes') || !utils.isArray(bid.params.video.mimes) || bid.params.video.mimes.length === 0) { + utils.logWarn(LOG_WARN_PREFIX + 'Error: For video ads, mimes is mandatory and must specify atlease 1 mime value. Call to OpenBid will not be sent for ad unit:' + JSON.stringify(bid)); + return false; + } + } + return true; + } + return false; + }, + buildRequests: (bidRequests, bidderRequest) => { + var refererInfo; + if (bidderRequest && bidderRequest.refererInfo) { + refererInfo = bidderRequest.refererInfo; + } + var conf = _initConf(refererInfo); + const request = oRTBTemplate(bidRequests, conf); + if (request.imp.length == 0) { + return; + } + setOtherParams(bidderRequest, request); + const endPoint = endPointURL(bidRequests); + return { + method: 'POST', + url: endPoint, + data: JSON.stringify(request), + }; + }, + interpretResponse: (response, request) => { + return parseRTBResponse(request, response.body); + }, +}; + +function _initConf(refererInfo) { + var conf = {}; + conf.pageURL = utils.getTopWindowUrl(); + if (refererInfo && refererInfo.referer) { + conf.refURL = refererInfo.referer; + } else { + conf.refURL = ''; + } + return conf; +} + +function parseRTBResponse(request, response) { + var bidResponses = []; + try { + if (cfn(response.seatbid).length > 0) { + var currency = cfn(response.curr) || DEFAULT_CURRENCY; + var seatbid = cfn(response.seatbid); + seatbid.forEach(seatbidder => { + var bidder = cfn(seatbidder.bid); + bidder.forEach(bid => { + var req = parse(request.data); + var newBid = { + requestId: bid.impid, + cpm: parseFloat(bid.price).toFixed(2), + width: bid.w, + height: bid.h, + creativeId: bid.crid, + currency: currency, + netRevenue: DEFAULT_NET_REVENUE, + ttl: 300, + referrer: req.site.ref, + ad: bid.adm + }; + if (bid.dealid) { + newBid.dealId = bid.dealid; + } + if (req.imp && req.imp.length > 0) { + newBid.mediaType = req.mediaType; + req.imp.forEach(robj => { + if (bid.impid === robj.id) { + switch (newBid.mediaType) { + case BANNER: + break; + case VIDEO: + newBid.width = bid.hasOwnProperty('w') ? bid.w : robj.video.w; + newBid.height = bid.hasOwnProperty('h') ? bid.h : robj.video.h; + newBid.vastXml = bid.adm; + break; + } + } + }); + } + bidResponses.push(newBid); + }); + }); + } + } catch (error) { + utils.logError(LOG_WARN_PREFIX, 'ERROR ', error); + } + return bidResponses; +} + +function oRTBTemplate(bidRequests, conf) { + try { + var oRTBObject = { + id: '' + new Date().getTime(), + at: AUCTION_TYPE, + tmax: DEFAULT_TMAX, + cur: [DEFAULT_CURRENCY], + imp: _getImpressionArray(bidRequests), + user: {}, + ext: {} + }; + var bid = bidRequests[0]; + var app = _getAppObject(bid); + var site = _getSiteObject(bid, conf); + var device = _getDeviceObject(bid); + if (cfn(app) != '') { + oRTBObject.app = app; + } + if (cfn(site) != '') { + oRTBObject.site = site; + } + if (cfn(device) != '') { + oRTBObject.device = device; + } + return oRTBObject; + } catch (ex) { + utils.logError(LOG_WARN_PREFIX, 'ERROR ', ex); + } +} + +function _getImpressionArray(request) { + var impArray = []; + var map = request.map(bid => _getImpressionObject(bid)); + if (cfn(map).length > 0) { + map.forEach(o => { + if (cfn(o) != '') { + impArray.push(o); + } + }); + } + return impArray; +} + +function endPointURL(request) { + var params = request && request[0].params ? request[0].params : null; + if (cfn(params) != '') { + var pubId = cfn(params.pubId) != '' ? params.pubId : 0; + var adunitId = cfn(params.adunitId) != '' ? params.adunitId : 0; + return ENDPOINT + '?pid=' + pubId + '&aid=' + adunitId; + } + return null; +} + +function _getDomain(url) { + var a = document.createElement('a'); + a.setAttribute('href', url); + return a.hostname; +} + +function _getSiteObject(request, conf) { + var params = request && request.params ? request.params : null; + if (cfn(params) != '') { + var pubId = cfn(params.pubId) != '' ? params.pubId : '0'; + var siteId = cfn(params.siteId) != '' ? params.siteId : '0'; + var appParams = cfn(params.app); + if (!appParams) { + return { + publisher: { + id: pubId.toString() + }, + domain: _getDomain(conf.pageURL), + id: siteId.toString(), + ref: conf.refURL, + page: conf.pageURL + }; + } + } + return null; +} + +function _getAppObject(request) { + var params = request && request.params ? request.params : null; + if (cfn(params) != '') { + var pubId = cfn(params.pubId) != '' ? cfn(params.pubId) : '0'; + var appParams = cfn(params.app); + if (cfn(appParams)) { + return { + publisher: { + id: pubId.toString(), + }, + id: appParams.id, + name: appParams.name, + bundle: appParams.bundle, + storeurl: appParams.storeUrl, + domain: appParams.domain, + cat: appParams.categories, + pagecat: appParams.page_category + }; + } + } + return null; +} + +function _getDeviceObject(request) { + var params = request && request.params ? request.params : null; + if (cfn(params) != null) { + return { + dnt: utils.getDNT() ? 1 : 0, + ua: navigator.userAgent, + language: (navigator.language || navigator.browserLanguage || navigator.userLanguage || navigator.systemLanguage), + w: (window.screen.width || window.innerWidth), + h: (window.screen.height || window.innerHeigh), + geo: { + country: params.country, + lat: params.latitude, + lon: params.longitude, + region: params.region, + city: params.city, + zip: params.zip + }, + ip: params.ip, + devicetype: params.device_type, + ifa: params.ifa, + }; + } + return null; +} + +function setOtherParams(request, ortbRequest) { + var params = request && request.params ? request.params : null; + if (request && request.gdprConsent) { + ortbRequest.regs = { ext: { gdpr: request.gdprConsent.gdprApplies ? 1 : 0 } }; + ortbRequest.user = { ext: { consent: request.gdprConsent.consentString } }; + } + if (cfn(params) != '') { + ortbRequest.tmax = params.tmax; + ortbRequest.bcat = params.bcat; + } +} + +function _getSizes(request) { + var size = cfn(cfn(request).sizes)[0]; + if (utils.isArray(size) && cfn(size).length > 0) { + return size; + } + return null; +} + +function _getBannerRequest(bid) { + var bObj; + var adFormat = []; + if (cfn(bid.mediaType) === 'banner' || utils.deepAccess(bid, 'mediaTypes.banner')) { + var params = cfn(bid) != '' ? bid.params : null; + var bannerData = cfn(params.banner); + var sizes = _getSizes(bid); + if (cfn(sizes).length == 0) { + sizes = cfn(bid.mediaTypes.banner.sizes[0]); + } + if (cfn(sizes).length > 0) { + bObj = {}; + bObj.w = cfn(sizes[0]); + bObj.h = cfn(sizes[1]); + bObj.pos = 0; + if (cfn(bannerData) != '') { + bObj = utils.deepClone(bannerData); + } + sizes = cfn(bid.mediaTypes.banner.sizes); + if (cfn(sizes).length > 0) { + adFormat = []; + sizes.forEach(function(size) { + if (size.length > 1) { + adFormat.push({ w: size[0], h: size[1] }); + } + }); + if (adFormat.length > 0) { + bObj.format = adFormat; + } + } + } else { + utils.logWarn(LOG_WARN_PREFIX + 'Error: mediaTypes.banner.sizes missing for adunit: ' + bid.params.adunitId); + } + } + return bObj; +} + +function _getVideoRequest(bid) { + var vObj; + if (cfn(bid.mediaType) === 'video' || utils.deepAccess(bid, 'mediaTypes.video')) { + var params = cfn(bid) != '' ? bid.params : null; + var sizes = _getSizes(bid); + if (cfn(sizes).length == 0) { + sizes = cfn(bid.mediaTypes.video.playerSize); + } + if (cfn(sizes).length > 0) { + var videoData = cfn(params.video); + vObj = {}; + if (cfn(videoData) !== '') { + vObj = utils.deepClone(videoData); + } + vObj.w = cfn(sizes[0]); + vObj.h = cfn(sizes[1]); + } else { + utils.logWarn(LOG_WARN_PREFIX + 'Error: mediaTypes.video.sizes missing for adunit: ' + bid.params.adunitId); + } + } + return vObj; +} + +function _getImpressionObject(bid) { + var impression = {}; + var bObj; + var vObj; + var sizes = bid.hasOwnProperty('sizes') ? bid.sizes : []; + var mediaTypes = ''; + var format = []; + var params = cfn(bid.params) != '' ? bid.params : null; + impression = { + id: cfn(bid.bidId), + tagid: cfn(params.adunitId).toString() != '' ? cfn(params.adunitId).toString() : undefined, + secure: window.location.protocol === 'https:' ? 1 : 0, + bidfloorcur: cfn(params.currency) != '' ? params.currency : DEFAULT_CURRENCY + }; + + if (cfn(params.bidFloor) != '') { + impression.bidfloor = cfn(params.bidFloor); + } + + if (bid.hasOwnProperty('mediaTypes')) { + for (mediaTypes in bid.mediaTypes) { + switch (mediaTypes) { + case BANNER: + bObj = _getBannerRequest(bid); + if (cfn(bObj) !== '') { + impression.banner = bObj; + } + break; + case VIDEO: + vObj = _getVideoRequest(bid); + if (cfn(vObj) !== '') { + impression.video = vObj; + } + break; + } + } + } else { + bObj = { + pos: 0, + w: sizes && sizes[0] ? sizes[0][0] : 0, + h: sizes && sizes[0] ? sizes[0][1] : 0, + }; + if (utils.isArray(sizes) && sizes.length > 1) { + sizes = sizes.splice(1, sizes.length - 1); + sizes.forEach(size => { + format.push({ + w: size[0], + h: size[1] + }); + }); + bObj.format = format; + } + impression.banner = bObj; + } + + return impression.hasOwnProperty(BANNER) || + impression.hasOwnProperty(VIDEO) ? impression : undefined; +} + +function parse(rawResp) { + try { + if (rawResp) { + return JSON.parse(rawResp); + } + } catch (ex) { + utils.logError(LOG_WARN_PREFIX, 'ERROR', ex); + } + return null; +} + +function cfn(el) { + return void 0 === el || el === null ? '' : el; +} + +registerBidder(spec); From c2e3f7f6c1a60899606f2f1ba3dbed0ccca55a17 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Thu, 29 Aug 2019 14:28:26 +0530 Subject: [PATCH 02/14] lemmaBidAdapter.md Added lemma bid adapter md file --- modules/lemmaBidAdapter.md | 67 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 67 insertions(+) create mode 100644 modules/lemmaBidAdapter.md diff --git a/modules/lemmaBidAdapter.md b/modules/lemmaBidAdapter.md new file mode 100644 index 00000000000..1b6c54a9e4d --- /dev/null +++ b/modules/lemmaBidAdapter.md @@ -0,0 +1,67 @@ +# Overview + +``` +Module Name: Lemma Bid Adapter +Module Type: Bidder Adapter +Maintainer: lemmadev@lemmatechnologies.com +``` + +# Description + +Connects to Lemma exchange for bids. +Lemma bid adapter supports Video, Banner formats. + +# Sample Banner Ad Unit: For Publishers +``` +var adUnits = [{ + code: 'div-lemma-ad-1', + mediaTypes: { + banner: { + sizes: [[300, 250], [300, 600]], // required + } + }, + // Replace this object to test a new Adapter! + bids: [{ + bidder: 'lemma', + params: { + pubId: '1', // required + adunitId: '3768', // required + latitude: 37.3230, + longitude: -122.0322, + device_type: 2, + banner: { + w: 300, + h: 250 + } + } + }] +}]; +``` + +# Sample Video Ad Unit: For Publishers +``` +var adUnits = [{ + mediaType: 'video', + sizes: [[640, 480]], + mediaTypes: { + video: { + playerSize: [640, 480], // required + context: 'instream' + } + }, + // Replace this object to test a new Adapter! + bids: [{ + bidder: 'lemma', + params: { + pubId: '1', // required + adunitId: '3769', // required + latitude: 37.3230, + longitude: -122.0322, + device_type: 4, + video: { + mimes: ['video/mp4','video/x-flv'], // required + } + } + }] +}]; +``` From 5bf217937b1e15bbd385523339b96ac87c83c000 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Thu, 29 Aug 2019 14:30:35 +0530 Subject: [PATCH 03/14] lemmaBidAdapter_spec.js Added lemma bid adapter test spec file --- test/spec/modules/lemmaBidAdapter_spec.js | 335 ++++++++++++++++++++++ 1 file changed, 335 insertions(+) create mode 100644 test/spec/modules/lemmaBidAdapter_spec.js diff --git a/test/spec/modules/lemmaBidAdapter_spec.js b/test/spec/modules/lemmaBidAdapter_spec.js new file mode 100644 index 00000000000..624e763ebe1 --- /dev/null +++ b/test/spec/modules/lemmaBidAdapter_spec.js @@ -0,0 +1,335 @@ +import { expect } from 'chai'; +import { spec } from 'modules/lemmaBidAdapter'; +import * as utils from 'src/utils'; +const constants = require('src/constants.json'); + +describe('lemmaBidAdapter', function() { + var bidRequests; + var videoBidRequests; + var bidResponses; + beforeEach(function() { + bidRequests = [{ + bidder: 'lemma', + mediaType: 'banner', + mediaTypes: { + banner: { + sizes: [ + [300, 250], + [300, 600] + ], + } + }, + params: { + pubId: 1001, + adunitId: 1, + currency: 'AUD', + geo: { + lat: '12.3', + lon: '23.7', + } + }, + sizes: [ + [300, 250], + [300, 600] + ] + }]; + videoBidRequests = [{ + code: 'video1', + mediaType: 'video', + mediaTypes: { + video: { + playerSize: [640, 480], + context: 'instream' + } + }, + bidder: 'lemma', + params: { + pubId: 1001, + adunitId: 1, + video: { + mimes: ['video/mp4', 'video/x-flv'], + skippable: true, + minduration: 5, + maxduration: 30 + } + } + }]; + bidResponses = { + 'body': { + 'id': '93D3BAD6-E2E2-49FB-9D89-920B1761C865', + 'seatbid': [{ + 'bid': [{ + 'id': '74858439-49D7-4169-BA5D-44A046315B2F', + 'impid': '22bddb28db77d', + 'price': 1.3, + 'adm': '

lemma"Connecting Advertisers and Publishers directly"

', + 'adomain': ['amazon.com'], + 'iurl': 'https://thetradedesk-t-general.s3.amazonaws.com/AdvertiserLogos/vgl908z.png', + 'cid': '22918', + 'crid': 'v55jutrh', + 'h': 250, + 'w': 300, + 'ext': {} + }] + }] + } + }; + }); + describe('implementation', function() { + describe('Bid validations', function() { + it('valid bid case', function() { + var validBid = { + bidder: 'lemma', + params: { + pubId: 1001, + adunitId: 1 + } + }, + isValid = spec.isBidRequestValid(validBid); + expect(isValid).to.equal(true); + }); + it('invalid bid case', function() { + var isValid = spec.isBidRequestValid(); + expect(isValid).to.equal(false); + }); + it('invalid bid case: pubId not passed', function() { + var validBid = { + bidder: 'lemma', + params: { + adunitId: 1 + } + }, + isValid = spec.isBidRequestValid(validBid); + expect(isValid).to.equal(false); + }); + it('invalid bid case: pubId is not number', function() { + var validBid = { + bidder: 'lemma', + params: { + pubId: '301', + adunitId: 1 + } + }, + isValid = spec.isBidRequestValid(validBid); + expect(isValid).to.equal(false); + }); + it('invalid bid case: adunitId is not passed', function() { + var validBid = { + bidder: 'lemma', + params: { + pubId: 1001 + } + }, + isValid = spec.isBidRequestValid(validBid); + expect(isValid).to.equal(false); + }); + it('invalid bid case: video bid request mimes is not passed', function() { + var validBid = { + bidder: 'lemma', + params: { + pubId: 1001, + adunitId: 1, + video: { + skippable: true, + minduration: 5, + maxduration: 30 + } + } + }, + isValid = spec.isBidRequestValid(validBid); + expect(isValid).to.equal(false); + validBid.params.video.mimes = []; + isValid = spec.isBidRequestValid(validBid); + expect(isValid).to.equal(false); + }); + }); + describe('Request formation', function() { + it('buildRequests function should not modify original bidRequests object', function() { + var originalBidRequests = utils.deepClone(bidRequests); + var request = spec.buildRequests(bidRequests); + expect(bidRequests).to.deep.equal(originalBidRequests); + }); + it('Endpoint checking', function() { + var request = spec.buildRequests(bidRequests); + expect(request.url).to.equal('//ads.lemmatechnologies.com/lemma/servad?pid=1001&aid=1'); + expect(request.method).to.equal('POST'); + }); + it('Request params check', function() { + var request = spec.buildRequests(bidRequests); + var data = JSON.parse(request.data); + expect(data.site.domain).to.be.a('string'); // domain should be set + expect(data.site.publisher.id).to.equal(bidRequests[0].params.pubId.toString()); // publisher Id + expect(data.imp[0].tagid).to.equal('1'); // tagid + expect(data.imp[0].bidfloorcur).to.equal(bidRequests[0].params.currency); + }); + it('Request params check without mediaTypes object', function() { + var bidRequests = [{ + bidder: 'lemma', + params: { + pubId: 1001, + adunitId: 1, + currency: 'AUD' + }, + sizes: [ + [300, 250], + [300, 600] + ] + }]; + var request = spec.buildRequests(bidRequests); + var data = JSON.parse(request.data); + expect(data.imp[0].banner.w).to.equal(300); // width + expect(data.imp[0].banner.h).to.equal(250); // height + expect(data.imp[0].banner.format).exist.and.to.be.an('array'); + expect(data.imp[0].banner.format[0]).exist.and.to.be.an('object'); + expect(data.imp[0].banner.format[0].w).to.equal(300); // width + expect(data.imp[0].banner.format[0].h).to.equal(600); // height + }); + it('Request params check: without tagId', function() { + delete bidRequests[0].params.adunitId; + var request = spec.buildRequests(bidRequests); + var data = JSON.parse(request.data); + expect(data.site.domain).to.be.a('string'); // domain should be set + expect(data.site.publisher.id).to.equal(bidRequests[0].params.pubId.toString()); // publisher Id + expect(data.imp[0].tagid).to.equal(undefined); // tagid + expect(data.imp[0].bidfloorcur).to.equal(bidRequests[0].params.currency); + }); + it('Request params multi size format object check', function() { + var bidRequests = [{ + bidder: 'lemma', + mediaTypes: { + banner: { + sizes: [ + [300, 250], + [300, 600] + ], + } + }, + params: { + pubId: 1001, + adunitId: 1, + currency: 'AUD' + }, + sizes: [ + [300, 250], + [300, 600] + ] + }]; + /* case 1 - size passed in adslot */ + var request = spec.buildRequests(bidRequests); + var data = JSON.parse(request.data); + expect(data.imp[0].banner.w).to.equal(300); // width + expect(data.imp[0].banner.h).to.equal(250); // height + /* case 2 - size passed in adslot as well as in sizes array */ + bidRequests[0].sizes = [ + [300, 600], + [300, 250] + ]; + bidRequests[0].mediaTypes = { + banner: { + sizes: [ + [300, 600], + [300, 250] + ] + } + }; + request = spec.buildRequests(bidRequests); + data = JSON.parse(request.data); + expect(data.imp[0].banner.w).to.equal(300); // width + expect(data.imp[0].banner.h).to.equal(600); // height + /* case 3 - size passed in sizes but not in adslot */ + bidRequests[0].params.adunitId = 1; + bidRequests[0].sizes = [ + [300, 250], + [300, 600] + ]; + bidRequests[0].mediaTypes = { + banner: { + sizes: [ + [300, 250], + [300, 600] + ] + } + }; + request = spec.buildRequests(bidRequests); + data = JSON.parse(request.data); + expect(data.imp[0].banner.w).to.equal(300); // width + expect(data.imp[0].banner.h).to.equal(250); // height + expect(data.imp[0].banner.format).exist.and.to.be.an('array'); + expect(data.imp[0].banner.format[0]).exist.and.to.be.an('object'); + expect(data.imp[0].banner.format[0].w).to.equal(300); // width + expect(data.imp[0].banner.format[0].h).to.equal(250); // height + }); + it('Request params currency check', function() { + var bidRequest = [{ + bidder: 'lemma', + mediaTypes: { + banner: { + sizes: [ + [300, 250], + [300, 600] + ], + } + }, + params: { + pubId: 1001, + adunitId: 1, + currency: 'AUD' + }, + sizes: [ + [300, 250], + [300, 600] + ] + }]; + /* case 1 - + currency specified in adunits + output: imp[0] use currency specified in bidRequests[0].params.currency + */ + var request = spec.buildRequests(bidRequest); + var data = JSON.parse(request.data); + expect(data.imp[0].bidfloorcur).to.equal(bidRequests[0].params.currency); + /* case 2 - + currency specified in adunit + output: imp[0] use default currency - USD + */ + delete bidRequest[0].params.currency; + request = spec.buildRequests(bidRequest); + data = JSON.parse(request.data); + expect(data.imp[0].bidfloorcur).to.equal('USD'); + }); + it('Request params check for video ad', function() { + var request = spec.buildRequests(videoBidRequests); + var data = JSON.parse(request.data); + expect(data.imp[0].video).to.exist; + expect(data.imp[0].tagid).to.equal('1'); + expect(data.imp[0]['video']['mimes']).to.exist.and.to.be.an('array'); + expect(data.imp[0]['video']['mimes'][0]).to.equal(videoBidRequests[0].params.video['mimes'][0]); + expect(data.imp[0]['video']['mimes'][1]).to.equal(videoBidRequests[0].params.video['mimes'][1]); + expect(data.imp[0]['video']['minduration']).to.equal(videoBidRequests[0].params.video['minduration']); + expect(data.imp[0]['video']['maxduration']).to.equal(videoBidRequests[0].params.video['maxduration']); + expect(data.imp[0]['video']['w']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[0]); + expect(data.imp[0]['video']['h']).to.equal(videoBidRequests[0].mediaTypes.video.playerSize[1]); + }); + describe('Response checking', function() { + it('should check for valid response values', function() { + var request = spec.buildRequests(bidRequests); + var data = JSON.parse(request.data); + var response = spec.interpretResponse(bidResponses, request); + expect(response).to.be.an('array').with.length.above(0); + expect(response[0].requestId).to.equal(bidResponses.body.seatbid[0].bid[0].impid); + expect(response[0].cpm).to.equal((bidResponses.body.seatbid[0].bid[0].price).toFixed(2)); + expect(response[0].width).to.equal(bidResponses.body.seatbid[0].bid[0].w); + expect(response[0].height).to.equal(bidResponses.body.seatbid[0].bid[0].h); + if (bidResponses.body.seatbid[0].bid[0].crid) { + expect(response[0].creativeId).to.equal(bidResponses.body.seatbid[0].bid[0].crid); + } else { + expect(response[0].creativeId).to.equal(bidResponses.body.seatbid[0].bid[0].id); + } + expect(response[0].dealId).to.equal(bidResponses.body.seatbid[0].bid[0].dealid); + expect(response[0].currency).to.equal('USD'); + expect(response[0].netRevenue).to.equal(false); + expect(response[0].ttl).to.equal(300); + }); + }); + }); + }); +}); From 691066690e3d0ccaea616a6e6691d08792695f0f Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Thu, 29 Aug 2019 15:08:26 +0530 Subject: [PATCH 04/14] Update lemmaBidAdapter.js Fixed automated code review alert comparison between inconvertible types --- modules/lemmaBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lemmaBidAdapter.js b/modules/lemmaBidAdapter.js index b64dc040344..cc84f14f4b1 100644 --- a/modules/lemmaBidAdapter.js +++ b/modules/lemmaBidAdapter.js @@ -226,7 +226,7 @@ function _getAppObject(request) { function _getDeviceObject(request) { var params = request && request.params ? request.params : null; - if (cfn(params) != null) { + if (cfn(params) != '') { return { dnt: utils.getDNT() ? 1 : 0, ua: navigator.userAgent, From cdea5c60fc5e99394ffe5a5da85e73460bdf2db1 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Mon, 16 Sep 2019 11:34:17 +0530 Subject: [PATCH 05/14] Update lemmaBidAdapter.js Fixed review changes --- modules/lemmaBidAdapter.js | 115 ++++++++++++++++++------------------- 1 file changed, 55 insertions(+), 60 deletions(-) diff --git a/modules/lemmaBidAdapter.js b/modules/lemmaBidAdapter.js index cc84f14f4b1..ed97b1db052 100644 --- a/modules/lemmaBidAdapter.js +++ b/modules/lemmaBidAdapter.js @@ -17,7 +17,7 @@ export var spec = { isBidRequestValid: bid => { if (bid && bid.params) { - if (utils.isStr(bid.params.pubId) || !bid.params.pubId) { + if (!utils.isNumber(bid.params.pubId)) { utils.logWarn(LOG_WARN_PREFIX + 'Error: publisherId is mandatory and cannot be string. Call to OpenBid will not be sent for ad unit: ' + JSON.stringify(bid)); return false; } @@ -73,11 +73,11 @@ function _initConf(refererInfo) { function parseRTBResponse(request, response) { var bidResponses = []; try { - if (cfn(response.seatbid).length > 0) { - var currency = cfn(response.curr) || DEFAULT_CURRENCY; - var seatbid = cfn(response.seatbid); + if (response.seatbid) { + var currency = response.curr || DEFAULT_CURRENCY; + var seatbid = response.seatbid; seatbid.forEach(seatbidder => { - var bidder = cfn(seatbidder.bid); + var bidder = seatbidder.bid; bidder.forEach(bid => { var req = parse(request.data); var newBid = { @@ -136,13 +136,13 @@ function oRTBTemplate(bidRequests, conf) { var app = _getAppObject(bid); var site = _getSiteObject(bid, conf); var device = _getDeviceObject(bid); - if (cfn(app) != '') { + if (app) { oRTBObject.app = app; } - if (cfn(site) != '') { + if (site) { oRTBObject.site = site; } - if (cfn(device) != '') { + if (device) { oRTBObject.device = device; } return oRTBObject; @@ -154,9 +154,9 @@ function oRTBTemplate(bidRequests, conf) { function _getImpressionArray(request) { var impArray = []; var map = request.map(bid => _getImpressionObject(bid)); - if (cfn(map).length > 0) { + if (map) { map.forEach(o => { - if (cfn(o) != '') { + if (o) { impArray.push(o); } }); @@ -166,9 +166,9 @@ function _getImpressionArray(request) { function endPointURL(request) { var params = request && request[0].params ? request[0].params : null; - if (cfn(params) != '') { - var pubId = cfn(params.pubId) != '' ? params.pubId : 0; - var adunitId = cfn(params.adunitId) != '' ? params.adunitId : 0; + if (params) { + var pubId = params.pubId ? params.pubId : 0; + var adunitId = params.adunitId ? params.adunitId : 0; return ENDPOINT + '?pid=' + pubId + '&aid=' + adunitId; } return null; @@ -182,10 +182,10 @@ function _getDomain(url) { function _getSiteObject(request, conf) { var params = request && request.params ? request.params : null; - if (cfn(params) != '') { - var pubId = cfn(params.pubId) != '' ? params.pubId : '0'; - var siteId = cfn(params.siteId) != '' ? params.siteId : '0'; - var appParams = cfn(params.app); + if (params) { + var pubId = params.pubId ? params.pubId : '0'; + var siteId = params.siteId ? params.siteId : '0'; + var appParams = params.app; if (!appParams) { return { publisher: { @@ -203,10 +203,10 @@ function _getSiteObject(request, conf) { function _getAppObject(request) { var params = request && request.params ? request.params : null; - if (cfn(params) != '') { - var pubId = cfn(params.pubId) != '' ? cfn(params.pubId) : '0'; - var appParams = cfn(params.app); - if (cfn(appParams)) { + if (params) { + var pubId = params.pubId ? params.pubId : 0; + var appParams = params.app; + if (appParams) { return { publisher: { id: pubId.toString(), @@ -226,7 +226,7 @@ function _getAppObject(request) { function _getDeviceObject(request) { var params = request && request.params ? request.params : null; - if (cfn(params) != '') { + if (params) { return { dnt: utils.getDNT() ? 1 : 0, ua: navigator.userAgent, @@ -255,16 +255,15 @@ function setOtherParams(request, ortbRequest) { ortbRequest.regs = { ext: { gdpr: request.gdprConsent.gdprApplies ? 1 : 0 } }; ortbRequest.user = { ext: { consent: request.gdprConsent.consentString } }; } - if (cfn(params) != '') { + if (params) { ortbRequest.tmax = params.tmax; ortbRequest.bcat = params.bcat; } } function _getSizes(request) { - var size = cfn(cfn(request).sizes)[0]; - if (utils.isArray(size) && cfn(size).length > 0) { - return size; + if (request.sizes && utils.isArray(request.sizes[0]) && request.sizes[0].length > 0) { + return request.sizes[0]; } return null; } @@ -272,23 +271,23 @@ function _getSizes(request) { function _getBannerRequest(bid) { var bObj; var adFormat = []; - if (cfn(bid.mediaType) === 'banner' || utils.deepAccess(bid, 'mediaTypes.banner')) { - var params = cfn(bid) != '' ? bid.params : null; - var bannerData = cfn(params.banner); - var sizes = _getSizes(bid); - if (cfn(sizes).length == 0) { - sizes = cfn(bid.mediaTypes.banner.sizes[0]); + if (bid.mediaType === 'banner' || utils.deepAccess(bid, 'mediaTypes.banner')) { + var params = bid ? bid.params : null; + var bannerData = params.banner; + var sizes = _getSizes(bid) || []; + if (sizes && sizes.length == 0) { + sizes = bid.mediaTypes.banner.sizes[0]; } - if (cfn(sizes).length > 0) { + if (sizes && sizes.length > 0) { bObj = {}; - bObj.w = cfn(sizes[0]); - bObj.h = cfn(sizes[1]); + bObj.w = sizes[0]; + bObj.h = sizes[1]; bObj.pos = 0; - if (cfn(bannerData) != '') { + if (bannerData) { bObj = utils.deepClone(bannerData); } - sizes = cfn(bid.mediaTypes.banner.sizes); - if (cfn(sizes).length > 0) { + sizes = bid.mediaTypes.banner.sizes; + if (sizes.length > 0) { adFormat = []; sizes.forEach(function(size) { if (size.length > 1) { @@ -308,20 +307,20 @@ function _getBannerRequest(bid) { function _getVideoRequest(bid) { var vObj; - if (cfn(bid.mediaType) === 'video' || utils.deepAccess(bid, 'mediaTypes.video')) { - var params = cfn(bid) != '' ? bid.params : null; - var sizes = _getSizes(bid); - if (cfn(sizes).length == 0) { - sizes = cfn(bid.mediaTypes.video.playerSize); + if (bid.mediaType === 'video' || utils.deepAccess(bid, 'mediaTypes.video')) { + var params = bid ? bid.params : null; + var sizes = _getSizes(bid) || []; + if (sizes && sizes.length == 0) { + sizes = bid.mediaTypes && bid.mediaTypes.video ? bid.mediaTypes.video.playerSize : []; } - if (cfn(sizes).length > 0) { - var videoData = cfn(params.video); + if (sizes && sizes.length > 0) { + var videoData = params.video; vObj = {}; - if (cfn(videoData) !== '') { + if (videoData) { vObj = utils.deepClone(videoData); } - vObj.w = cfn(sizes[0]); - vObj.h = cfn(sizes[1]); + vObj.w = sizes[0]; + vObj.h = sizes[1]; } else { utils.logWarn(LOG_WARN_PREFIX + 'Error: mediaTypes.video.sizes missing for adunit: ' + bid.params.adunitId); } @@ -336,16 +335,16 @@ function _getImpressionObject(bid) { var sizes = bid.hasOwnProperty('sizes') ? bid.sizes : []; var mediaTypes = ''; var format = []; - var params = cfn(bid.params) != '' ? bid.params : null; + var params = bid && bid.params ? bid.params : null; impression = { - id: cfn(bid.bidId), - tagid: cfn(params.adunitId).toString() != '' ? cfn(params.adunitId).toString() : undefined, + id: bid.bidId, + tagid: params.adunitId ? params.adunitId.toString() : undefined, secure: window.location.protocol === 'https:' ? 1 : 0, - bidfloorcur: cfn(params.currency) != '' ? params.currency : DEFAULT_CURRENCY + bidfloorcur: params.currency ? params.currency : DEFAULT_CURRENCY }; - if (cfn(params.bidFloor) != '') { - impression.bidfloor = cfn(params.bidFloor); + if (params.bidFloor) { + impression.bidfloor = params.bidFloor; } if (bid.hasOwnProperty('mediaTypes')) { @@ -353,13 +352,13 @@ function _getImpressionObject(bid) { switch (mediaTypes) { case BANNER: bObj = _getBannerRequest(bid); - if (cfn(bObj) !== '') { + if (bObj) { impression.banner = bObj; } break; case VIDEO: vObj = _getVideoRequest(bid); - if (cfn(vObj) !== '') { + if (vObj) { impression.video = vObj; } break; @@ -399,8 +398,4 @@ function parse(rawResp) { return null; } -function cfn(el) { - return void 0 === el || el === null ? '' : el; -} - registerBidder(spec); From 8b0c2e68bfacb94f2ec2a20722a72afb604b0dea Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Mon, 16 Sep 2019 11:35:42 +0530 Subject: [PATCH 06/14] Update lemmaBidAdapter.md Correct parameter value. --- modules/lemmaBidAdapter.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lemmaBidAdapter.md b/modules/lemmaBidAdapter.md index 1b6c54a9e4d..80c1a52b9d6 100644 --- a/modules/lemmaBidAdapter.md +++ b/modules/lemmaBidAdapter.md @@ -24,7 +24,7 @@ var adUnits = [{ bids: [{ bidder: 'lemma', params: { - pubId: '1', // required + pubId: 1, // required adunitId: '3768', // required latitude: 37.3230, longitude: -122.0322, @@ -53,7 +53,7 @@ var adUnits = [{ bids: [{ bidder: 'lemma', params: { - pubId: '1', // required + pubId: 1, // required adunitId: '3769', // required latitude: 37.3230, longitude: -122.0322, From 9f0d7874dae46742114121ffced828481746d703 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Thu, 6 Feb 2020 18:52:36 +0530 Subject: [PATCH 07/14] Update lemmaBidAdapter.js Lemma Bid Adapter - v3.0 compliance --- modules/lemmaBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lemmaBidAdapter.js b/modules/lemmaBidAdapter.js index ed97b1db052..b27cfdcb134 100644 --- a/modules/lemmaBidAdapter.js +++ b/modules/lemmaBidAdapter.js @@ -4,7 +4,7 @@ import { BANNER, VIDEO } from '../src/mediaTypes'; var BIDDER_CODE = 'lemma'; var LOG_WARN_PREFIX = 'LEMMA: '; -var ENDPOINT = '//ads.lemmatechnologies.com/lemma/servad'; +var ENDPOINT = 'https://ads.lemmatechnologies.com/lemma/servad'; var DEFAULT_CURRENCY = 'USD'; var AUCTION_TYPE = 2; var DEFAULT_TMAX = 300; @@ -61,7 +61,7 @@ export var spec = { function _initConf(refererInfo) { var conf = {}; - conf.pageURL = utils.getTopWindowUrl(); + conf.pageURL = (refererInfo && refererInfo.referer) ? refererInfo.referer : window.location.href; if (refererInfo && refererInfo.referer) { conf.refURL = refererInfo.referer; } else { From 512db741a40deddc7981b5312441c38e80159058 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Thu, 6 Feb 2020 18:58:02 +0530 Subject: [PATCH 08/14] Update lemmaBidAdapter_spec.js Lemma Bid Adapter - v3.0 compliance --- test/spec/modules/lemmaBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/lemmaBidAdapter_spec.js b/test/spec/modules/lemmaBidAdapter_spec.js index 624e763ebe1..3f359cc5e9e 100644 --- a/test/spec/modules/lemmaBidAdapter_spec.js +++ b/test/spec/modules/lemmaBidAdapter_spec.js @@ -151,7 +151,7 @@ describe('lemmaBidAdapter', function() { }); it('Endpoint checking', function() { var request = spec.buildRequests(bidRequests); - expect(request.url).to.equal('//ads.lemmatechnologies.com/lemma/servad?pid=1001&aid=1'); + expect(request.url).to.equal('https://ads.lemmatechnologies.com/lemma/servad?pid=1001&aid=1'); expect(request.method).to.equal('POST'); }); it('Request params check', function() { From dc454c28c60408b9f989b5b629353ed8e46bfbd5 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Thu, 6 Feb 2020 19:01:00 +0530 Subject: [PATCH 09/14] Update lemmaBidAdapter.md Lemma Bid Adapter - v3.0 compliance --- modules/lemmaBidAdapter.md | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/lemmaBidAdapter.md b/modules/lemmaBidAdapter.md index 80c1a52b9d6..29e72e028b9 100644 --- a/modules/lemmaBidAdapter.md +++ b/modules/lemmaBidAdapter.md @@ -42,7 +42,6 @@ var adUnits = [{ ``` var adUnits = [{ mediaType: 'video', - sizes: [[640, 480]], mediaTypes: { video: { playerSize: [640, 480], // required From cd97952973a16ffc38d63e4c74e619f860fb604f Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Thu, 5 Nov 2020 14:43:39 +0530 Subject: [PATCH 10/14] Update lemmaBidAdapter.js Added user sync support into bid adapter. --- modules/lemmaBidAdapter.js | 34 ++++++++++++++++++++++++++++++---- 1 file changed, 30 insertions(+), 4 deletions(-) diff --git a/modules/lemmaBidAdapter.js b/modules/lemmaBidAdapter.js index b27cfdcb134..0b45f1d24dd 100644 --- a/modules/lemmaBidAdapter.js +++ b/modules/lemmaBidAdapter.js @@ -5,10 +5,13 @@ import { BANNER, VIDEO } from '../src/mediaTypes'; var BIDDER_CODE = 'lemma'; var LOG_WARN_PREFIX = 'LEMMA: '; var ENDPOINT = 'https://ads.lemmatechnologies.com/lemma/servad'; +var USER_SYNC = "https://sync.lemmatechnologies.com/js/usersync.html?" var DEFAULT_CURRENCY = 'USD'; var AUCTION_TYPE = 2; var DEFAULT_TMAX = 300; var DEFAULT_NET_REVENUE = false; +var pubId = 0; +var adunitId = 0; export var spec = { @@ -57,6 +60,29 @@ export var spec = { interpretResponse: (response, request) => { return parseRTBResponse(request, response.body); }, + getUserSyncs: (syncOptions, responses, gdprConsent, uspConsent) => { + let syncurl = USER_SYNC + "pid=" + pubId; + + // Attaching GDPR Consent Params in UserSync url + if (gdprConsent) { + syncurl += '&gdpr=' + (gdprConsent.gdprApplies ? 1 : 0); + syncurl += '&gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''); + } + + // CCPA + if (uspConsent) { + syncurl += '&us_privacy=' + encodeURIComponent(uspConsent); + } + + if (syncOptions.iframeEnabled) { + return [{ + type: 'iframe', + url: syncurl + }]; + } else { + utils.logWarn(LOG_WARN_PREFIX + 'Please enable iframe based user sync.'); + } + }, }; function _initConf(refererInfo) { @@ -167,8 +193,8 @@ function _getImpressionArray(request) { function endPointURL(request) { var params = request && request[0].params ? request[0].params : null; if (params) { - var pubId = params.pubId ? params.pubId : 0; - var adunitId = params.adunitId ? params.adunitId : 0; + pubId = params.pubId ? params.pubId : 0; + adunitId = params.adunitId ? params.adunitId : 0; return ENDPOINT + '?pid=' + pubId + '&aid=' + adunitId; } return null; @@ -183,7 +209,7 @@ function _getDomain(url) { function _getSiteObject(request, conf) { var params = request && request.params ? request.params : null; if (params) { - var pubId = params.pubId ? params.pubId : '0'; + pubId = params.pubId ? params.pubId : '0'; var siteId = params.siteId ? params.siteId : '0'; var appParams = params.app; if (!appParams) { @@ -204,7 +230,7 @@ function _getSiteObject(request, conf) { function _getAppObject(request) { var params = request && request.params ? request.params : null; if (params) { - var pubId = params.pubId ? params.pubId : 0; + pubId = params.pubId ? params.pubId : 0; var appParams = params.app; if (appParams) { return { From 9fddb97e8a276eaa28516ebca02fb065f009a41d Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Tue, 10 Nov 2020 10:27:47 +0530 Subject: [PATCH 11/14] updated include modules file extension. updated include modules js file extension. --- modules/lemmaBidAdapter.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/lemmaBidAdapter.js b/modules/lemmaBidAdapter.js index 81568cfef45..db64916f426 100644 --- a/modules/lemmaBidAdapter.js +++ b/modules/lemmaBidAdapter.js @@ -1,4 +1,4 @@ -import * as utils from '../src/utils'; +import * as utils from '../src/utils.js'; import { registerBidder } from '../src/adapters/bidderFactory.js'; import { BANNER, VIDEO } from '../src/mediaTypes.js'; From 9ef28f3092ff89a61171017439d354620b82ee07 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Tue, 10 Nov 2020 11:01:06 +0530 Subject: [PATCH 12/14] Update lemmaBidAdapter_spec.js Added unit test for user sync feature. --- test/spec/modules/lemmaBidAdapter_spec.js | 34 +++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/test/spec/modules/lemmaBidAdapter_spec.js b/test/spec/modules/lemmaBidAdapter_spec.js index a236ac17d71..0de307cbe3a 100644 --- a/test/spec/modules/lemmaBidAdapter_spec.js +++ b/test/spec/modules/lemmaBidAdapter_spec.js @@ -331,5 +331,39 @@ describe('lemmaBidAdapter', function() { }); }); }); + describe('getUserSyncs', function() { + const syncurl_iframe = 'https://sync.lemmatechnologies.com/js/usersync.html?pid=1001'; + let sandbox; + beforeEach(function() { + sandbox = sinon.sandbox.create(); + }); + afterEach(function() { + sandbox.restore(); + }); + + it('execute as per config', function() { + expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined, undefined)).to.deep.equal([{ + type: 'iframe', url: syncurl_iframe + }]); + }); + + it('CCPA/USP', function() { + expect(spec.getUserSyncs({ iframeEnabled: true }, {}, undefined, '1NYN')).to.deep.equal([{ + type: 'iframe', url: `${syncurl_iframe}&us_privacy=1NYN` + }]); + }); + + it('GDPR', function() { + expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { gdprApplies: true, consentString: 'foo' }, undefined)).to.deep.equal([{ + type: 'iframe', url: `${syncurl_iframe}&gdpr=1&gdpr_consent=foo` + }]); + expect(spec.getUserSyncs({ iframeEnabled: truev}, {}, { gdprApplies: false, consentString: 'foo' }, undefined)).to.deep.equal([{ + type: 'iframe', url: `${syncurl_iframe}&gdpr=0&gdpr_consent=foo` + }]); + expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { gdprApplies: true, consentString: undefined }, undefined)).to.deep.equal([{ + type: 'iframe', url: `${syncurl_iframe}&gdpr=1&gdpr_consent=` + }]); + }); + }); }); }); From 7802da85e7edab6f2d2babff0f981382bdecf0ff Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Wed, 11 Nov 2020 12:08:18 +0530 Subject: [PATCH 13/14] Update lemmaBidAdapter.js Fixed format error. --- modules/lemmaBidAdapter.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/lemmaBidAdapter.js b/modules/lemmaBidAdapter.js index db64916f426..5941802f97d 100644 --- a/modules/lemmaBidAdapter.js +++ b/modules/lemmaBidAdapter.js @@ -5,7 +5,7 @@ import { BANNER, VIDEO } from '../src/mediaTypes.js'; var BIDDER_CODE = 'lemma'; var LOG_WARN_PREFIX = 'LEMMA: '; var ENDPOINT = 'https://ads.lemmatechnologies.com/lemma/servad'; -var USER_SYNC = "https://sync.lemmatechnologies.com/js/usersync.html?" +var USER_SYNC = 'https://sync.lemmatechnologies.com/js/usersync.html?'; var DEFAULT_CURRENCY = 'USD'; var AUCTION_TYPE = 2; var DEFAULT_TMAX = 300; @@ -61,7 +61,7 @@ export var spec = { return parseRTBResponse(request, response.body); }, getUserSyncs: (syncOptions, responses, gdprConsent, uspConsent) => { - let syncurl = USER_SYNC + "pid=" + pubId; + let syncurl = USER_SYNC + 'pid=' + pubId; // Attaching GDPR Consent Params in UserSync url if (gdprConsent) { From 0a647998a49cd57e2cca579f360744f81cfae4c5 Mon Sep 17 00:00:00 2001 From: Lemma Dev <54662130+lemmadev@users.noreply.github.com> Date: Wed, 11 Nov 2020 12:11:12 +0530 Subject: [PATCH 14/14] Update lemmaBidAdapter_spec.js Fixed format error and typo error. --- test/spec/modules/lemmaBidAdapter_spec.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/spec/modules/lemmaBidAdapter_spec.js b/test/spec/modules/lemmaBidAdapter_spec.js index 0de307cbe3a..a00c25d126c 100644 --- a/test/spec/modules/lemmaBidAdapter_spec.js +++ b/test/spec/modules/lemmaBidAdapter_spec.js @@ -357,7 +357,7 @@ describe('lemmaBidAdapter', function() { expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { gdprApplies: true, consentString: 'foo' }, undefined)).to.deep.equal([{ type: 'iframe', url: `${syncurl_iframe}&gdpr=1&gdpr_consent=foo` }]); - expect(spec.getUserSyncs({ iframeEnabled: truev}, {}, { gdprApplies: false, consentString: 'foo' }, undefined)).to.deep.equal([{ + expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { gdprApplies: false, consentString: 'foo' }, undefined)).to.deep.equal([{ type: 'iframe', url: `${syncurl_iframe}&gdpr=0&gdpr_consent=foo` }]); expect(spec.getUserSyncs({ iframeEnabled: true }, {}, { gdprApplies: true, consentString: undefined }, undefined)).to.deep.equal([{