Skip to content

Commit

Permalink
Rubicon integration type (#4008)
Browse files Browse the repository at this point in the history
* Add microadBidAdapter

* Remove unnecessary encodeURIComponent from microadBidAdapter

* Submit Advangelists Prebid Adapter

* Submit Advangelists Prebid Adapter 1.1

* Correct procudtion endpoint for prebid

* analytics update with wrapper name

* reverted error merge

* Update Rubicon Bid and Analytics Adapters to read int_type from config

* Unit tests for changes to Rubicon bid and analytics adapters
  • Loading branch information
msm0504 authored and harpere committed Jul 23, 2019
1 parent c202a13 commit 517c252
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 4 deletions.
4 changes: 2 additions & 2 deletions modules/rubiconAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ config.getConfig('s2sConfig', ({s2sConfig}) => {
});

export const SEND_TIMEOUT = 3000;
const INTEGRATION = 'pbjs';
const DEFAULT_INTEGRATION = 'pbjs';

const cache = {
auctions: {},
Expand Down Expand Up @@ -139,7 +139,7 @@ function sendMessage(auctionId, bidWonId) {
let referrer = config.getConfig('pageUrl') || utils.getTopWindowUrl();
let message = {
eventTimeMillis: Date.now(),
integration: INTEGRATION,
integration: config.getConfig('rubicon.int_type') || DEFAULT_INTEGRATION,
version: '$prebid.version$',
referrerUri: referrer
};
Expand Down
6 changes: 4 additions & 2 deletions modules/rubiconBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {registerBidder} from '../src/adapters/bidderFactory';
import {config} from '../src/config';
import {BANNER, VIDEO} from '../src/mediaTypes';

const INTEGRATION = 'pbjs_lite_v$prebid.version$';
const DEFAULT_INTEGRATION = 'pbjs_lite';

function isSecure() {
return location.protocol === 'https:';
Expand Down Expand Up @@ -385,6 +385,8 @@ export const spec = {

const [latitude, longitude] = params.latLong || [];

const configIntType = config.getConfig('rubicon.int_type');

const data = {
'account_id': params.accountId,
'site_id': params.siteId,
Expand All @@ -394,7 +396,7 @@ export const spec = {
'p_pos': params.position === 'atf' || params.position === 'btf' ? params.position : 'unknown',
'rp_floor': (params.floor = parseFloat(params.floor)) > 0.01 ? params.floor : 0.01,
'rp_secure': isSecure() ? '1' : '0',
'tk_flint': INTEGRATION,
'tk_flint': `${configIntType || DEFAULT_INTEGRATION}_v$prebid.version$`,
'x_source.tid': bidRequest.transactionId,
'p_screen_res': _getScreenResolution(),
'kw': Array.isArray(params.keywords) ? params.keywords.join(',') : '',
Expand Down
27 changes: 27 additions & 0 deletions test/spec/modules/rubiconAnalyticsAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -728,4 +728,31 @@ describe('rubicon analytics adapter', function () {
expect(bidResponseObj.bidPriceUSD).to.equal(1.0);
});
});

describe('config with integration type', () => {
it('should use the integration type provided in the config instead of the default', () => {
sandbox.stub(config, 'getConfig').callsFake(function (key) {
const config = {
'rubicon.int_type': 'testType'
};
return config[key];
});

rubiconAnalyticsAdapter.enableAnalytics({
options: {
endpoint: '//localhost:9999/event',
accountId: 1001
}
});

performStandardAuction();

expect(requests.length).to.equal(1);
const request = requests[0];
const message = JSON.parse(request.requestBody);
expect(message.integration).to.equal('testType');

rubiconAnalyticsAdapter.disableAnalytics();
});
});
});
13 changes: 13 additions & 0 deletions test/spec/modules/rubiconBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2011,6 +2011,19 @@ describe('the rubicon adapter', function () {
expect(bids[0].height).to.equal(480);
});
});

describe('config with integration type', () => {
it('should use the integration type provided in the config instead of the default', () => {
sandbox.stub(config, 'getConfig').callsFake(function (key) {
const config = {
'rubicon.int_type': 'testType'
};
return config[key];
});
const [request] = spec.buildRequests(bidderRequest.bids, bidderRequest);
expect(parseQuery(request.data).tk_flint).to.equal('testType_v$prebid.version$');
});
});
});
});

Expand Down

0 comments on commit 517c252

Please sign in to comment.