Skip to content

Commit

Permalink
[Enterprise Search][Behavioral Analytics] Update trackSearch and trac…
Browse files Browse the repository at this point in the history
…kSearchClick params (#156735)

Update the filters, results.items, page example  for:
-  ✔️ trackSearch
- ✔️  trackSearchClick

<img width="853" alt="image"
src="https://user-images.githubusercontent.com/17390745/236317257-0eb0c272-c013-4287-8cf2-c77adf425422.png">

<img width="853" alt="image"
src="https://user-images.githubusercontent.com/17390745/236316701-ffa06772-e69a-4273-98bf-13c18e1a378e.png">
  • Loading branch information
yansavitski committed May 5, 2023
1 parent 9b6cbfa commit 0e259c8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,26 @@ const SearchResult = ({ hit }) => {
const clickHandler = () => {
trackSearchClick({
document: { id: hit.id, index: "products" },
page: {
url: "http://my-website.com/products/123"
},
search: {
query: "search term",
filters: [],
filters: {},
page: { current: 1, size: 10 },
results: {
results: {
items: [
{ id: "123", index: "products" }
{
document: {
id: "123",
index: "products",
},
page: {
url: "http://my-website.com/products/123",
},
},
],
total_results: 10
total_results: 10
},
sort: {
name: "relevance",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,10 +115,10 @@ window.elasticAnalytics.createTracker({
{`window.elasticAnalytics.trackSearch({
search: {
query: "laptop",
filters: [
{ field: "brand", value: ["apple"] },
{ field: "price", value: ["1000-2000"] },
],
filters: {
brand: ["apple"],
price: ["1000-2000"],
},
page: {
current: 1,
size: 10,
Expand Down

0 comments on commit 0e259c8

Please sign in to comment.