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

Enable browsiImpression event. #7

Merged
merged 1 commit into from
Nov 4, 2021
Merged
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
27 changes: 9 additions & 18 deletions modules/fluctAnalyticsAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,17 +194,6 @@ let fluctAnalyticsAdapter = Object.assign(
}
break;
}
// 全てnobid時発火しない
case CONSTANTS.EVENTS.SET_TARGETING: {
let setTargetingEvent = args
/** @type {Array<String>} */
let divIds = Object.keys(setTargetingEvent)
if (divIds.every(isBrowsiDivId)) {
let auctionId = find(Object.values(cache.auctions), auction => find(auction.adUnits, adUnit => divIds.includes(adUnit.code)))?.auctionId
sendMessage(auctionId)
}
break;
}
Comment on lines -198 to -207
Copy link

Choose a reason for hiding this comment

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

📝 SET_TARGETINGでメッセージを送るのはやめる

case CONSTANTS.EVENTS.BID_WON: {
/** @type {Bid} */
let bidWonEvent = args
Expand All @@ -216,9 +205,11 @@ let fluctAnalyticsAdapter = Object.assign(
bidWon: true,
timeout: false,
})
cache.timeouts[auctionId] = setTimeout(() => {
sendMessage(auctionId);
}, pbjs.getConfig().bidderTimeout || 3000);
if (!isBrowsiAuction(auctionId)) {
cache.timeouts[auctionId] = setTimeout(() => {
sendMessage(auctionId);
}, pbjs.getConfig().bidderTimeout || 3000);
}
Comment on lines +208 to +212
Copy link

Choose a reason for hiding this comment

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

📝 browsi由来のauctionは別のイベントが発火するので、こちらでは無視しておく

break;
}
default:
Expand Down Expand Up @@ -341,10 +332,10 @@ const sendMessage = (auctionId) => {
ajax(url, () => utils.logInfo(`[sendMessage] ${Date.now()} :`, payload), JSON.stringify(payload), { contentType: 'application/json', method: 'POST' });
};

// window.addEventListener('browsiImpression', (data) => {
// const auction = find(Object.values(cache.auctions), auction => auction.adUnitCodes.includes(data.detail.adUnit.code))
// sendMessage(auction.auctionId)
// })
window.addEventListener('browsiImpression', (data) => {
const auction = find(Object.values(cache.auctions), auction => auction.adUnitCodes.includes(data.detail.adUnit.code))
sendMessage(auction.auctionId)
})
Comment on lines +335 to +338
Copy link

Choose a reason for hiding this comment

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

browsiが用意した browsiImpression イベントを使用


fluctAnalyticsAdapter.originEnableAnalytics = fluctAnalyticsAdapter.enableAnalytics;
fluctAnalyticsAdapter.enableAnalytics = (config) => {
Expand Down