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

UOE-8449: Passing Viewability Score to Auction Endpoint #394

Draft
wants to merge 3 commits into
base: nightly_node14
Choose a base branch
from
Draft
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
21 changes: 21 additions & 0 deletions src_new/adapters/prebid.js
Original file line number Diff line number Diff line change
Expand Up @@ -556,6 +556,23 @@ function pushAdapterParamsInAdunits(adapterID, generatedKey, impressionID, keyCo
/* istanbul ignore next */
slotParams[key] = value;
});

//Getting Viewablity from localCache, if not found log error with undefined Bid Viewability Score
function getBidViewabilityScore(key) {
try{
let bvsObj=window.localStorage.getItem(key)
if (bvsObj!=null){
return JSON.parse(bvsObj);
}else{
return undefined;
}
}catch(e){
util.log(CONSTANTS.MESSAGES.M32);
return undefined;
}
};
//populating Bid Viewability Score
var bvs= getBidViewabilityScore('viewability-data');

if(isPrebidPubMaticAnalyticsEnabled){
slotParams["kgpv"] = generatedKey; // TODO : Update this in case of video, change the size to 0x0
Expand Down Expand Up @@ -641,6 +658,10 @@ function pushAdapterParamsInAdunits(adapterID, generatedKey, impressionID, keyCo
slotParams["adSlot"] = slotParams["hashedKey"];
}
}
//adding viewability from BVS for specific adunit.code only when present
if(bvs && bvs.hasOwnProperty(code)){
slotParams["bidViewability"]=bvs[code];
}

// We are removing mimes because it merges with the existing adUnit mimes
// if(slotParams["video"] && slotParams["video"]["mimes"]){
Expand Down
1 change: 1 addition & 0 deletions src_new/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,7 @@ exports.MESSAGES = {
"M29": "Unable to parse Partner configuration",
"M30": "AB Test Enabled With Config",
"M31": "AB Test Enabled With Partner Config",
"M32": "Error in Parsing Bid Viewability Score",
IDENTITY: {
M1: "Unable to get User Id from OpenIdentity",
M2: "Setting UserIds to EB ",
Expand Down