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

Rubicon analytics v2 #5698

Merged
merged 15 commits into from
Sep 16, 2020
Merged

Rubicon analytics v2 #5698

merged 15 commits into from
Sep 16, 2020

Conversation

robertrmartinez
Copy link
Collaborator

Type of change

  • Feature

Description of change

Adding functionality to the Rubicon Analytics adapter to work with session and googletag level data sets.

@@ -126,10 +135,11 @@ function sendMessage(auctionId, bidWonId) {
});
}
let auctionCache = cache.auctions[auctionId];
let referrer = config.getConfig('pageUrl') || auctionCache.referrer;
let referrer = config.getConfig('pageUrl') || (auctionCache && auctionCache.referrer);
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

handle if this is undefinied in some cases

if (auctionCache.session.fpkvs && Object.keys(auctionCache.session.fpkvs).length) {
message.fpkvs = Object.keys(auctionCache.session.fpkvs).map(key => {
return { key, value: auctionCache.session.fpkvs[key] };
});
Copy link
Collaborator Author

@robertrmartinez robertrmartinez Sep 3, 2020

Choose a reason for hiding this comment

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

mapping into array of objects of { key, value } requested by internal team

@@ -376,12 +492,18 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
]);
cacheEntry.bids = {};
cacheEntry.bidsWon = {};
cacheEntry.referrer = args.bidderRequests[0].refererInfo.referer;
cacheEntry.referrer = utils.deepAccess(args, 'bidderRequests.0.refererInfo.referer');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

deep acess so we do not throw runtime undefined errors

'creativeId', creativeId => utils.isNumber(creativeId) ? creativeId : undefined,
'lineItemId', lineItemId => utils.isNumber(lineItemId) ? lineItemId : undefined,
'adSlot', () => event.slot.getAdUnitPath(),
'isSlotEmpty', () => event.isEmpty || undefined
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

WE only want to send this if slot.isEmpty is true.

If the slot is NOT empty, then there will be the advertiserIds etc, so not necessary to send.

Copy link
Contributor

@msm0504 msm0504 left a comment

Choose a reason for hiding this comment

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

Code changes look good. Just had 1 question on the test schema file

@@ -293,7 +368,8 @@
"success",
"no-bid",
"error",
"rejected"
"rejected-gdpr",
Copy link
Contributor

Choose a reason for hiding this comment

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

Will the status ever be rejected-gdpr? I don't see this string used anywhere else in the code

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not yet, but that is to come in another phase.

I can remove it though

Copy link
Collaborator

@harpere harpere left a comment

Choose a reason for hiding this comment

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

few questions

cache.auctions[args.auctionId] = cacheEntry;
// register to listen to gpt events if not done yet
if (!cache.gpt.registered && utils.isGptPubadsDefined()) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

where is cache.gpt.registered set to true?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

it is not, must have left it out or removed it accidentally! Thanks, good catch!


function setRpaCookie(decodedCookie) {
try {
storage.setCookie(COOKIE_NAME, window.btoa(JSON.stringify(decodedCookie)));
Copy link
Collaborator

Choose a reason for hiding this comment

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

why using a cookie rather than local storage?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

updated to localStorage

if (!utils.deepAccess(bid, 'adUnit.adSlot') && utils.deepAccess(args, 'floorData.matchedFields.gptSlot')) {
bid.adUnit.adSlot = args.floorData.matchedFields.gptSlot;
if (!utils.deepAccess(bid, 'adUnit.gam.adSlot') && utils.deepAccess(args, 'floorData.matchedFields.gptSlot')) {
utils.deepSetValue(bid, 'adUnit.gam.adSlot', args.floorData.matchedFields.gptSlot);
Copy link
Collaborator

Choose a reason for hiding this comment

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

not sending pbAdSlot?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -479,7 +608,7 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
delete bid.error; // it's possible for this to be set by a previous timeout
break;
case NO_BID:
bid.status = args.status === BID_REJECTED ? 'rejected' : 'no-bid';
bid.status = args.status === BID_REJECTED ? 'rejected-ipf' : 'no-bid';
Copy link
Collaborator

Choose a reason for hiding this comment

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

why -ipf? Is this the only reason a bid could be rejected? Maybe we use a status called BID_REJECTED_IPF to make this more explicit?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There will be future rejected reasons, so updating with -ipf now.

But I'll make it a constant.

@@ -608,7 +612,7 @@ let rubiconAdapter = Object.assign({}, baseAdapter, {
delete bid.error; // it's possible for this to be set by a previous timeout
break;
case NO_BID:
bid.status = args.status === BID_REJECTED ? 'rejected-ipf' : 'no-bid';
bid.status = args.status === BID_REJECTED ? BID_REJECTED_IPF : 'no-bid';
Copy link
Collaborator

Choose a reason for hiding this comment

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

I was thinking args.status === BID_REJECTED_IPF as the constant. Cause what if new code starts rejecting bids for a reason other than ipf? But this would require updates in other places.

Copy link
Collaborator

Choose a reason for hiding this comment

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

but we can fix this later. for now this is ok

@robertrmartinez robertrmartinez merged commit 140a67c into master Sep 16, 2020
@robertrmartinez robertrmartinez deleted the rubiconAnalytics-v2 branch September 16, 2020 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants