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

Prebid 7 #8530

Merged
merged 55 commits into from
Jun 8, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
f462beb
Prebid 7: Delete userid targeting module (#8227)
patmmccann Apr 2, 2022
1da703e
NextRoll ID: Remove NextRoll ID module (#8150)
abijr Apr 2, 2022
9bb10d8
Remove Sortable Analytics Adapter (#8251)
nicgallardo Apr 4, 2022
817c91d
Prebid 7: Merge in changes from master (#8278)
patmmccann Apr 12, 2022
418fe56
remove appnexusAnalyticsAdapter (#8330)
jsnellbaker Apr 27, 2022
fa20923
Merge branch 'master' into prebid-7
dgirardi Apr 28, 2022
90df3ff
Merge master into prebid-7 (#8336)
dgirardi Apr 28, 2022
1d74541
Revert "Merge master into prebid-7 (#8336)"
dgirardi Apr 28, 2022
ce4631c
Merge branch 'pb7-merge' into prebid-7
dgirardi Apr 28, 2022
14712d1
Merge branch 'master' into prebid-7
dgirardi May 2, 2022
db102b5
Prebid 7: Remove FLOC id submodule (#8225)
patmmccann May 3, 2022
a2b0079
Prebid 7: Delete onevideo bid adapter (#8281)
patmmccann May 3, 2022
3b3c8a5
Prebid 7: auction-specific first party data and refactoring of FPD in…
dgirardi May 3, 2022
64375dd
Merge branch 'master' into prebid-7
dgirardi May 3, 2022
eeeab7b
Prebid 7 : update instl for current prebid standards (#8361)
ChrisHuie May 3, 2022
670ee19
Merge branch 'master' into prebid-7
dgirardi May 4, 2022
863b2ee
Merge branch 'master' into prebid-7
dgirardi May 10, 2022
6259946
Merge branch 'master' into prebid-7
dgirardi May 16, 2022
b6f5ff2
Remove districtm Dmx Bid Adapter (#8417)
pierreted90 May 16, 2022
1e9da88
Merge branch 'master' into prebid-7
dgirardi May 17, 2022
19e669e
Merge branch 'prebid-7' of github.com:prebid/Prebid.js into prebid-7
dgirardi May 17, 2022
6e28596
Fix lint
dgirardi May 17, 2022
de31f55
Prebid 7: Remove Halo System (#8420)
patmmccann May 17, 2022
6fcb4f6
Prebid 7: change default of `allowAlternateBidderCodes` from `true` t…
dgirardi May 17, 2022
cf7c11b
Prebid 7: TheMediaGrid: make trustxBidAdapter as alias of gridBidAdap…
TheMediaGrid May 18, 2022
e0afeff
Prebid 7: Change default bidder access to storage manager (#8279)
patmmccann May 20, 2022
72a1ae4
Merge branch 'master' into prebid-7
dgirardi May 20, 2022
29f4c75
Merge branch 'prebid-7' of github.com:prebid/Prebid.js into prebid-7
dgirardi May 20, 2022
3104a3f
Remove Sortable Analytics Adapter (#8442)
liliana-sortable May 20, 2022
29848c2
Prebid 7: Remove AppNexus Alias for Brealtime and DistrictM (#8437)
patmmccann May 23, 2022
7efc875
remove md files of removed adapters (#8446)
ChrisHuie May 23, 2022
2870089
Prebid 7: Deprecating OneVideo Bid Adapter (#8436)
DeepthiNeeladri May 23, 2022
a8c4a80
Merge branch 'master' into prebid-7
dgirardi May 23, 2022
c885816
Sortable Adapter Removal (#8447)
nicgallardo May 24, 2022
e524628
Merge branch 'master' into prebid-7
dgirardi May 25, 2022
f7910d4
Merge branch 'master' into prebid-7
dgirardi May 25, 2022
823fa5a
Prebid 7: Clean up misc halo references (#8468)
patmmccann May 26, 2022
187c0d0
Prebid 7: Adapter fixes for reading impression position (#8451)
patmmccann May 26, 2022
13e0b43
Prebid 7: Remove Akamai DAP ID in favor of RTD (#8480)
patmmccann May 26, 2022
2da0059
Prebid 7: update multiple adapters to standardize bcat (#8462)
ChrisHuie May 26, 2022
2f1a83c
Merge branch 'master' into prebid-7
dgirardi May 31, 2022
26312c2
Magnite GVL ID update (7.0 branch) (#8502)
bretg May 31, 2022
174368b
Prebid 7: Remove stored auction response (#8235)
patmmccann Jun 1, 2022
228bb10
Merge branch 'master' into prebid-7
dgirardi Jun 1, 2022
a3364b5
Merge branch 'prebid-7' of github.com:prebid/Prebid.js into prebid-7
dgirardi Jun 1, 2022
a5f1ae8
Prebid 7: remove support for legacy FPD (#8372)
dgirardi Jun 1, 2022
133a738
Merge branch 'master' into prebid-7
dgirardi Jun 2, 2022
4a25c2e
Merge branch 'prebid-7' of github.com:prebid/Prebid.js into prebid-7
dgirardi Jun 2, 2022
da54a9c
Prebid 7: Allow USP module to work without explicit configuration (#8…
patmmccann Jun 2, 2022
5905aa9
Merge branch 'master' into prebid-7
dgirardi Jun 3, 2022
759cfc0
Prebid.js 7: update pbsBidAdapter to use imp.ext.prebid.bidder.BIDDER…
ChrisHuie Jun 6, 2022
6e3f8dd
Prebid 7: refactoring of refererInfo, pageUrl, publisherDomain (#8450)
dgirardi Jun 7, 2022
3682d62
Prebid 7: remove support for TCFv1 (#8356)
dgirardi Jun 7, 2022
d44519b
Merge branch 'master' into prebid-7
dgirardi Jun 7, 2022
1f648fd
Prebid 7: prevent Prebid from being loaded multiple times (#8508)
dgirardi Jun 8, 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
Prev Previous commit
Next Next commit
Revert "Merge master into prebid-7 (#8336)"
This reverts commit 90df3ff.
  • Loading branch information
dgirardi committed Apr 28, 2022
commit 1d74541e262051f61e9641a20fd30f08339f8ec2
12 changes: 11 additions & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ aliases:

- &run_endtoend_test
name: BrowserStack End to end testing
command: gulp e2e-test
command: echo "127.0.0.1 test.localhost" | sudo tee -a /etc/hosts && gulp e2e-test --host=test.localhost

# Download and run BrowserStack local
- &setup_browserstack
Expand Down Expand Up @@ -82,6 +82,16 @@ workflows:
commit:
jobs:
- build
nightly:
triggers:
- schedule:
cron: "0 0 * * *"
filters:
branches:
only:
- master
jobs:
- e2etest

experimental:
pipelines: true
123 changes: 71 additions & 52 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ var prebid = require('./package.json');
var dateString = 'Updated : ' + (new Date()).toISOString().substring(0, 10);
var banner = '/* <%= prebid.name %> v<%= prebid.version %>\n' + dateString + '*/\n';
var port = 9999;
const INTEG_SERVER_HOST = argv.host ? argv.host : 'localhost';
const INTEG_SERVER_PORT = 4444;
const FAKE_SERVER_HOST = argv.host ? argv.host : 'localhost';
const FAKE_SERVER_PORT = 4444;
const { spawn } = require('child_process');

// these modules must be explicitly listed in --modules to be included in the build, won't be part of "all" modules
Expand Down Expand Up @@ -167,9 +167,9 @@ function gulpBundle(dev) {
return bundle(dev).pipe(gulp.dest('build/' + (dev ? 'dev' : 'dist')));
}

function nodeBundle(modules, dev = false) {
function nodeBundle(modules) {
return new Promise((resolve, reject) => {
bundle(dev, modules)
bundle(false, modules)
.on('error', (err) => {
reject(err);
})
Expand Down Expand Up @@ -243,18 +243,41 @@ function testTaskMaker(options = {}) {
if (options.notest) {
done();
} else if (options.e2e) {
const integ = startIntegServer();
startLocalServer();
runWebdriver(options)
let wdioCmd = path.join(__dirname, 'node_modules/.bin/wdio');
let wdioConf = path.join(__dirname, 'wdio.conf.js');
let wdioOpts;

if (options.file) {
wdioOpts = [
wdioConf,
`--spec`,
`${options.file}`
]
} else {
wdioOpts = [
wdioConf
];
}

// run fake-server
const fakeServer = spawn('node', ['./test/fake-server/index.js', `--port=${FAKE_SERVER_PORT}`]);
fakeServer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
fakeServer.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});

execa(wdioCmd, wdioOpts, { stdio: 'inherit' })
.then(stdout => {
// kill fake server
integ.kill('SIGINT');
fakeServer.kill('SIGINT');
done();
process.exit(0);
})
.catch(err => {
// kill fake server
integ.kill('SIGINT');
fakeServer.kill('SIGINT');
done(new Error(`Tests failed with error: ${err}`));
process.exit(1);
});
Expand All @@ -273,26 +296,6 @@ function testTaskMaker(options = {}) {

const test = testTaskMaker();

function runWebdriver({file}) {
process.env.TEST_SERVER_HOST = argv.host || 'localhost';
let wdioCmd = path.join(__dirname, 'node_modules/.bin/wdio');
let wdioConf = path.join(__dirname, 'wdio.conf.js');
let wdioOpts;

if (file) {
wdioOpts = [
wdioConf,
`--spec`,
`${file}`
]
} else {
wdioOpts = [
wdioConf
];
}
return execa(wdioCmd, wdioOpts, { stdio: 'inherit' });
}

function newKarmaCallback(done) {
return function (exitCode) {
if (exitCode) {
Expand Down Expand Up @@ -332,29 +335,41 @@ function buildPostbid() {
.pipe(gulp.dest('build/postbid/'));
}

function startIntegServer(dev = false) {
const args = ['./test/fake-server/index.js', `--port=${INTEG_SERVER_PORT}`, `--host=${INTEG_SERVER_HOST}`];
if (dev) {
args.push('--dev=true')
function setupE2e(done) {
if (!argv.host) {
throw new gutil.PluginError({
plugin: 'E2E test',
message: gutil.colors.red('Host should be defined e.g. ap.localhost, anlocalhost. localhost cannot be used as safari browserstack is not able to connect to localhost')
});
}
const srv = spawn('node', args);
srv.stdout.on('data', (data) => {
process.env.TEST_SERVER_HOST = argv.host;
if (argv.https) {
process.env.TEST_SERVER_PROTOCOL = argv.https;
}
argv.e2e = true;
done();
}

function injectFakeServerEndpoint() {
return gulp.src(['build/dist/*.js'])
.pipe(replace('https://ib.adnxs.com/ut/v3/prebid', `http://${FAKE_SERVER_HOST}:${FAKE_SERVER_PORT}`))
.pipe(gulp.dest('build/dist'));
}

function injectFakeServerEndpointDev() {
return gulp.src(['build/dev/*.js'])
.pipe(replace('https://ib.adnxs.com/ut/v3/prebid', `http://${FAKE_SERVER_HOST}:${FAKE_SERVER_PORT}`))
.pipe(gulp.dest('build/dev'));
}

function startFakeServer() {
const fakeServer = spawn('node', ['./test/fake-server/index.js', `--port=${FAKE_SERVER_PORT}`]);
fakeServer.stdout.on('data', (data) => {
console.log(`stdout: ${data}`);
});
srv.stderr.on('data', (data) => {
fakeServer.stderr.on('data', (data) => {
console.log(`stderr: ${data}`);
});
return srv;
}

function startLocalServer(options = {}) {
connect.server({
https: argv.https,
port: port,
host: INTEG_SERVER_HOST,
root: './',
livereload: options.livereload
});
}

// Watch Task with Live Reload
Expand All @@ -370,7 +385,13 @@ function watchTaskMaker(options = {}) {
'modules/**/*.js',
].concat(options.alsoWatch));

startLocalServer(options);
connect.server({
https: argv.https,
port: port,
host: FAKE_SERVER_HOST,
root: './',
livereload: options.livereload
});

mainWatcher.on('all', options.task());
done();
Expand Down Expand Up @@ -406,13 +427,11 @@ gulp.task('build-postbid', gulp.series(escapePostbidConfig, buildPostbid));
gulp.task('serve', gulp.series(clean, lint, gulp.parallel('build-bundle-dev', watch, test)));
gulp.task('serve-fast', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast)));
gulp.task('serve-and-test', gulp.series(clean, gulp.parallel('build-bundle-dev', watchFast, testTaskMaker({watch: true}))));
gulp.task('serve-e2e', gulp.series(clean, 'build-bundle-prod', gulp.parallel(() => startIntegServer(), startLocalServer)))
gulp.task('serve-e2e-dev', gulp.series(clean, 'build-bundle-dev', gulp.parallel(() => startIntegServer(true), startLocalServer)))
gulp.task('serve-fake', gulp.series(clean, gulp.parallel('build-bundle-dev', watch), injectFakeServerEndpointDev, test, startFakeServer));

gulp.task('default', gulp.series(clean, 'build-bundle-prod'));

gulp.task('e2e-test-only', () => runWebdriver({file: argv.file}))
gulp.task('e2e-test', gulp.series(clean, 'build-bundle-prod', testTaskMaker({e2e: true})));
gulp.task('e2e-test', gulp.series(clean, setupE2e, gulp.parallel('build-bundle-prod', watch), injectFakeServerEndpoint, test));
// other tasks
gulp.task(bundleToStdout);
gulp.task('bundle', gulpBundle.bind(null, false)); // used for just concatenating pre-built files with no build step
Expand Down
110 changes: 43 additions & 67 deletions modules/adomikAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import adapterManager from '../src/adapterManager.js';
import {logInfo} from '../src/utils.js';
import {find, findIndex} from '../src/polyfill.js';

// Events used in adomik analytics adapter.
// Events used in adomik analytics adapter
const auctionInit = CONSTANTS.EVENTS.AUCTION_INIT;
const auctionEnd = CONSTANTS.EVENTS.AUCTION_END;
const bidRequested = CONSTANTS.EVENTS.BID_REQUESTED;
Expand All @@ -30,13 +30,17 @@ let adomikAdapter = Object.assign(adapter({}),
break;

case bidResponse:
adomikAdapter.saveBidResponse(args);
adomikAdapter.bucketEvents.push({
type: 'response',
event: adomikAdapter.buildBidResponse(args)
});
break;

case bidWon:
args.id = args.adId;
args.placementCode = args.adUnitCode;
adomikAdapter.sendWonEvent(args);
adomikAdapter.sendWonEvent({
id: args.adId,
placementCode: args.adUnitCode
});
break;

case bidRequested:
Expand Down Expand Up @@ -65,28 +69,16 @@ adomikAdapter.initializeBucketEvents = function() {
adomikAdapter.bucketEvents = [];
}

adomikAdapter.saveBidResponse = function(args) {
let responseSaved = adomikAdapter.bucketEvents.find((bucketEvent) =>
bucketEvent.type == 'response' && bucketEvent.event.id == args.id
);
if (responseSaved) { return true; }
adomikAdapter.bucketEvents.push({
type: 'response',
event: adomikAdapter.buildBidResponse(args)
});
}

adomikAdapter.maxPartLength = function () {
return (ua.includes(' MSIE ')) ? 1600 : 60000;
};

adomikAdapter.sendTypedEvent = function() {
let [testId, testValue] = adomikAdapter.getKeyValues();
const groupedTypedEvents = adomikAdapter.buildTypedEvents();

const bulkEvents = {
testId: testId,
testValue: testValue,
testId: adomikAdapter.currentContext.testId,
testValue: adomikAdapter.currentContext.testValue,
uid: adomikAdapter.currentContext.uid,
ahbaid: adomikAdapter.currentContext.id,
hostname: window.location.hostname,
Expand Down Expand Up @@ -122,8 +114,10 @@ adomikAdapter.sendTypedEvent = function() {
const stringBulkEvents = JSON.stringify(bulkEvents)
logInfo('Events sent to adomik prebid analytic ' + stringBulkEvents);

// Encode object in base64
const encodedBuf = window.btoa(stringBulkEvents);

// Create final url and split it (+endpoint length)
const encodedUri = encodeURIComponent(encodedBuf);
const maxLength = adomikAdapter.maxPartLength();
const splittedUrl = encodedUri.match(new RegExp(`.{1,${maxLength}}`, 'g'));
Expand All @@ -136,18 +130,16 @@ adomikAdapter.sendTypedEvent = function() {
};

adomikAdapter.sendWonEvent = function (wonEvent) {
let [testId, testValue] = adomikAdapter.getKeyValues();
let keyValues = { testId: testId, testValue: testValue };
let samplingInfo = { sampling: adomikAdapter.currentContext.sampling };
wonEvent = { ...adomikAdapter.buildBidResponse(wonEvent), ...keyValues, ...samplingInfo };

const stringWonEvent = JSON.stringify(wonEvent);
let keyValues = { testId: adomikAdapter.currentContext.testId, testValue: adomikAdapter.currentContext.testValue }
wonEvent = {...wonEvent, ...keyValues}
const stringWonEvent = JSON.stringify(wonEvent)
logInfo('Won event sent to adomik prebid analytic ' + stringWonEvent);

// Encode object in base64
const encodedBuf = window.btoa(stringWonEvent);
const encodedUri = encodeURIComponent(encodedBuf);
const img = new Image(1, 1);
img.src = `https://${adomikAdapter.currentContext.url}/?q=${encodedUri}&id=${adomikAdapter.currentContext.id}&won=true`;
img.src = `https://${adomikAdapter.currentContext.url}/?q=${encodedUri}&id=${adomikAdapter.currentContext.id}&won=true`
}

adomikAdapter.buildBidResponse = function (bid) {
Expand Down Expand Up @@ -209,49 +201,33 @@ adomikAdapter.buildTypedEvents = function () {
return groupedTypedEvents;
}

adomikAdapter.getKeyValues = function () {
let preventTest = sessionStorage.getItem(window.location.hostname + '_NoAdomikTest')
let inScope = sessionStorage.getItem(window.location.hostname + '_AdomikTestInScope')
let keyValues = JSON.parse(sessionStorage.getItem(window.location.hostname + '_AdomikTest'))
let testId;
let testValue;
if (typeof (keyValues) === 'object' && keyValues != undefined && !preventTest && inScope) {
testId = keyValues.testId
testValue = keyValues.testOptionLabel
}
return [testId, testValue]
}

adomikAdapter.enable = function(options) {
adomikAdapter.currentContext = {
uid: options.id,
url: options.url,
id: '',
timeouted: false,
sampling: options.sampling
}
logInfo('Adomik Analytics enabled with config', options);
adomikAdapter.adapterEnableAnalytics(options);
};

adomikAdapter.checkOptions = function(options) {
if (typeof options !== 'undefined') {
if (options.id && options.url) { adomikAdapter.enable(options); } else { logInfo('Adomik Analytics disabled because id and/or url is missing from config', options); }
} else { logInfo('Adomik Analytics disabled because config is missing'); }
};

adomikAdapter.checkSampling = function(options) {
_sampled = typeof options === 'undefined' ||
typeof options.sampling === 'undefined' ||
(options.sampling > 0 && Math.random() < parseFloat(options.sampling));
if (_sampled) { adomikAdapter.checkOptions(options) } else { logInfo('Adomik Analytics ignored for sampling', options.sampling); }
};

adomikAdapter.adapterEnableAnalytics = adomikAdapter.enableAnalytics;

adomikAdapter.enableAnalytics = function ({ provider, options }) {
logInfo('Adomik Analytics enableAnalytics', provider);
adomikAdapter.checkSampling(options);
adomikAdapter.enableAnalytics = function (config) {
adomikAdapter.currentContext = {};
const initOptions = config.options;

_sampled = typeof config === 'undefined' ||
typeof config.sampling === 'undefined' ||
Math.random() < parseFloat(config.sampling);

if (_sampled) {
if (initOptions) {
adomikAdapter.currentContext = {
uid: initOptions.id,
url: initOptions.url,
testId: initOptions.testId,
testValue: initOptions.testValue,
id: '',
timeouted: false,
sampling: config.sampling
}
logInfo('Adomik Analytics enabled with config', initOptions);
adomikAdapter.adapterEnableAnalytics(config);
}
} else {
logInfo('Adomik Analytics ignored for sampling', config.sampling);
}
};

adapterManager.registerAnalyticsAdapter({
Expand Down
2 changes: 1 addition & 1 deletion modules/adotBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const BIDDER_CODE = 'adot';
const ADAPTER_VERSION = 'v2.0.0';
const BID_METHOD = 'POST';
const BIDDER_URL = 'https://dsp.adotmob.com/headerbidding{PUBLISHER_PATH}/bidrequest';
const REQUIRED_VIDEO_PARAMS = ['mimes', 'protocols'];
const REQUIRED_VIDEO_PARAMS = ['mimes', 'minduration', 'maxduration', 'protocols'];
const DOMAIN_REGEX = new RegExp('//([^/]*)');
const FIRST_PRICE = 1;
const IMP_BUILDER = { banner: buildBanner, video: buildVideo, native: buildNative };
Expand Down
Loading