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

SmartyadsBidAdapter: remove usprivacy #11829

Merged
29 changes: 14 additions & 15 deletions modules/smartyadsBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,19 +79,19 @@ export const spec = {
let location;
location = bidderRequest?.refererInfo ?? null;
let placements = [];

let request = {
'placements': placements,
'deviceWidth': winTop.screen.width,
'deviceHeight': winTop.screen.height,
'host': location?.domain,
'page': location?.page,
'language': (navigator && navigator.language) ? navigator.language : '',
'secure': 1,
'host': location?.domain ?? '',
'page': location?.page ?? '',
'coppa': config.getConfig('coppa') === true ? 1 : 0,
Copy link
Collaborator

@patmmccann patmmccann Jun 19, 2024

Choose a reason for hiding this comment

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

We will not be accepting tricks to fool the duplication check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@patmmccann OK, but how can I fix that? I saw the report and duplication check marks, for example, the isBidResponseValid function is used in lots of adapters and looks almost the same.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Check out this work in progress from an adapter structured very similar to yours

Copy link
Collaborator

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@patmmccann I'm sorry, but I still don't get it. The previous version of the isBidResponseValid function was flagged as duplicate code by your tool, but it doesn't need any updates, right? And the same function with same code is used in other adapters

Copy link
Collaborator

@patmmccann patmmccann Jun 19, 2024

Choose a reason for hiding this comment

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

You and other modules have duplicate code, we need you to move common functions into libraries before making further updates to your adapter

Copy link
Collaborator

Choose a reason for hiding this comment

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

#8527 has an example on how to move common functions into a library

'placements': placements,
'eeid': validBidRequests[0]?.userIdAsEids,
'ifa': bidderRequest?.ortb2?.device?.ifa,
};
request.language.indexOf('-') != -1 && (request.language = request.language.split('-')[0])

if (bidderRequest) {
if (bidderRequest.gdprConsent) {
request.gdpr = bidderRequest.gdprConsent
Expand Down Expand Up @@ -129,16 +129,15 @@ export const spec = {
}
},

interpretResponse: (serverResponse) => {
let response = [];
serverResponse = serverResponse.body;
for (let i = 0; i < serverResponse.length; i++) {
let resItem = serverResponse[i];
if (isBidResponseValid(resItem)) {
response.push(resItem);
}
}
return response;
interpretResponse: (response) => {
let result = [];
const respData = response.body;

respData.forEach(resp => {
if (isBidResponseValid(resp)) response.push(resp);
});

return result;
},

getUserSyncs: (syncOptions, serverResponses = [], gdprConsent = {}, uspConsent = '', gppConsent = '') => {
Expand Down