Add items param to trackRecommendationResultsView for variation ID su… - #277
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the public tracking API for recommendation result views to accept full CIOItem objects (enabling variationID support) while preserving the existing customerIDs path for backwards compatibility. It mirrors the established items behavior used by other tracking endpoints (e.g., browse/search results loaded), including preferring items over customerIDs when both are provided.
Changes:
- Add
items: [CIOItem]?parameter toConstructorIO.trackRecommendationResultsView. - Extend
CIOTrackRecommendationResultsViewDatato serializeitems(includingvariation_idand sponsored listing fields) and prefer it overcustomerIDs. - Add/extend unit tests to cover
itemspayload serialization and precedence.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| AutocompleteClient/FW/Logic/Worker/ConstructorIO.swift | Adds items parameter to the public tracking API and updates docstring usage example. |
| AutocompleteClient/FW/Logic/Request/CIOTrackRecommendationResultsViewData.swift | Adds items to request data and serializes it into the items payload (preferred over customerIDs). |
| AutocompleteClientTests/FW/Logic/Worker/ConstructorIOTrackRecommendationResultsViewTests.swift | Adds a call-site test ensuring the method accepts items without breaking existing behavior. |
| AutocompleteClientTests/FW/Logic/Request/TrackRecommendationViewRequestBuilder.swift | Adds payload-focused tests for items, sponsored listing fields, and items > customerIDs precedence. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This PR correctly adds items: [CIOItem]? to trackRecommendationResultsView, mirroring the existing trackBrowseResultsLoaded / trackSearchResultsLoaded pattern, and the serialization logic, test renames, and new test coverage are all solid.
Inline comments: 5 discussions added
Overall Assessment:
evanyan13
left a comment
There was a problem hiding this comment.
LGTM
Thank you @Sher-Bakhodirov for working on the changes 💯
Have made some updates to align with current documentation format
Summary
Adds an
items: [CIOItem]?param totrackRecommendationResultsViewso callerscan pass
variationIDs. MirrorstrackBrowseResultsLoaded;itemsis preferred overcustomerIDswhen both are set. Backwards-compatible.Why one method, not two overloads
A separate
items:overload would be ambiguous — with defaults on every param,calls omitting both
customerIDsanditems(e.g.trackRecommendationResultsView(podID:)) fail to compile. A single methodmatches
trackBrowseResultsLoadedand stays backwards-compatible.