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

Yieldlab Bid Adapter: Add Support for User Matching #8148

Merged
merged 27 commits into from
Mar 31, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
320f9a2
YL-3989: Accept NATIVE yieldprobe response (#2)
alex-ylb Oct 21, 2021
0cf9144
Merge branch 'prebid:master' into master
alex-ylb Oct 21, 2021
ab5020c
Fix: 'utils' is not defined no-undef
alex-ylb Oct 21, 2021
11c410c
trigger GitHub actions
alex-ylb Oct 22, 2021
520aa5b
Merge branch 'prebid:master' into master
kippsterr Oct 22, 2021
20e19cd
Merge branch 'prebid:master' into master
kippsterr Oct 26, 2021
ff0ae5b
Merge branch 'prebid:master' into master
kippsterr Oct 27, 2021
8d1602f
Add multi-format example to the Yieldlab bidder documentation
kippsterr Oct 27, 2021
e51982d
Reformat code
kippsterr Oct 27, 2021
6b12082
Fix: Object doesn't support 'find'
alex-ylb Oct 27, 2021
97b0e65
trigger GitHub actions
alex-ylb Oct 27, 2021
1e1a1bd
Chore:Replace `filter` by `find` from ..array/find.js
alex-ylb Oct 27, 2021
840b1bf
Fix typo
kippsterr Oct 27, 2021
3ab20a7
Merge pull request #3 from yieldlab/add_multi-format_documentation
kippsterr Oct 27, 2021
0c4b15d
Merge branch 'prebid:master' into master
kippsterr Oct 27, 2021
900800a
Merge branch 'prebid:master' into master
kippsterr Oct 28, 2021
d652502
Merge branch 'prebid:master' into master
kippsterr Oct 29, 2021
51f7ec8
Merge branch 'prebid:master' into master
kippsterr Jan 17, 2022
bc07e15
Merge branch 'prebid:master' into master
kippsterr Feb 11, 2022
3763921
YL-4121 Add user matching to prebid
nkloeber Feb 24, 2022
7e22117
YL-4121 using a constad instead of hardcoded string as endpoint
nkloeber Feb 24, 2022
b6690c5
Merge branch 'prebid:master' into master
kippsterr Mar 1, 2022
b413691
YL-4121 improvements as requested in pr
nkloeber Mar 2, 2022
18e4d36
Merge pull request #4 from yieldlab/YL-4121_Add_User_Matching_to_Prebid
nkloeber Mar 3, 2022
8000c9c
merge latest upstream changes to fork
kippsterr Mar 15, 2022
f539a10
Merge branch 'prebid:master' into master
kippsterr Mar 15, 2022
e4b257c
Merge branch 'prebid:master' into master
kippsterr Mar 15, 2022
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
43 changes: 37 additions & 6 deletions modules/yieldlabBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {_each, deepAccess, isArray, isPlainObject} from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
import {find} from '../src/polyfill.js';
import {BANNER, NATIVE, VIDEO} from '../src/mediaTypes.js';
import {Renderer} from '../src/Renderer.js';
import {config} from '../src/config.js';
import { _each, deepAccess, isArray, isPlainObject, timestamp } from '../src/utils.js'
import { registerBidder } from '../src/adapters/bidderFactory.js'
import { find } from '../src/polyfill.js'
import { BANNER, NATIVE, VIDEO } from '../src/mediaTypes.js'
import { Renderer } from '../src/Renderer.js'
import { config } from '../src/config.js'

const ENDPOINT = 'https://ad.yieldlab.net'
const BIDDER_CODE = 'yieldlab'
Expand Down Expand Up @@ -174,6 +174,37 @@ export const spec = {
}
})
return bidResponses
},

/**
* Register the user sync pixels which should be dropped after the auction.
*
* @param {SyncOptions} syncOptions Which user syncs are allowed?
* @param {ServerResponse[]} serverResponses List of server's responses.
* @param {Object} gdprConsent Is the GDPR Consent object wrapping gdprApplies {boolean} and consentString {string} attributes.
* @param {string} uspConsent Is the US Privacy Consent string.
* @return {UserSync[]} The user syncs which should be dropped.
*/
getUserSyncs: function (syncOptions, serverResponses, gdprConsent, uspConsent) {
const syncs = [];

if (syncOptions.iframeEnabled) {
let params = [];
params.push(`ts=${timestamp()}`);
params.push(`type=h`)
if (gdprConsent && (typeof gdprConsent.gdprApplies === 'boolean')) {
params.push(`gdpr=${Number(gdprConsent.gdprApplies)}`);
}
if (gdprConsent && (typeof gdprConsent.consentString === 'string')) {
params.push(`gdpr_consent=${gdprConsent.consentString}`);
}
syncs.push({
type: 'iframe',
url: `${ENDPOINT}/d/6846326/766/2x2?${params.join('&')}`
});
}

return syncs;
}
};

Expand Down
36 changes: 36 additions & 0 deletions test/spec/modules/yieldlabBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -414,4 +414,40 @@ describe('yieldlabBidAdapter', function () {
expect(result[0].vastUrl).to.include('&iab_content=id%3Afoo_id%2Cepisode%3A99%2Ctitle%3Afoo_title%252Cbar_title%2Cseries%3Afoo_series%2Cseason%3As1%2Cartist%3Afoo%2520bar%2Cgenre%3Abaz%2Cisrc%3ACC-XXX-YY-NNNNN%2Curl%3Ahttp%253A%252F%252Ffoo_url.de%2Ccat%3Acat1%7Ccat2%252Cppp%7Ccat3%257C%257C%257C%252F%252F%2Ccontext%3A7%2Ckeywords%3Ak1%252C%7Ck2..%2Clive%3A0')
})
})

describe('getUserSyncs', function () {
const syncOptions = {
iframeEnabled: true,
pixelEnabled: false
};
const expectedUrlSnippets = ['https://ad.yieldlab.net/d/6846326/766/2x2?', 'ts=', 'type=h'];

it('should return user sync as expected', function () {
const bidRequest = {
gdprConsent: {
consentString: 'BN5lERiOMYEdiAKAWXEND1AAAAE6DABACMA',
gdprApplies: true
},
uspConsent: '1YYY'
};
const sync = spec.getUserSyncs(syncOptions, [], bidRequest.gdprConsent, bidRequest.uspConsent);
expect(expectedUrlSnippets.every(urlSnippet => sync[0].url.includes(urlSnippet)));
expect(sync[0].url).to.have.string('gdpr=' + Number(bidRequest.gdprConsent.gdprApplies));
expect(sync[0].url).to.have.string('gdpr_consent=' + bidRequest.gdprConsent.consentString);
// USP consent should be ignored
expect(sync[0].url).not.have.string('usp_consent=');
expect(sync[0].type).to.have.string('iframe');
});

it('should return user sync even without gdprApplies in gdprConsent', function () {
const gdprConsent = {
consentString: 'BN5lERiOMYEdiAKAWXEND1AAAAE6DABACMA'
}
const sync = spec.getUserSyncs(syncOptions, [], gdprConsent, undefined);
expect(expectedUrlSnippets.every(urlSnippet => sync[0].url.includes(urlSnippet)));
expect(sync[0].url).to.have.string('gdpr_consent=' + gdprConsent.consentString);
expect(sync[0].url).not.have.string('gdpr=');
expect(sync[0].type).to.have.string('iframe');
});
});
})