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

Invibes Bid Adapter : reading page referer and cookie handlid #11477

Merged
merged 6 commits into from
May 15, 2024
Merged
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
16 changes: 12 additions & 4 deletions modules/invibesBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const CONSTANTS = {
SYNC_ENDPOINT: 'https://k.r66net.com/GetUserSync',
TIME_TO_LIVE: 300,
DEFAULT_CURRENCY: 'EUR',
PREBID_VERSION: 11,
PREBID_VERSION: 12,
METHOD: 'GET',
INVIBES_VENDOR_ID: 436,
USERID_PROVIDERS: ['pubcid', 'pubProvidedId', 'uid2', 'zeotapIdPlus', 'id5id'],
Expand All @@ -40,7 +40,7 @@ export const spec = {
buildRequests: buildRequest,
/**
* @param {*} responseObj
* @param {requestParams} bidRequests
* @param {*} requestParams
* @return {Bid[]} An array of bids which
*/
interpretResponse: function (responseObj, requestParams) {
Expand Down Expand Up @@ -131,7 +131,6 @@ function buildRequest(bidRequests, bidderRequest) {

window.invibes.placementIds.push(bidRequest.params.placementId);

_placementIds.push(bidRequest.params.placementId);
_placementIds.push(bidRequest.params.placementId);
_adUnitCodes.push(bidRequest.adUnitCode);
_domainId = _domainId || bidRequest.params.domainId;
Expand Down Expand Up @@ -180,9 +179,18 @@ function buildRequest(bidRequests, bidderRequest) {
isLocalStorageEnabled: storage.hasLocalStorage(),
preventPageViewEvent: preventPageViewEvent,
isPlacementRefresh: isPlacementRefresh,
isInfiniteScrollPage: isInfiniteScrollPage,
isInfiniteScrollPage: isInfiniteScrollPage
};

if (bidderRequest.refererInfo && bidderRequest.refererInfo.ref) {
data.pageReferrer = bidderRequest.refererInfo.ref.substring(0, 300);
}

let hid = invibes.getCookie('handIid');
if (hid) {
data.handIid = hid;
}

let lid = readFromLocalStorage('ivbsdid');
if (!lid) {
let str = invibes.getCookie('ivbsdid');
Expand Down
44 changes: 44 additions & 0 deletions test/spec/modules/invibesBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,50 @@ describe('invibesBidAdapter:', function () {
expect(request.data.lId).to.exist;
});

it('does not send handIid when it doesnt exist in cookie', function () {
top.window.invibes.optIn = 1;
top.window.invibes.purposes = [true, false, false, false, false, false, false, false, false, false];
global.document.cookie = '';
let bidderRequest = {
gdprConsent: {
vendorData: {
vendorConsents: {
436: true
}
}
},
refererInfo: {
page: 'https://randomWeb.com?someFakePara=fakeValue&secondParam=secondValue'
}
};
SetBidderAccess();

let request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.handIid).to.not.exist;
});

it('sends handIid when comes on cookie', function () {
top.window.invibes.optIn = 1;
top.window.invibes.purposes = [true, false, false, false, false, false, false, false, false, false];
global.document.cookie = 'handIid=abcdefghijkk';
let bidderRequest = {
gdprConsent: {
vendorData: {
vendorConsents: {
436: true
}
}
},
refererInfo: {
page: 'https://randomWeb.com?someFakePara=fakeValue&secondParam=secondValue'
}
};
SetBidderAccess();

let request = spec.buildRequests(bidRequests, bidderRequest);
expect(request.data.handIid).to.equal('abcdefghijkk');
});

it('should send purpose 1', function () {
let bidderRequest = {
gdprConsent: {
Expand Down