Class: KlevuEvents
/ Exports / KlevuEvents
• new KlevuEvents()
▸ Static buy(items): void
Tell Klevu what products where bought by the user
Name | Type | Description |
---|---|---|
items | Object | Items user bought |
items.items | { amount: number ; orderId?: string ; orderLineId?: string ; override?: Partial<{ currency: string ; item_group_id: string ; item_id: string ; item_name: string ; item_variant_id: string ; order_id?: string ; order_line_id?: string ; unit_price: number ; units?: number }> ; product: Pick<KlevuRecord, "id"> & Partial<Pick<KlevuRecord, "name" | "currency" | "itemGroupId" | "salePrice">> ; variantId?: string }[] | - |
items.user? | Object | - |
items.user.email? | string | - |
items.user.ip_address? | string | - |
void
▸ Static categoryMerchandisingProductClick(«destructured»): void
Name | Type |
---|---|
«destructured» | Object |
› abTestId? | string |
› abTestVariantId? | string |
› activeFilters? | string |
› categoryTitle | string |
› klevuCategory | string |
› override? | Partial<KlevuV1CategoryProductsClick> |
› product | Pick<KlevuRecord, "id"> & Partial<Pick<KlevuRecord, "name" | "itemGroupId" | "salePrice" | "sku" | "url">> |
› productPosition? | number |
› variantId? | string |
void
▸ Static categoryMerchandisingView(«destructured»): void
Name | Type |
---|---|
«destructured» | Object |
› abTestId? | string |
› abTestVariantId? | string |
› activeFilters? | string |
› categoryTitle | string |
› klevuCategory | string |
› override? | Partial<KlevuV1CategoryProductsView> |
› pageStartsFrom? | number |
› products | Pick<KlevuRecord, "id">[] |
void
▸ Static imageBannerClick(«destructured»): void
When user clicks on the banner that is in quicksearch or on search landing page
Name | Type | Description |
---|---|---|
«destructured» | Object | - |
› bannerId | string | Id of the banner |
› bannerName | string | Name of the banner |
› imageUrl | string | Url of the image |
› override | Partial<KlevuV1ImageBannerClick> | - |
› targetUrl | string | Url where the user is redirected |
› term | string | Search term used to get the results |
void
▸ Static recommendationClick(«destructured»): void
When product has been clicked in the recommendation banner
Name | Type | Description |
---|---|---|
«destructured» | Object | - |
› bannerInfo? | KlevuEventV2DataStaticContent | - |
› override? | Partial<KlevuRecommendationsEventV2Data> | - |
› product? | Pick<KlevuRecord, "id"> & Partial<Pick<KlevuRecord, "name" | "brand" | "category" | "currency" | "itemGroupId" | "salePrice">> | - |
› productIndexInList? | number | - |
› recommendationMetadata | Object | - |
› recommendationMetadata.action? | null | "STATIC_CONTENT" | "HIDE_RECOMMENDATION" | "FILTER" | Special cases of recommendation |
› recommendationMetadata.enabled | boolean | - |
› recommendationMetadata.logic | Logic used in recommendation | |
› recommendationMetadata.maxProducts | number | Amount of products to fetch |
› recommendationMetadata.pageType | KMCRecommendationPagetype | Target page type of recommendation |
› recommendationMetadata.productThreshold | number | - |
› recommendationMetadata.recsKey | string | ID of the recommendation |
› recommendationMetadata.segmentKey | null | string | User segment key |
› recommendationMetadata.segmentName | null | string | User segment name |
› recommendationMetadata.spotKey | string | ID of the spot |
› recommendationMetadata.spotName | string | Spot name |
› recommendationMetadata.title | string | Title of the recommendation |
› variantId? | string | - |
void
▸ Static recommendationView(«destructured»): void
When recommendation banner is shown in the page
Name | Type |
---|---|
«destructured» | Object |
› override? | Partial<KlevuRecommendationsEventV2Data> |
› products? | Pick<KlevuRecord, "id"> & Partial<Pick<KlevuRecord, "name" | "brand" | "category" | "currency" | "itemGroupId" | "price" | "variantId">>[] |
› recommendationMetadata | Partial<{ action?: null | "STATIC_CONTENT" | "HIDE_RECOMMENDATION" | "FILTER" ; enabled: boolean ; logic: KMCRecommendationLogic ; maxProducts: number ; pageType: KMCRecommendationPagetype ; productThreshold: number ; recsKey: string ; segmentKey: null | string ; segmentName: null | string ; spotKey: string ; spotName: string ; title: string }> & Pick<{ action?: null | "STATIC_CONTENT" | "HIDE_RECOMMENDATION" | "FILTER" ; enabled: boolean ; logic: KMCRecommendationLogic ; maxProducts: number ; pageType: KMCRecommendationPagetype ; productThreshold: number ; recsKey: string ; segmentKey: null | string ; segmentName: null | string ; spotKey: string ; spotName: string ; title: string }, "logic" | "recsKey" | "title"> |
void
▸ Static search(«destructured»): void
What user has last searched. This is important for Klevu to function properly. Use sendSearchEvent() modifier with search query to send results
Name | Type |
---|---|
«destructured» | Object |
› activeFilters? | string |
› override? | Partial<V1SearchEvent> |
› term | string |
› totalResults | number |
› typeOfSearch |
void
▸ Static searchProductClick(«destructured»): void
When product is clicked. Do not use this for recommendations
Name | Type |
---|---|
«destructured» | Object |
› activeFilters? | string |
› override? | Partial<V1ProductTrackingEvent> |
› product | Pick<KlevuRecord, "id"> & Partial<Pick<KlevuRecord, "name" | "itemGroupId" | "url">> |
› searchTerm? | string |
› variantId? | string |
void