Skip to content

Commit

Permalink
fix for privacyLink in native prebid#10249
Browse files Browse the repository at this point in the history
  • Loading branch information
Michele Nasti committed Jul 21, 2023
1 parent dd4b25e commit 863f153
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
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
8 changes: 8 additions & 0 deletions 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;
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: true };
}
// video was not supported by old prebid assets
}
return oldNativeObject;
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: true
});
});

if (FEATURES.NATIVE) {
Expand Down

0 comments on commit 863f153

Please sign in to comment.