Skip to content

feature(tercept analytics adapter) -> add page load logic#2

Open
mdusmanalvi wants to merge 5 commits into
masterfrom
feature/is-pl
Open

feature(tercept analytics adapter) -> add page load logic#2
mdusmanalvi wants to merge 5 commits into
masterfrom
feature/is-pl

Conversation

@mdusmanalvi
Copy link
Copy Markdown
Owner

Type of change

  • Bugfix

  • Feature

  • New bidder adapter

  • Updated bidder adapter

  • Code style update (formatting, local variables)

  • Refactoring (no functional changes, no api changes)

  • Build related changes

  • CI related changes

  • Does this change affect user-facing APIs or examples documented on http://prebid.org?

  • Other

Description of change

Other information

- Replace shared events object with per-auctionId Map to fix data loss
  when multiple auctions run concurrently
- Accumulate BID_WON, AD_RENDER_SUCCEEDED, AD_RENDER_FAILED and
  BIDDER_ERROR into the bids array; flush once 1.5s after AUCTION_END
- Use navigator.sendBeacon on visibilitychange so data survives page exit
- Add disableAnalytics to clear pending timers and maps on teardown
- Add try/catch around track() to prevent adapter errors disrupting page
- Remove ad, native and adUrl fields from bid payloads to reduce size
- Limit auctionInit.bidderRequests to first entry (device/site data
  is identical across all bidder requests)
- Add is_pl flag (true on first bid of first auction per page load)
Replace tests that assumed multiple requests per auction and separate
top-level keys (bidWon, adRenderSucceeded, etc.) with tests matching
the new single-request-per-auction design. Covers:

- Request timing: no send before 1.5s timer, one request per auction
- Payload structure: top-level shape, bidderRequests trimmed to first,
  host/path/search attached at send time, ad/native/adUrl absent
- All event handlers: BID_REQUESTED, BID_RESPONSE, BID_TIMEOUT, NO_BID,
  BID_WON, AD_RENDER_SUCCEEDED, AD_RENDER_FAILED, BIDDER_ERROR
- is_pl flag: true on first bid of first auction only, reset on disable
- Concurrent auction isolation: separate bids and auctionInit per id
- visibilitychange flush via sendBeacon
- disableAnalytics: cancels timers, clears maps, resets firstSent
- Error resilience: unknown auctionIds and undefined args do not throw
…mport

- Fix 81 indent errors by properly indenting the try block body
- Replace window.addEventListener with document.addEventListener for
  visibilitychange — the event is non-bubbling and fires on document,
  so window never received it in Firefox/Safari
- Replace navigator.sendBeacon with the ajax.js sendBeacon wrapper
  as required by Prebid.js linting rules
- Update test to stub ajax.sendBeacon and dispatch event on document
Split multi-property spread objects onto separate lines to satisfy
the @stylistic/object-property-newline ESLint rule.
Sets is_pl=true on every bid in the first auction fired on the page,
false on all subsequent auctions. Resets on disableAnalytics so the
flag behaves correctly if the adapter is torn down and re-enabled.

Updates expectedAfterBid fixture to include is_pl so the existing
deep-equal assertion continues to pass.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant