Skip to content

Commit

Permalink
Merge pull request #7 from voyagegroup/browsi-impression
Browse files Browse the repository at this point in the history
Enable browsiImpression event.
  • Loading branch information
from20020516 authored Nov 4, 2021
2 parents 3db2c13 + 0d95d4e commit 324dbc1
Showing 1 changed file with 9 additions and 18 deletions.
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;
}
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);
}
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)
})

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

0 comments on commit 324dbc1

Please sign in to comment.