forked from prebid/Prebid.js
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
6,082 additions
and
818 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
[ | ||
"appnexusBidAdapter", | ||
"rubiconBidAdapter", | ||
"ixBidAdapter", | ||
"pulsepointBidAdapter", | ||
"sovrnBidAdapter", | ||
"openxBidAdapter", | ||
"pubmaticBidAdapter", | ||
"smartadserverBidAdapter", | ||
"prebidServerBidAdapter", | ||
|
||
"marfeelAnalyticsAdapter" | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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; |
Oops, something went wrong.