Skip to content

Support analytics adapters in generated Prebid bundles #1085

Description

@ChristianPavilonis

User story

As a publisher using ts prebid bundle, I want to select Prebid analytics adapters alongside bidder and User ID modules so that replacing the publisher's Prebid bundle does not leave configured pbjs.enableAnalytics providers unregistered.

Current behavior

[integrations.prebid.bundle] accepts only adapters and user_id_modules. The CLI and build-prebid-external.mjs have no supported way to import analytics adapter modules. If publisher code enables an adapter that was present in its original bundle, Prebid logs no analytics adapter found in registry after Trusted Server substitutes the generated bundle.

One observed case requires the upstream atsAnalyticsAdapter.js module, registered as atsAnalytics. A second configured provider, mavenDistributionAnalyticsAdapter, is not present in the repository's pinned Prebid.js package and needs an actionable unsupported-module error unless custom adapter support is designed separately.

Proposed behavior

Add an optional typed configuration field:

[integrations.prebid.bundle]
analytics_adapters = ["atsAnalyticsAdapter"]

Then:

  • parse and validate the field in ts prebid bundle;
  • pass the selection to the JavaScript bundle generator;
  • resolve modules only from the pinned prebid.js/modules directory and reject missing or escaping paths;
  • statically import selected analytics modules into the generated entry point;
  • include selected module names in the generated bundle manifest;
  • retain the existing bundle hash and SRI update flow; and
  • document how module filenames map to the adapter names used by pbjs.enableAnalytics.

Do not accept arbitrary local paths or remote URLs as part of this issue. Publisher-specific analytics adapters need a separate design with reproducible builds and an explicit trust policy.

Completion criteria

  • A bundle generated with atsAnalyticsAdapter registers atsAnalytics, and enabling it no longer produces a missing-registry error.
  • An unavailable module fails the build with the config field, requested name, and supported-module guidance in the error.
  • Omitting analytics_adapters preserves current output behavior.
  • CLI parsing, generator output, manifest data, invalid module names, and runtime registration have automated tests.
  • The Prebid integration and configuration guides describe the field and the upstream-only limitation.

Metadata

Metadata

Labels

storyA user-facing feature or capability

Type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions