Skip to content

Commit

Permalink
Eskimi Bid Adapter: support string placementId, adjust user-sync proc…
Browse files Browse the repository at this point in the history
…essing logic
  • Loading branch information
Andrius Versockas committed Oct 1, 2024
1 parent 0b882c2 commit 73fbd90
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions modules/eskimiBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const REGION_SUBDOMAIN_SUFFIX = {

export const spec = {
code: BIDDER_CODE,
aliases: ['eskimi'],
gvlid: GVLID,
supportedMediaTypes: [BANNER, VIDEO],
isBidRequestValid,
Expand Down Expand Up @@ -120,7 +119,7 @@ function isBidRequestValid(bidRequest) {
}

function isPlacementIdValid(bidRequest) {
return utils.isNumber(bidRequest.params.placementId);
return !!parseInt(bidRequest.params.placementId);
}

function isValidBannerRequest(bidRequest) {
Expand Down Expand Up @@ -215,7 +214,7 @@ function createRequest(bidRequests, bidderRequest, mediaType) {

const bid = bidRequests.find((b) => b.params.placementId)
if (!data.site) data.site = {}
data.site.ext = {placementId: bid.params.placementId}
data.site.ext = {placementId: parseInt(bid.params.placementId)}

if (bidderRequest.gdprConsent) {
if (!data.user) data.user = {};
Expand Down Expand Up @@ -255,31 +254,32 @@ function isBannerBid(bid) {
* @return {{type: (string), url: (*|string)}[]}
*/
function getUserSyncs(syncOptions, responses, gdprConsent, uspConsent, gppConsent) {
if ((syncOptions.iframeEnabled || syncOptions.pixelEnabled) && hasSyncConsent(gdprConsent, uspConsent, gppConsent)) {
if ((syncOptions.iframeEnabled || syncOptions.pixelEnabled)) {
let pixelType = syncOptions.iframeEnabled ? 'iframe' : 'image';
let query = [];
let syncUrl = getUserSyncUrlByRegion();
// Attaching GDPR Consent Params in UserSync url
// GDPR Consent Params in UserSync url
if (gdprConsent) {
query.push('gdpr=' + (gdprConsent.gdprApplies & 1));
query.push('gdpr_consent=' + encodeURIComponent(gdprConsent.consentString || ''));
}
// CCPA
// US Privacy Consent
if (uspConsent) {
query.push('us_privacy=' + encodeURIComponent(uspConsent));
}
// GPP Consent
// Global Privacy Platform Consent
if (gppConsent?.gppString && gppConsent?.applicableSections?.length) {
query.push('gpp=' + encodeURIComponent(gppConsent.gppString));
query.push('gpp_sid=' + encodeURIComponent(gppConsent.applicableSections.join(',')));
}
return [{
type: pixelType,
url: `${syncUrl}${query.length > 0 ? '?' + query.join('&') : ''}`
url: `${syncUrl}${query.length > 0 ? '&' + query.join('&') : ''}`
}];
}
}

// eslint-disable-next-line no-unused-vars
function hasSyncConsent(gdprConsent, uspConsent, gppConsent) {
return hasPurpose1Consent(gdprConsent) && hasUspConsent(uspConsent) && hasGppConsent(gppConsent);
}
Expand Down

0 comments on commit 73fbd90

Please sign in to comment.