feat: auto-preload selectPlacements for configured accounts#85
Open
feat: auto-preload selectPlacements for configured accounts#85
Conversation
Adds account-scoped preload config. When all required attributes are present for a known account (currently Ulta: email, firstname, cartitems), the kit automatically calls selectPlacements with preload:true so WSDK can cache the experiences response before the confirmation page renders. The preload fires at most once per session and is gated by kit readiness. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
Adds account-scoped preload configuration to the Rokt Kit. When a partner's account ID is listed in
PRELOAD_CONFIGSand all required attributes for that account are present, the Kit automatically callsselectPlacementswithpreload: true. WSDK caches the experiences response so the confirmation page can render without a second API round-trip.Ulta configuration (account
2550745407543340151):email,firstname,cartitemsRoktExperienceomitUrl: true— makes the cache key page-independentTrigger points: The check runs after every
setUserAttribute,onUserIdentified,processEvent, and when the launcher finishes initializing, so the preload fires as soon as the complete attribute set is available regardless of ordering.Session gate:
self.hasPreloadedensures the preload fires at most once per tab/session, even if attributes are updated again afterward.Testing Plan
test/src/tests.jscovering: unknown account no-op, partial attributes no-op, trigger viasetUserAttribute, trigger viaonUserIdentified, once-per-session guard, and uninitialized-kit guard.preload: trueflag onselectPlacementsis handled there.