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 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: 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 = value;
break;
}
})
});
return response;
}

Expand Down
17 changes: 15 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 Expand Up @@ -1197,6 +1204,12 @@ describe('legacyPropertiesToOrtbNative', () => {
expect(native.jstracker).to.eql('some-markupsome-other-markup');
})
});
describe('privacylink', () => {
it('should convert privacyLink to privacy', () => {
const native = legacyPropertiesToOrtbNative({privacyLink: 'https:/my-privacy-link.com'});
expect(native.privacy).to.eql('https:/my-privacy-link.com');
})
})
});

describe('fireImpressionTrackers', () => {
Expand Down