Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add anonymousId query argument for A/B testing #647

Merged
merged 2 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

## [Unreleased]

### Added

- Created query parameter `anonymousId` for `sponsoredProducts` used on A/B testing.

## [3.128.2] - 2023-12-07

### Added
Expand Down
5 changes: 4 additions & 1 deletion react/components/SearchQuery.js
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

const isCurrentDifferent = (ref, currentVal) => ref.current !== currentVal

const useShouldResetPage = (query, map, orderBy, priceRange) => {

Check warning on line 129 in react/components/SearchQuery.js

View workflow job for this annotation

GitHub Actions / Lint

Arrow function has too many parameters (4). Maximum allowed is 3
const queryRef = useRef(query)
const mapRef = useRef(map)
const orderByRef = useRef(orderBy)
Expand Down Expand Up @@ -155,7 +155,7 @@
operator,
searchState,
fullText
) => {

Check warning on line 158 in react/components/SearchQuery.js

View workflow job for this annotation

GitHub Actions / Lint

Arrow function has too many parameters (4). Maximum allowed is 3
const fullTextRef = useRef(fullText)
const shouldReset = isCurrentDifferent(fullTextRef, fullText)

Expand Down Expand Up @@ -190,7 +190,7 @@
facetsArgs,
price,
sponsoredProductsBehavior = 'skip'
) => {

Check warning on line 193 in react/components/SearchQuery.js

View workflow job for this annotation

GitHub Actions / Lint

Arrow function has too many parameters (4). Maximum allowed is 3
const { getSettings, query: runtimeQuery } = useRuntime()
const settings = getSettings('vtex.store')

Expand All @@ -208,7 +208,10 @@
loading: sponsoredProductLoading,
error: sponsoredProductsError,
} = useQuery(sponsoredProductsQuery, {
variables,
variables: {
...variables,
anonymousId: getCookie('biggy-anonymous'),
},
skip: shouldSkipSponsoredProducts(sponsoredProductsBehavior, settings),
})

Expand Down
Loading