Skip to content

Commit

Permalink
Browsi RTD Module: add pageview billable event (prebid#9207)
Browse files Browse the repository at this point in the history
* real time data module,
browsi sub module for real time data,
new hook bidsBackCallback,
fix for config unsubscribe

* change timeout&primary ad server only to auctionDelay
update docs

* support multiple providers

* change promise to callbacks
configure submodule on submodules.json

* bug fixes

* use Prebid ajax

* tests fix

* browsi real time data provider improvements

* real time data module,
browsi sub module for real time data,
new hook bidsBackCallback,
fix for config unsubscribe

* change timeout&primary ad server only to auctionDelay
update docs

* support multiple providers

* change promise to callbacks
configure submodule on submodules.json

* bug fixes

* use Prebid ajax

* tests fix

* browsi real time data provider improvements

* fire billable event according to event listener
  • Loading branch information
omerDotan committed Nov 21, 2022
1 parent 1a5f5ff commit f5fdcf0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
10 changes: 6 additions & 4 deletions modules/browsiRtdProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,12 @@ export function addBrowsiTag(data) {

export function sendPageviewEvent(eventType) {
if (eventType === 'PAGEVIEW') {
events.emit(CONSTANTS.EVENTS.BILLABLE_EVENT, {
vendor: 'browsi',
type: 'pageview',
billingId: generateUUID()
window.addEventListener('browsi_pageview', () => {
events.emit(CONSTANTS.EVENTS.BILLABLE_EVENT, {
vendor: 'browsi',
type: 'pageview',
billingId: generateUUID()
})
})
}
}
Expand Down
3 changes: 2 additions & 1 deletion test/spec/modules/browsiRtdProvider_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,8 @@ describe('browsi Real time data sub module', function () {
})
it('should send event if type is correct', function () {
sendPageviewEvent('PAGEVIEW')

const pageViewEvent = new CustomEvent('browsi_pageview', {});
window.dispatchEvent(pageViewEvent);
const expectedCall = {
vendor: 'browsi',
type: 'pageview',
Expand Down

0 comments on commit f5fdcf0

Please sign in to comment.