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

Native: privacyLink is now converted to ortb.privacy #10271

Merged
merged 3 commits into from
Aug 10, 2023
Merged
Show file tree
Hide file tree
Changes from 2 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: 0 additions & 1 deletion src/constants.json
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,6 @@
"MAIN": 3
},
"NATIVE_KEYS_THAT_ARE_NOT_ASSETS": [
"privacyLink",
"clickUrl",
"sendTargetingKeys",
"adTemplate",
Expand Down
13 changes: 12 additions & 1 deletion src/native.js
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,11 @@ export function toOrtbNativeRequest(legacyNativeAssets) {
continue;
}

if (key === 'privacyLink') {
ortb.privacy = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

If I say privacyLink: {required: false} should this still be set to 1?

Copy link
Collaborator

Choose a reason for hiding this comment

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

in ORTB the flag signals support and not whether the link is required, so maybe this is OK - but we should set required: false in the inverse logic?

Copy link
Contributor Author

@musikele musikele Aug 1, 2023

Choose a reason for hiding this comment

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

My takes on this

If I say privacyLink: {required: false} should this still be set to 1?

I'd say the presence of the attribute means that you'd like to set privacy to 1.

in ORTB the flag signals support and not whether the link is required, so maybe this is OK - but we should set required: false in the inverse logic?

Agree, will fix

continue;
}

const asset = legacyNativeAssets[key];
let required = 0;
if (asset.required && isBoolean(asset.required)) {
Expand Down Expand Up @@ -623,6 +628,9 @@ export function fromOrtbNativeRequest(openRTBRequest) {
oldNativeObject[prebidAssetName].len = asset.data.len;
}
}
if (openRTBRequest.privacy) {
oldNativeObject.privacyLink = { required: false };
}
// video was not supported by old prebid assets
}
return oldNativeObject;
Expand Down Expand Up @@ -696,8 +704,11 @@ export function legacyPropertiesToOrtbNative(legacyNative) {
// in general, native trackers seem to be neglected and/or broken
response.jstracker = Array.isArray(value) ? value.join('') : value;
break;
case 'privacyLink':
response.privacy = 1;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't this value be a string of the URL that the adapters return for the old privacyLink; which I suppose should be the value variable for this particular function?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah you are definitely right ----

break;
}
})
});
return response;
}

Expand Down
11 changes: 9 additions & 2 deletions test/spec/native_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -860,6 +860,9 @@ describe('validate native', function () {
}]
},
address: {},
privacyLink: {
required: true
}
},
},
};
Expand Down Expand Up @@ -915,6 +918,7 @@ describe('validate native', function () {
type: 9,
}
});
expect(ortb.privacy).to.equal(1);
});

['bogusKey', 'clickUrl', 'privacyLink'].forEach(nativeKey => {
Expand Down Expand Up @@ -1022,11 +1026,14 @@ describe('validate native', function () {
expect(oldNativeRequest.sponsoredBy).to.include({
required: true,
len: 25
})
});
expect(oldNativeRequest.body).to.include({
required: true,
len: 140
})
});
expect(oldNativeRequest.privacyLink).to.include({
required: false
});
});

if (FEATURES.NATIVE) {
Expand Down