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

Consumable Bid Adapter: remove EID non-objects #12646

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
1 change: 1 addition & 0 deletions modules/consumableBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,7 @@ function retrieveAd(decision, unitId, unitName) {
function handleEids(data, validBidRequests) {
let bidUserIdAsEids = deepAccess(validBidRequests, '0.userIdAsEids');
if (isArray(bidUserIdAsEids) && bidUserIdAsEids.length > 0) {
bidUserIdAsEids = bidUserIdAsEids.filter(e => typeof e === 'object');
deepSetValue(data, 'user.eids', bidUserIdAsEids);
} else {
deepSetValue(data, 'user.eids', undefined);
Expand Down
42 changes: 42 additions & 0 deletions test/spec/modules/consumableBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,48 @@ describe('Consumable BidAdapter', function () {
expect(data.user.eids).to.deep.equal(bidderRequest.bidRequest[0].userIdAsEids);
});

it("Request should remove non-objects for userIdAsEids", function () {
Copy link
Collaborator

Choose a reason for hiding this comment

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

it feels like the userid module itself should handle this. Do you have a test page where this occurs?

Copy link
Contributor

Choose a reason for hiding this comment

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

Hi @patmmccann, unfortunately we don't have a test page. We have been seeing this intermittently with a few of our publisher partners that have been sending invalid eids sections intermittently. Here is an example of an invalid eids section that we have seen in the wild. I have replaced all user ids with "aaa".

"eids": [
            {
                "source": "33across.com",
                "uids": [
                    {
                        "id": "33acrossId_SINCERA_TRACKING_IDENTIFIER",
                        "atype": 1
                    }
                ]
            },
            {
                "source": "criteo.com",
                "uids": [
                    {
                        "id": "criteo_SINCERA_TRACKING_IDENTIFIER",
                        "atype": 1
                    }
                ]
            },
            {
                "source": "neustar.biz",
                "uids": [
                    {
                        "id": "aaa",
                        "atype": 1
                    }
                ]
            },
            {
                "source": "id5-sync.com",
                "uids": [
                    {
                        "id": "aaa",
                        "atype": 1,
                        "ext": {
                            "linkType": 2,
                            "pba": "aaa"
                        }
                    }
                ]
            },
            "pubProvidedId_SINCERA_TRACKING_IDENTIFIER",
            {
                "source": "pubcid.org",
                "uids": [
                    {
                        "id": "aaa",
                        "atype": 1
                    }
                ]
            }
        ]

bidderRequest.bidRequest[0].userId = {};
bidderRequest.bidRequest[0].userId.tdid = "TTD_ID";
bidderRequest.bidRequest[0].userIdAsEids = [
{
source: "adserver.org",
uids: [
{
id: "TTD_ID_FROM_USER_ID_MODULE",
atype: 1,
ext: {
rtiPartner: "TDID",
},
},
],
},
'RANDOM_IDENTIFIER_STRING'
];
let scrubbedEids = [
{
source: "adserver.org",
uids: [
{
id: "TTD_ID_FROM_USER_ID_MODULE",
atype: 1,
ext: {
rtiPartner: "TDID",
},
},
],
},
];
let request = spec.buildRequests(
bidderRequest.bidRequest,
BIDDER_REQUEST_1
);
let data = JSON.parse(request.data);
expect(data.user.eids).to.deep.equal(
scrubbedEids
);
});

it('Request should NOT have adsrvrOrgId params if userId is NOT object', function() {
let request = spec.buildRequests(bidderRequest.bidRequest, BIDDER_REQUEST_1);
let data = JSON.parse(request.data);
Expand Down
Loading