Add optional seedItemIds to trackRecommendationClick#256
Conversation
There was a problem hiding this comment.
Pull request overview
Adds support for optionally including seedItemIds when sending trackRecommendationClick events, allowing the API to receive the seed item(s) that generated the recommendation.
Changes:
- Extend
trackRecommendationClickto acceptseedItemIds(string or string array) and send it asseed_item_idsin the POST body. - Update TypeScript declarations to include the new optional parameter.
- Add unit tests covering omission and inclusion of
seed_item_idsfor different input shapes.
Reviewed changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
src/types/tracker.d.ts |
Adds seedItemIds?: string[] | string to trackRecommendationClick parameter types. |
src/modules/tracker.js |
Adds JSDoc + parameter normalization/mapping to send seed_item_ids in the request body. |
spec/src/modules/tracker.js |
Adds tests for seedItemIds behavior (omitted/array/string/invalid type). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| * @param {number} [parameters.numResultsPerPage] - Number of results on page | ||
| * @param {object} [parameters.analyticsTags] - Pass additional analytics data | ||
| * @param {string[]|string} [parameters.seedItemIds] - Item ID(s) used to generate recommendations | ||
| * @param {object} userParameters - Parameters relevant to the user request |
|
|
||
| expect(tracker.trackRecommendationClick({ ...requiredParameters, seedItemIds }, userParameters)).to.equal(true); | ||
| }); | ||
| it('Should return valid response and omit seed_items_id if seedItemIds is not string or array', (done) => { |
|
@Sher-Bakhodirov thanks for working on this. I don't love having |
There was a problem hiding this comment.
Code Review
This PR adds an optional seedItemIds parameter to trackRecommendationView and trackRecommendationClick, with tests and TypeScript types included — the implementation is clean and well-structured.
Inline comments: 5 discussions added
Overall Assessment:
No description provided.