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

[PGE-178206904] Send Transaction ID to STX #1544

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
11 changes: 6 additions & 5 deletions modules/sharethroughBidAdapter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { deepAccess, generateUUID, inIframe } from '../src/utils.js';
import { deepAccess, generateUUID, inIframe, mergeDeep } from '../src/utils.js';
import { registerBidder } from '../src/adapters/bidderFactory.js';
import { config } from '../src/config.js';
import { BANNER, VIDEO } from '../src/mediaTypes.js';
Expand Down Expand Up @@ -52,6 +52,7 @@ export const sharethroughAdapterSpec = {
ext: {},
},
source: {
tid: bidderRequest.auctionId,
ext: {
version: '$prebid.version$',
str: VERSION,
Expand Down Expand Up @@ -80,12 +81,12 @@ export const sharethroughAdapterSpec = {
}

const imps = bidRequests.map(bidReq => {
const impression = {};
const impression = { ext: {} };

mergeDeep(impression, bidReq.ortb2Imp);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are we sure that we want this - since it merges everrything in from the bid request? Will STX properly ignore what its not expecting to receive in the bid request? Are we sure that there risk is minimal of impression requests being potentially larger than expected (full of additional fields that mean nothing to the exchange?)

I recommend sanity checking, if you haven't already done so, this approach with STX Core, specifically via the universal endpoint. Not opposed per se, but want to make sure supply and exchange are aligned on this change.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, it doesn't merge "everything", it merges what Prebid allows the publishers to inject in the requests, from the doc:

ortb2Imp is used to signal OpenRTB Imp objects at the adUnit grain. Similar to the global ortb2 field used for global first party data configuration, but specific to this adunit. The ortb2Imp object currently supports first party data including the Prebid Ad Slot and the interstitial signal.

from which everything lives in the ext field.

I can ask STX but I believe we already have a some fields that STX does not care about but DSPs do, so it would fall into the same category. I think the universal endpoint mostly acts as a passthrough since both input and output are openRTB formatted, allowing us at the adapter level to leverage as much Prebid features as we can and let DSPs read or ignore as they will.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


const gpid = deepAccess(bidReq, 'ortb2Imp.ext.data.pbadslot');
if (gpid) {
impression.ext = { gpid: gpid };
}
if (gpid) impression.ext.gpid = gpid;

const videoRequest = deepAccess(bidReq, 'mediaTypes.video');

Expand Down
14 changes: 13 additions & 1 deletion test/spec/modules/sharethroughBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ describe('sharethrough adapter spec', function () {
},
ortb2Imp: {
ext: {
tid: 'transaction-id-1',
data: {
pbadslot: 'universal-id',
},
Expand Down Expand Up @@ -168,6 +169,7 @@ describe('sharethrough adapter spec', function () {
refererInfo: {
ref: 'https://referer.com',
},
auctionId: 'transactionId1',
};
});

Expand Down Expand Up @@ -229,6 +231,7 @@ describe('sharethrough adapter spec', function () {
expect(openRtbReq.device.ua).to.equal(navigator.userAgent);
expect(openRtbReq.regs.coppa).to.equal(1);

expect(openRtbReq.source.tid).to.equal(bidderRequest.auctionId);
expect(openRtbReq.source.ext.version).not.to.be.undefined;
expect(openRtbReq.source.ext.str).not.to.be.undefined;
expect(openRtbReq.source.ext.schain).to.deep.equal(bidRequests[0].schain);
Expand Down Expand Up @@ -310,12 +313,21 @@ describe('sharethrough adapter spec', function () {
});
});

describe('transaction id at the impression level', () => {
it('should include transaction id when provided', () => {
const requests = spec.buildRequests(bidRequests, bidderRequest);

expect(requests[0].data.imp[0].ext.tid).to.equal('transaction-id-1');
expect(requests[1].data.imp[0].ext).to.be.empty;
});
});

describe('universal id', () => {
it('should include gpid when universal id is provided', () => {
const requests = spec.buildRequests(bidRequests, bidderRequest);

expect(requests[0].data.imp[0].ext.gpid).to.equal('universal-id');
expect(requests[1].data.imp[0].ext).to.be.undefined;
expect(requests[1].data.imp[0].ext).to.be.empty;
});
});

Expand Down