Nexx360 Analytics Adapter: add analytics adapter - #15388
Conversation
|
This PR includes an adapter whose code does not match its file name. Bid adapter modules should be named |
|
This PR introduces changes that may not work on all browsers. According to Babel, the following polyfills may be needed, and they are not automatically included:
The best way to address this is to provide good test coverage, as normal PR checks run unit tests on older browsers. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b12c995d02
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Barecheck - Code coverage reportTotal: 91.17%Your code coverage diff: 0.03% ▴ Uncovered files and lines
|
Adds the nexx360 endpoint analytics adapter. It buffers per-auction events (auctionInit, bidRequested, bidResponse, bidTimeout) and flushes them on auctionEnd, and sends bidWon / adRenderSucceeded / adRenderFailed immediately. When a nexx360 bid response arrives, a serverAuction event is synthesized from server-side auction data on the OpenRTB response ext. Beacons POST as text/plain (no CORS preflight) with no credentials. Sampling is applied server-side. Also extends libraries/nexx360Utils (used by the Nexx360 Bid Adapter) with extractServerAuction / getLastServerAuctionData / clearLastServerAuctionData plus a types module, which the serverAuction event depends on. Maintainer: tech@nexx360.io Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NGAcCirXcABf5miqJbouV2
b12c995 to
59f6343
Compare
|
Hi @monis0395, @jsnellbaker , any news on that? |
|
@codex review also check for public interfaces rule in PR_Review.md |
@gchicoye overall the PR looks good! I just need to confirm one thing related to exporting of types for analytics. Will let you know once done! |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 59f6343c8b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| return []; | ||
| } | ||
|
|
||
| extractServerAuction(respBody); |
There was a problem hiding this comment.
Clear server auction data when bids are rejected
Fresh evidence in the current revision is that ext.serverAuction is still copied into a module-level slot before any returned bid is validated by core. When the Nexx360 response contains a seatbid entry but the bid is malformed or rejected by isValid (for example, missing price makes cpm undefined, or createResponse throws after this assignment), no BID_RESPONSE analytics path runs to consume or clear the slot, so the next unrelated accepted Nexx360 bid can emit this stale server auction under the wrong auction.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cb6bdb6 by removing the module-level slot entirely. interpretResponse now attaches the server-auction data to every bid response it returns (serverAuctionData field), and the analytics adapter reads it from the bidResponse event args. The data travels with the bid that produced it, so a bid rejected by core (or a createResponse throw) can no longer leave stale data behind for an unrelated auction — the whole stale-slot class of bugs is gone. getLastServerAuctionData/clearLastServerAuctionData are removed; tests updated accordingly.
| }, JSON.stringify(events), { | ||
| contentType: 'text/plain', | ||
| method: 'POST', | ||
| }); |
There was a problem hiding this comment.
Set keepalive on analytics POSTs
For analytics POSTs emitted at BID_WON/AD_RENDER_* or flushed at auction end, page navigation can occur before a normal fetch completes; this options object omits keepalive, so those low-priority telemetry events are more likely to be dropped during unload. Add keepalive: true to the ajax options.
AGENTS.md reference: AGENTS.md:L71-L71
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cb6bdb6 — keepalive: true added to the ajax options so the low-priority telemetry POSTs survive page navigation.
|
|
||
| const originEnableAnalytics = nexx360AnalyticsAdapter.enableAnalytics; | ||
|
|
||
| nexx360AnalyticsAdapter.enableAnalytics = function(config: { options?: Partial<AnalyticsOptions> }) { |
There was a problem hiding this comment.
Type the public analytics options
The only typing for Nexx360's publisher-facing config is this private wrapper parameter, so pbjs.enableAnalytics({ provider: 'nexx360', options: ... }) still falls back to the generic analytics config shape and TypeScript consumers do not get checks for required publisherId or the endpoint/abTestLabel option names. Add a provider-specific AnalyticsProviderConfig module declaration for the 'nexx360' options instead of keeping the interface local-only.
AGENTS.md reference: AGENTS.md:L24-L24
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Fixed in cb6bdb6. The branch is now synced with master to pick up #15467, and the adapter exports Nexx360AnalyticsOptions and registers it via the AnalyticsProviderConfig module augmentation (same pattern as pgamdirectAnalyticsAdapter), so pbjs.enableAnalytics({provider: 'nexx360', options}) is fully typed with publisherId required.
- Attach server-auction data to each bid response instead of holding it in module state, so it travels with the bid that produced it and can no longer leak into an unrelated auction when a bid is rejected by core (removes getLastServerAuctionData/clearLastServerAuctionData). - Add keepalive: true to analytics POSTs so low-priority telemetry survives page navigation. - Expose publisher-facing options types via the AnalyticsProviderConfig augmentation introduced in prebid#15467. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_018xpKEXiu3WKjAC9iBwAcVi
|
@monis0395 All Codex comments are addressed in cb6bdb6 (branch synced with master):
Lint clean, 26 unit tests passing, tsc clean on the changed files. PR description updated accordingly. |
Type of change
Description of change
Adds the Nexx360 Analytics Adapter (
nexx360Analytics), anendpoint-type analytics adapter that reports Prebid auction activity to the Nexx360 monitoring collector.auctionEnd:auctionInit,bidRequested,bidResponse,bidTimeout.bidWon,adRenderSucceeded,adRenderFailed(failure carriesreason).serverAuctionevent:libraries/nexx360Utilsattaches server-side auction data from the Nexx360 OpenRTB responseextto each bid response it produces (serverAuctionData); when anexx360bid response carrying that data is seen, aserverAuctionevent is synthesized (once per auction). Because the data travels with the bid that produced it, it cannot leak into an unrelated auction.${endpoint}/events(defaulthttps://monitoring.nexx360.io) usingnoCredsAjaxwithcontentType: 'text/plain'andkeepalive: true, so the cross-origin request is a CORS simple request (no preflight), carries no credentials, and survives page navigation.Config (
enableAnalyticsoptions):publisherId(required),endpoint(optional),abTestLabel(optional). Options are typed via theAnalyticsProviderConfigaugmentation from #15467 (Nexx360AnalyticsOptions).Rules compliance: uses the shared
AnalyticsAdapterbase (providesdisableAnalytics); no storage (gvlid: null); TypeScript public types provided.Also extends
libraries/nexx360Utils(already used by the merged Nexx360 Bid Adapter) sointerpretResponseattachesserverAuctionDatato bid responses, plus atypesmodule — a functional dependency of theserverAuctionevent.Maintainer: tech@nexx360.io
Testing
Other information
Docs PR: prebid/prebid.github.io#6680