Skip to content
Open
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
27 changes: 25 additions & 2 deletions modules/kargoBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { _each, isEmpty, buildUrl, deepAccess, pick, logError, isPlainObject, generateUUID, deepClone } from '../src/utils.js';
import { _each, isEmpty, buildUrl, deepAccess, pick, logError, logInfo, logWarn, isPlainObject, generateUUID, deepClone } from '../src/utils.js';
import { config } from '../src/config.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { getStorageManager } from '../src/storageManager.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';

const PREBID_VERSION = '$prebid.version$'
const DEFAULT_GZIP_ENABLED = true;

const BIDDER = Object.freeze({
CODE: 'kargo',
Expand Down Expand Up @@ -67,6 +68,25 @@ function isBidRequestValid(bid) {
return !!bid.params.placementId;
}

function getGzipSetting() {
// Check bidder-specific configuration
try {
const gzipSetting = deepAccess(config.getBidderConfig(), 'kargo.gzipEnabled');
if (gzipSetting !== undefined) {
const gzipValue = String(gzipSetting).toLowerCase().trim();
if (gzipValue === 'true' || gzipValue === 'false') {
const parsedValue = gzipValue === 'true';
logInfo('Kargo: Using bidder-specific gzipEnabled setting:', parsedValue);
return parsedValue;
}
logWarn('Kargo: Invalid gzipEnabled value in bidder config:', gzipSetting);
}
} catch (e) { logWarn('Kargo: Error accessing bidder config:', e); }

logInfo('Kargo: Using default gzipEnabled setting:', DEFAULT_GZIP_ENABLED);
return DEFAULT_GZIP_ENABLED;
}

function buildRequests(validBidRequests, bidderRequest) {
const currencyObj = config.getConfig(CURRENCY.KEY);
const currency = (currencyObj && currencyObj.adServerCurrency) ? currencyObj.adServerCurrency : null;
Expand Down Expand Up @@ -192,7 +212,10 @@ function buildRequests(validBidRequests, bidderRequest) {
method: BIDDER.REQUEST_METHOD,
url: `https://${BIDDER.HOST}${BIDDER.REQUEST_ENDPOINT}`,
data: krakenParams,
currency: currency
currency: currency,
options: {
endpointCompression: getGzipSetting(),
}
});
}

Expand Down