From 6b0021c02c80b32c0e9b688064f8ff1790270057 Mon Sep 17 00:00:00 2001 From: Jeremy Sadwith Date: Mon, 15 Aug 2022 12:35:10 -0400 Subject: [PATCH] Kargo Bid Adapter: Pull Page URL from refererInfo (#8825) * Kargo Bid Adapter: Use currency from Bid Response * Kargo Bid Adapter: Fix failed test * Kargo Bid Adapter: adding media type to bid response, supporting vastXml response (#8426) * kargo adapter - adding mediaType to bid response, conditionally set vastXml field * kargo adapter - updating tests * Kargo Bid Adapter: onTimeout Support (#6) * Adding additional param * Adding response time function * Remove debug * Updating response time log to be set by bid response * Adding screen width/height to request * Test fix * Test fix * Removing interpretResponse signaling * Simplifying send data function * Kargo Analytics Adapter: Update with bid response time support * Renaming event route for auction data * Reset bid response data sent bool * Using array to store logged auctions * Update to use timeToResponse * Test fix * Kargo: Pull page URL from refererInfo * Test fix: Page URL * Removing extra bracket Co-authored-by: Wei Wong Co-authored-by: Andy Rusiecki --- modules/kargoBidAdapter.js | 9 ++++----- test/spec/modules/kargoBidAdapter_spec.js | 13 +++++++++++-- 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/modules/kargoBidAdapter.js b/modules/kargoBidAdapter.js index 72342903d87..deeb1cb8630 100644 --- a/modules/kargoBidAdapter.js +++ b/modules/kargoBidAdapter.js @@ -60,7 +60,7 @@ export const spec = { height: window.screen.height }, prebidRawBidRequests: validBidRequests - }, spec._getAllMetadata(tdid, bidderRequest.uspConsent, bidderRequest.gdprConsent)); + }, spec._getAllMetadata(bidderRequest, tdid)); const encodedParams = encodeURIComponent(JSON.stringify(transformedParams)); return Object.assign({}, bidderRequest, { method: 'GET', @@ -215,11 +215,10 @@ export const spec = { return crb.clientId; }, - _getAllMetadata(tdid, usp, gdpr) { + _getAllMetadata(bidderRequest, tdid) { return { - userIDs: spec._getUserIds(tdid, usp, gdpr), - // TODO: this should probably look at refererInfo - pageURL: window.location.href, + userIDs: spec._getUserIds(tdid, bidderRequest.uspConsent, bidderRequest.gdprConsent), + pageURL: bidderRequest.refererInfo && bidderRequest.refererInfo.page, rawCRB: storage.getCookie('krg_crb'), rawCRBLocalStorage: spec._getLocalStorageSafely('krg_crb') }; diff --git a/test/spec/modules/kargoBidAdapter_spec.js b/test/spec/modules/kargoBidAdapter_spec.js index e900b91ed11..169ee520f33 100644 --- a/test/spec/modules/kargoBidAdapter_spec.js +++ b/test/spec/modules/kargoBidAdapter_spec.js @@ -276,7 +276,7 @@ describe('kargo adapter tests', function () { optOut: false, usp: '1---' }, - pageURL: window.location.href, + pageURL: 'https://www.prebid.org', prebidRawBidRequests: [ { bidId: 1, @@ -327,10 +327,19 @@ describe('kargo adapter tests', function () { if (excludeTdid) { delete clonedBids[0].userId.tdid; } - var payload = { timeout: 200, uspConsent: '1---', foo: 'bar' }; + var payload = { + timeout: 200, + uspConsent: '1---', + foo: 'bar', + refererInfo: { + page: 'https://www.prebid.org', + }, + }; + if (gdpr) { payload['gdprConsent'] = gdpr } + var request = spec.buildRequests(clonedBids, payload); expected.sessionId = getSessionId(); sessionIds.push(expected.sessionId);