fix: resolve multi-word audience/campaign names at page level - #65
Merged
Conversation
Page-level audience/campaign metadata is read via getAllMetadata, which
camelCases keys (audience-returning-visitor -> returningVisitor). Names are then
matched + looked up in class-name form, and toClassName('returningVisitor') ->
'returningvisitor' (the word boundary is lost), so a multi-word name resolves
membership but never finds its variant URL -- the experience is silently not
served. Section- and fragment-level already key names by class-name and work.
getAllMetadata now takes an optional key transform (default toCamelCase, so
experiments keep their camelCased config props like startDate/requiresConsent).
applyAllModifications passes toClassName for audience/campaign page metadata,
matching section/fragment level. Config readers are unchanged.
Adds page-level fixtures + tests for a multi-word audience and campaign name
(red before this change). Full suite green (101), incl. experiments -- no regression.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ramboz
added a commit
that referenced
this pull request
Aug 12, 2026
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
github-actions Bot
pushed a commit
that referenced
this pull request
Aug 12, 2026
## [1.2.2](v1.2.1...v1.2.2) (2026-08-12) ### Bug Fixes * resolve multi-word audience/campaign names at page level ([#65](#65)) ([3fa2579](3fa2579))
ramboz
added a commit
that referenced
this pull request
Aug 12, 2026
- rename tracking hook to rumTracking; note the existing aem:experimentation DOM events for custom tracking - resolve two open questions into Decisions: one decision provider; reference worker in examples/ - reframe bug #2 as a clean cross-cutting fix (audiences/campaigns class-name at every level; experiments keep camelCase, with the why) and credit #65 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This was referenced Aug 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
A page-level audience or campaign with a multi-word name (e.g.
returning-visitor,black-friday) resolves its membership but never serves the variant — the experience is silently dropped.Root cause: page-level metadata is read with
getAllMetadata, which camelCases keys (audience-returning-visitor→returningVisitor). Names are then matched + looked up in class-name form, andtoClassName('returningVisitor')→returningvisitor(the word boundary is lost), so it matches neither the project config key (returning-visitor) nor the camelCase one. Section- and fragment-level already key names by class-name, so they work — only page-level is affected.Fix
getAllMetadata(scope, keyFn = toCamelCase)— an optional key transform. The default is unchanged, so experiments keep their camelCased config props (startDate,requiresConsent, …).applyAllModificationspassestoClassNamefor audience/campaign page metadata (experiments keeptoCamelCase), matching how section- and fragment-level already read names.getAudienceConfig/getCampaignConfig) are unchanged — they already handle class-name keys.Tests
Adds page-level fixtures + tests for a multi-word audience and a multi-word campaign name. They fail red before this change (the variant isn't served) and pass after. Full suite green — 101 tests, including experiments — no regression.
Found while building a bring-your-own-engine integration (see #64) — this is bug #2 from that RFC. It removes the need for hyphen-free tokens at page level.
🤖 Generated with Claude Code