[Enterprise Search][Behavioral Analytics] Update trackSearch and trackSearchClick 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">
This commit is contained in:
Yan Savitski 2023-05-05 11:52:21 +02:00 committed by GitHub
parent 9b6cbfa0bb
commit 0e259c8598
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 8 deletions

View file

@ -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",

View file

@ -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,