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

add openx referrer #8

Merged
merged 3 commits into from
May 21, 2018
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
13 changes: 13 additions & 0 deletions modules.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
[
"appnexusBidAdapter",
"rubiconBidAdapter",
"ixBidAdapter",
"pulsepointBidAdapter",
"sovrnBidAdapter",
"openxBidAdapter",
"pubmaticBidAdapter",
"smartadserverBidAdapter",
"prebidServerBidAdapter",

"marfeelAnalyticsAdapter"
]
54 changes: 54 additions & 0 deletions modules/marfeelAnalyticsAdapter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import adapter from 'src/AnalyticsAdapter';
import CONSTANTS from 'src/constants.json';
import adaptermanager from 'src/adaptermanager';
import includes from 'core-js/library/fn/array/includes';

const utils = require('src/utils');

const url = '//pa.rxthdr.com/analytic';
const analyticsType = 'endpoint';

let AUCTION_INIT = CONSTANTS.EVENTS.AUCTION_INIT;
let AUCTION_END = CONSTANTS.EVENTS.AUCTION_END;
let BID_WON = CONSTANTS.EVENTS.BID_WON;
let BID_RESPONSE = CONSTANTS.EVENTS.BID_RESPONSE;
let auctions = {};

function auctionEnd(auction, {timedOut}) {
if (timedOut) auction.timedOut = true;

window.mrfpb && window.mrfpb.trackAuction(auction)
}

function registerWinner(auction, args) {
window.mrfpb && window.mrfpb.trackAuctionWinner(auction, args)
}

function registerBidResponse(currentAuction, bid) {
currentAuction.bidders = currentAuction.bidders || [];
currentAuction.bidders.push(bid)
}

let marfeelAnalyticsAdapter = Object.assign(adapter({url, analyticsType}),
{
track({eventType, args}) {
if (args) args.requestId = args.auctionId; // BackwardsCompatibility
if (eventType === AUCTION_INIT) {
auctions[args.auctionId] = args;
} else if (eventType === BID_RESPONSE) {
registerBidResponse(auctions[args.auctionId], args);
} else if (eventType === BID_WON) {
registerWinner(auctions[args.auctionId], args);
} else if (eventType === AUCTION_END) {
auctionEnd(auctions[args.auctionId], args);
}
},

});

adaptermanager.registerAnalyticsAdapter({
adapter: marfeelAnalyticsAdapter,
code: 'marfeel'
});

export default marfeelAnalyticsAdapter;
4 changes: 2 additions & 2 deletions modules/openxBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,8 @@ function buildCommonQueryParamsFromBids(bids) {
const isInIframe = utils.inIframe();

return {
ju: config.getConfig('pageUrl') || utils.getTopWindowUrl(),
jr: utils.getTopWindowReferrer(),
ju: bids[0].params.referrer || config.getConfig('pageUrl') || utils.getTopWindowUrl(),

Choose a reason for hiding this comment

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

what if the bids[0] doesn't exist?

Copy link

Choose a reason for hiding this comment

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

they are using it at

queryParams.bc = bids[0].params.bc || `${BIDDER_CONFIG}_${BIDDER_VERSION}`;

i think it is pretty safe

jr: bids[0].params.referrer || utils.getTopWindowReferrer(),
ch: document.charSet || document.characterSet,
res: `${screen.width}x${screen.height}x${screen.colorDepth}`,
ifr: isInIframe,
Expand Down
Loading