Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@joshfg
Copy link
Member

@joshfg joshfg commented Nov 14, 2025

Summary of Changes

Unified Custom Cohorts Model:

  • Introduced ccBidders config parameter to specify which bidders receive custom cohorts
  • Merged all custom cohort sources (_pprebid + legacy keys) into single unified list sent to all target bidders
  • Maintained backwards compatibility: legacy bidders (ix, rubicon, appnexus, gam) automatically receive custom cohorts

Code Quality Improvements:

  • Removed deprecated _ppam parameter
  • Standardized variable naming across signal types (acSignals, sspSignals, ccSignals)
  • Added comprehensive module-level documentation mapping local storage keys to ORTB2 locations
  • Reduced code verbosity while improving clarity

Bug Fix:

  • Added maxSegs limiting to all segment types (AC, SSP, CC signals, and Topics)

Documentation:

  • Updated permutiveRtdProvider.md with ccBidders parameter and usage examples
  • Clarified custom cohorts configuration and legacy bidder behavior

joshfg and others added 8 commits November 14, 2025 09:36
The _ppam local storage key is no longer written by the Permutive SDK and has been deprecated. This change removes all references to _ppam from the RTD provider module and its tests.

Changes:
- Removed _ppam from AC cohorts aggregation in modules/permutiveRtdProvider.js:326
- Updated test data and expectations in test/spec/modules/permutiveCombined_spec.js

Tests passed: 36/36 tests passing
Lint: Successful with no errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…ocumentation

This commit significantly improves the readability and maintainability of the Permutive RTD module by:

1. Adding comprehensive module-level documentation explaining:
   - All local storage keys and their purposes
   - Signal types (AC Signals vs SSP Signals) and distribution logic
   - ORTB2 locations and what data is written where

2. Improving variable names throughout:
   - `cohorts` -> `signalsForBidder` (eliminates confusing reuse)
   - `sspCohorts` -> `sspSignals` (clearer business terminology)
   - `segmentIDs` -> `mergedSignalIds` (describes actual content)
   - `sspSegmentIDs` -> `sspSignalIds` (consistent terminology)
   - `customCohortsData` -> `bidderCustomCohorts` (more descriptive)
   - `legacySegs` -> `standardCohorts` (accurate business term)

3. Adding structural section comments in updateOrtbConfig():
   - === ORTB2.USER.DATA[] SETUP ===
   - === ORTB2.USER.KEYWORDS SETUP ===
   - === ORTB2.USER.EXT.DATA SETUP ===
   - === ORTB2.SITE.EXT.PERMUTIVE SETUP ===

4. Clarifying ORTB2 provider mappings:
   - "permutive.com": AC/SSP Signals (Standard + DCR + Curation)
   - "permutive": Bidder-specific custom cohorts
   - "permutive.com" with segtax: Privacy Sandbox Topics

5. Adding inline comments explaining cohort types and their sources

These changes make the complex signal flow much easier to understand without changing any behavior.

Changes in modules/permutiveRtdProvider.js:
- Lines 9-62: Added comprehensive module-level documentation
- Lines 158-204: Improved setBidderRtb with clearer variable names and comments
- Lines 206-339: Enhanced updateOrtbConfig with detailed JSDoc and section headers
- Lines 417-503: Clarified getSegments with better variable names and cohort type comments

Tests passed: 36/36 tests passing
Lint: Successful with no errors

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
This commit simplifies the custom cohorts mechanism by moving from
bidder-specific custom cohorts to a unified model where all configured
bidders receive the same merged custom cohort list.

Changes to modules/permutiveRtdProvider.js:
- Added comprehensive module-level documentation mapping local storage
  keys to ORTB2 locations and explaining signal types (lines 9-64)
- Added ccBidders config parameter for custom cohort target bidders (line 148)
- Updated getSegments() to return unified customCohorts array by merging
  _pprebid + legacy keys (_papns, _prubicons, _pindexs, _pdfps) (lines 463-486)
- Updated setBidderRtb() to send custom cohorts to bidders in ccBidders
  config + hardcoded legacy bidders (ix, rubicon, appnexus, gam) (lines 175-186)
- Updated updateOrtbConfig() to accept customCohorts array parameter
  instead of bidder-specific cohorts (line 253)
- Added maxSegs limiting to all segment types: AC signals (line 460),
  SSP cohorts (line 498), and Topics (line 511)
- Improved variable names for clarity (cohorts → signalsForBidder,
  sspCohorts → sspSignals, etc.)

Changes to test/spec/modules/permutiveCombined_spec.js:
- Added ccBidders: [] to default config (line 51)
- Updated getConfig() to set ccBidders matching acBidders so tests
  receive custom cohorts as expected (line 769)
- Updated transformedTargeting() to return customCohorts array instead
  of individual bidder properties (lines 784-796)
- Updated all test references from segmentsData[bidder] to
  segmentsData.customCohorts (lines 204, 271, 395, 447, 560, 600)
- Updated "Getting segments" tests to check segments.customCohorts
  instead of segments.rubicon (lines 647, 664)
- Cleared default custom cohort data in tests that set specific values
  to avoid merging with default data (lines 636-643, 653-660)

Backwards compatibility:
- Legacy local storage keys (_papns, _prubicons, _pindexs, _pdfps) are
  still read and merged into unified custom cohorts list
- Legacy bidders (ix, rubicon, appnexus, gam) automatically receive
  custom cohorts without needing to be in ccBidders config

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…tion

Code consistency improvements:
- Standardized variable names: sspBidderCodes → sspBidders, legacyCustomCohortBidders → legacyCcBidders
- Standardized signal variable naming: customCohortsForBidder → ccSignals, bidderCustomCohorts → ccSignals
- Simplified bidder set construction to single line (line 140)
- Renamed customCohortsUserData → ccUserData for consistency
- Consistent use of isCcBidder instead of isCustomCohortBidder
- Added Topics to signal types in module documentation

Documentation updates (permutiveRtdProvider.md):
- Added params.ccBidders parameter to Parameters table
- Updated Custom Cohorts section with:
  - Example configuration showing ccBidders usage
  - List of legacy bidders that automatically receive custom cohorts
  - Explanation of _pprebid local storage key
  - Clearer description of unified custom cohorts model

Changes maintain full backwards compatibility.
All tests passing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
…l signal types

Improved code clarity by refactoring updateOrtbConfig() to accept individual
signal types (acSignals, sspSignals, ccSignals) instead of pre-merged signals.

Changes to modules/permutiveRtdProvider.js:
- Updated updateOrtbConfig() signature to accept acSignals, sspSignals, ccSignals separately
- Moved signal merging logic inside updateOrtbConfig() (line 179)
- Simplified setBidderRtb() call site - now passes individual signals based on bidder type
- Added maxSegs parameter to updateOrtbConfig() for proper signal limiting

Benefits:
- Self-documenting: Function signature clearly shows which signal types are available
- Logic colocation: Merging happens right before use, making it obvious why
- Clearer data flow: Easy to see "AC+SSP merge → p_standard", "SSP only → p_standard_aud"
- No ambiguity: acSignals always means AC signals, never pre-merged

Changes to test/spec/modules/permutiveCombined_spec.js:
- Fixed test to only expect p_standard_aud keywords for bidders that are actually SSP bidders
- Test now correctly checks if bidder is in SSP bidders list before including SSP signals

All tests passing (36/36).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
- Rename customCohorts variable to ccSignals for consistency with acSignals/sspSignals (modules/permutiveRtdProvider.js:135, 154)
- Update setBidderRtb comment to accurately reflect it handles all bidder types, not just AC bidders (modules/permutiveRtdProvider.js:121)
- Fix typo in bidderOrtb2 parameter description (modules/permutiveRtdProvider.js:122)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <[email protected]>
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