@getlupa/client 0.10.1 → 0.10.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/search-box/SearchBox.vue.d.ts +6 -1
- package/dist/cjs/components/search-box/products/SearchBoxProduct.vue.d.ts +1 -0
- package/dist/cjs/components/search-results/SearchResults.vue.d.ts +2 -0
- package/dist/cjs/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +1 -0
- package/dist/cjs/constants/development/searchResultsDev.example.const.d.ts +1 -0
- package/dist/cjs/index.min.js +112 -34
- package/dist/cjs/store/modules/tracking.d.ts +3 -1
- package/dist/cjs/types/AnalyticsOptions.d.ts +3 -2
- package/dist/cjs/types/search-box/Common.d.ts +1 -0
- package/dist/cjs/types/search-results/SearchResultsProductCardOptions.d.ts +1 -0
- package/dist/es/components/search-box/SearchBox.vue.d.ts +6 -1
- package/dist/es/components/search-box/products/SearchBoxProduct.vue.d.ts +1 -0
- package/dist/es/components/search-results/SearchResults.vue.d.ts +2 -0
- package/dist/es/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +1 -0
- package/dist/es/constants/development/searchResultsDev.example.const.d.ts +1 -0
- package/dist/es/index.min.js +112 -34
- package/dist/es/store/modules/tracking.d.ts +3 -1
- package/dist/es/types/AnalyticsOptions.d.ts +3 -2
- package/dist/es/types/search-box/Common.d.ts +1 -0
- package/dist/es/types/search-results/SearchResultsProductCardOptions.d.ts +1 -0
- package/dist/iife/components/search-box/SearchBox.vue.d.ts +6 -1
- package/dist/iife/components/search-box/products/SearchBoxProduct.vue.d.ts +1 -0
- package/dist/iife/components/search-results/SearchResults.vue.d.ts +2 -0
- package/dist/iife/components/search-results/products/product-card/SearchResultsProductCard.vue.d.ts +1 -0
- package/dist/iife/constants/development/searchResultsDev.example.const.d.ts +1 -0
- package/dist/iife/index.min.js +1 -1
- package/dist/iife/store/modules/tracking.d.ts +3 -1
- package/dist/iife/types/AnalyticsOptions.d.ts +3 -2
- package/dist/iife/types/search-box/Common.d.ts +1 -0
- package/dist/iife/types/search-results/SearchResultsProductCardOptions.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchedData, HighlightedDocInfo, InputSuggestion, InputSuggestionFacet, SelectedData, TrackableEventData } from "@/types/search-box/Common";
|
|
2
2
|
import { SearchBoxInputOptions, SearchBoxOptions, SearchBoxPanelOptions } from "@/types/search-box/SearchBoxOptions";
|
|
3
3
|
import { QueryParams } from "@/types/search-results/QueryParams";
|
|
4
|
-
import { Document } from "@getlupa/client-sdk/Types";
|
|
4
|
+
import { Document, PublicQuery } from "@getlupa/client-sdk/Types";
|
|
5
5
|
import Vue from "vue";
|
|
6
6
|
declare const params: import("vuex-class/lib/bindings").BindingHelpers;
|
|
7
7
|
export default class SearchBox extends Vue {
|
|
@@ -28,6 +28,10 @@ export default class SearchBox extends Vue {
|
|
|
28
28
|
queryKey: string;
|
|
29
29
|
data: TrackableEventData;
|
|
30
30
|
}) => void;
|
|
31
|
+
trackSearch: ({ queryKey, query, }: {
|
|
32
|
+
queryKey: string;
|
|
33
|
+
query: PublicQuery;
|
|
34
|
+
}) => void;
|
|
31
35
|
setSearchResultsLink: (searchResultsLink: string) => {
|
|
32
36
|
searchResultsLink: string;
|
|
33
37
|
};
|
|
@@ -63,6 +67,7 @@ export default class SearchBox extends Vue {
|
|
|
63
67
|
query: string;
|
|
64
68
|
}): void;
|
|
65
69
|
trackDocumentClick(doc: HighlightedDocInfo): void;
|
|
70
|
+
trackSearchQuery(query?: string): void;
|
|
66
71
|
trackSuggestionClick(suggestion?: string): void;
|
|
67
72
|
resetValues(): void;
|
|
68
73
|
handleProductClick(): void;
|
|
@@ -2,6 +2,7 @@ import { QueryParams } from "@/types/search-results/QueryParams";
|
|
|
2
2
|
import { ProductGrid, SearchResultsDidYouMeanLabels, SearchResultsOptions, SearchResultsProductOptions } from "@/types/search-results/SearchResultsOptions";
|
|
3
3
|
import { FilterGroup, PublicQuery, SearchQueryResult } from "@getlupa/client-sdk/Types";
|
|
4
4
|
import Vue from "vue";
|
|
5
|
+
import { AnalyticsEventType } from "@/types/AnalyticsOptions";
|
|
5
6
|
export default class SearchResults extends Vue {
|
|
6
7
|
options: SearchResultsOptions;
|
|
7
8
|
initialFilters: FilterGroup;
|
|
@@ -16,6 +17,7 @@ export default class SearchResults extends Vue {
|
|
|
16
17
|
trackSearch: ({ queryKey, query, }: {
|
|
17
18
|
queryKey: string;
|
|
18
19
|
query: PublicQuery;
|
|
20
|
+
type?: AnalyticsEventType;
|
|
19
21
|
}) => void;
|
|
20
22
|
trackResults: ({ queryKey, results, }: {
|
|
21
23
|
queryKey: string;
|
package/dist/cjs/index.min.js
CHANGED
|
@@ -12214,7 +12214,7 @@ const getRelativePath = (link) => {
|
|
|
12214
12214
|
}
|
|
12215
12215
|
catch (_a) {
|
|
12216
12216
|
// Invalid url, let's return original string
|
|
12217
|
-
return link;
|
|
12217
|
+
return (link === null || link === void 0 ? void 0 : link.endsWith("/")) ? link.slice(0, link.length - 1) : link;
|
|
12218
12218
|
}
|
|
12219
12219
|
};
|
|
12220
12220
|
// Checks if url links match absolutely, or if their relative parts are equal
|
|
@@ -12272,7 +12272,18 @@ let SearchBoxProduct = class SearchBoxProduct extends Vue$1 {
|
|
|
12272
12272
|
}
|
|
12273
12273
|
return "";
|
|
12274
12274
|
}
|
|
12275
|
+
get title() {
|
|
12276
|
+
if (!this.panelOptions.titleKey) {
|
|
12277
|
+
return "";
|
|
12278
|
+
}
|
|
12279
|
+
const title = this.item[this.panelOptions.titleKey] || "";
|
|
12280
|
+
this.addHistory({
|
|
12281
|
+
item: title,
|
|
12282
|
+
});
|
|
12283
|
+
return title;
|
|
12284
|
+
}
|
|
12275
12285
|
handleClick(event) {
|
|
12286
|
+
var _a;
|
|
12276
12287
|
if (this.panelOptions.titleKey) {
|
|
12277
12288
|
this.addHistory({
|
|
12278
12289
|
item: this.item[this.panelOptions.titleKey] || "",
|
|
@@ -12289,7 +12300,7 @@ let SearchBoxProduct = class SearchBoxProduct extends Vue$1 {
|
|
|
12289
12300
|
type: "itemClick",
|
|
12290
12301
|
analytics: {
|
|
12291
12302
|
type: "autocomplete_product_click",
|
|
12292
|
-
label: this.link,
|
|
12303
|
+
label: (_a = this.title) !== null && _a !== void 0 ? _a : this.link,
|
|
12293
12304
|
},
|
|
12294
12305
|
},
|
|
12295
12306
|
});
|
|
@@ -13332,8 +13343,9 @@ let SearchBoxMainPanel = class SearchBoxMainPanel extends Vue$1 {
|
|
|
13332
13343
|
this.sdkOptions = this.options.options;
|
|
13333
13344
|
}
|
|
13334
13345
|
get displayResults() {
|
|
13335
|
-
var _a;
|
|
13336
|
-
return ((_a = this.inputValue) === null || _a === void 0 ? void 0 : _a.length)
|
|
13346
|
+
var _a, _b;
|
|
13347
|
+
return (((_a = this.inputValue) === null || _a === void 0 ? void 0 : _a.length) > 0 &&
|
|
13348
|
+
((_b = this.inputValue) === null || _b === void 0 ? void 0 : _b.length) >= this.options.minInputLength);
|
|
13337
13349
|
}
|
|
13338
13350
|
get displayHistory() {
|
|
13339
13351
|
var _a;
|
|
@@ -13532,7 +13544,7 @@ __vue_render__$V._withStripped = true;
|
|
|
13532
13544
|
/* style */
|
|
13533
13545
|
const __vue_inject_styles__$V = function (inject) {
|
|
13534
13546
|
if (!inject) return
|
|
13535
|
-
inject("data-v-
|
|
13547
|
+
inject("data-v-947d134e_0", { source: "#lupa-search-box-panel {\n display: flex;\n justify-content: space-between;\n flex-direction: column;\n}\n.lupa-more-results {\n text-align: center;\n}", map: undefined, media: undefined });
|
|
13536
13548
|
|
|
13537
13549
|
};
|
|
13538
13550
|
/* scoped */
|
|
@@ -30869,6 +30881,7 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
30869
30881
|
this.opened = true;
|
|
30870
30882
|
this.inputValue = value;
|
|
30871
30883
|
this.suggestedValue = defaultSuggestedValue;
|
|
30884
|
+
this.trackSearchQuery(value);
|
|
30872
30885
|
if (this.isSearchContainer) {
|
|
30873
30886
|
this.goToResultsDebounced({
|
|
30874
30887
|
searchText: this.searchValue,
|
|
@@ -30961,11 +30974,22 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
30961
30974
|
type: "itemClick",
|
|
30962
30975
|
analytics: {
|
|
30963
30976
|
type: "autocomplete_product_click",
|
|
30964
|
-
label: doc.
|
|
30977
|
+
label: doc.title || doc.id,
|
|
30965
30978
|
},
|
|
30966
30979
|
},
|
|
30967
30980
|
});
|
|
30968
30981
|
}
|
|
30982
|
+
trackSearchQuery(query) {
|
|
30983
|
+
if (!query) {
|
|
30984
|
+
return;
|
|
30985
|
+
}
|
|
30986
|
+
this.trackSearch({
|
|
30987
|
+
queryKey: this.suggestedValue.queryKey,
|
|
30988
|
+
query: {
|
|
30989
|
+
searchText: query,
|
|
30990
|
+
},
|
|
30991
|
+
});
|
|
30992
|
+
}
|
|
30969
30993
|
trackSuggestionClick(suggestion) {
|
|
30970
30994
|
var _a;
|
|
30971
30995
|
if (suggestion ||
|
|
@@ -30980,7 +31004,7 @@ let SearchBox = class SearchBox extends Vue$1 {
|
|
|
30980
31004
|
searchQuery: this.inputValue,
|
|
30981
31005
|
type: "suggestionClick",
|
|
30982
31006
|
analytics: {
|
|
30983
|
-
type: "
|
|
31007
|
+
type: "autocomplete_suggestion_click",
|
|
30984
31008
|
label: suggestion || this.searchValue,
|
|
30985
31009
|
},
|
|
30986
31010
|
},
|
|
@@ -31012,6 +31036,9 @@ __decorate([
|
|
|
31012
31036
|
__decorate([
|
|
31013
31037
|
tracking$4.Action("track")
|
|
31014
31038
|
], SearchBox.prototype, "trackClick", void 0);
|
|
31039
|
+
__decorate([
|
|
31040
|
+
tracking$4.Action("trackSearch")
|
|
31041
|
+
], SearchBox.prototype, "trackSearch", void 0);
|
|
31015
31042
|
__decorate([
|
|
31016
31043
|
params$e.Action("setSearchResultsLink")
|
|
31017
31044
|
], SearchBox.prototype, "setSearchResultsLink", void 0);
|
|
@@ -31085,7 +31112,7 @@ __vue_render__$U._withStripped = true;
|
|
|
31085
31112
|
/* style */
|
|
31086
31113
|
const __vue_inject_styles__$U = function (inject) {
|
|
31087
31114
|
if (!inject) return
|
|
31088
|
-
inject("data-v-
|
|
31115
|
+
inject("data-v-d81b3ccc_0", { source: "\n#lupa-search-box {\n width: 100%;\n}\n.lupa-search-box-wrapper {\n position: relative;\n}\n", map: undefined, media: undefined });
|
|
31089
31116
|
|
|
31090
31117
|
};
|
|
31091
31118
|
/* scoped */
|
|
@@ -35367,10 +35394,14 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35367
35394
|
});
|
|
35368
35395
|
}
|
|
35369
35396
|
get id() {
|
|
35370
|
-
|
|
35371
|
-
|
|
35372
|
-
|
|
35373
|
-
|
|
35397
|
+
return this.options.idKey
|
|
35398
|
+
? this.product[this.options.idKey]
|
|
35399
|
+
: "";
|
|
35400
|
+
}
|
|
35401
|
+
get title() {
|
|
35402
|
+
return this.options.titleKey
|
|
35403
|
+
? this.product[this.options.titleKey]
|
|
35404
|
+
: "";
|
|
35374
35405
|
}
|
|
35375
35406
|
handleClick() {
|
|
35376
35407
|
var _a, _b;
|
|
@@ -35380,6 +35411,10 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35380
35411
|
itemId: this.id,
|
|
35381
35412
|
searchQuery: this.query,
|
|
35382
35413
|
type: "itemClick",
|
|
35414
|
+
analytics: {
|
|
35415
|
+
type: "search_product_click",
|
|
35416
|
+
label: this.title || this.id || this.link,
|
|
35417
|
+
},
|
|
35383
35418
|
},
|
|
35384
35419
|
});
|
|
35385
35420
|
(_b = (_a = this.searchResultOptions.callbacks) === null || _a === void 0 ? void 0 : _a.onProductClick) === null || _b === void 0 ? void 0 : _b.call(_a, {
|
|
@@ -35396,8 +35431,8 @@ let SearchResultsProductCard = class SearchResultsProductCard extends Vue$1 {
|
|
|
35396
35431
|
type: item.type,
|
|
35397
35432
|
analytics: item.type === "addToCart"
|
|
35398
35433
|
? {
|
|
35399
|
-
type: "
|
|
35400
|
-
label: this.link,
|
|
35434
|
+
type: "search_add_to_cart",
|
|
35435
|
+
label: this.title || this.id || this.link,
|
|
35401
35436
|
}
|
|
35402
35437
|
: undefined,
|
|
35403
35438
|
},
|
|
@@ -35567,7 +35602,7 @@ __vue_render__$o._withStripped = true;
|
|
|
35567
35602
|
|
|
35568
35603
|
const initAnalyticsTracking = (analyticsOptions) => {
|
|
35569
35604
|
try {
|
|
35570
|
-
if (
|
|
35605
|
+
if (analyticsOptions === null || analyticsOptions === void 0 ? void 0 : analyticsOptions.enabled) {
|
|
35571
35606
|
window.sessionStorage.setItem(TRACKING_ANALYTICS_KEY, JSON.stringify(analyticsOptions));
|
|
35572
35607
|
}
|
|
35573
35608
|
else {
|
|
@@ -35712,25 +35747,66 @@ const sendGa = (name, ...args) => {
|
|
|
35712
35747
|
});
|
|
35713
35748
|
};
|
|
35714
35749
|
const trackAnalyticsEvent = (data) => {
|
|
35715
|
-
var _a;
|
|
35750
|
+
var _a, _b, _c;
|
|
35716
35751
|
try {
|
|
35717
35752
|
const options = JSON.parse((_a = window.sessionStorage.getItem(TRACKING_ANALYTICS_KEY)) !== null && _a !== void 0 ? _a : "{}");
|
|
35718
|
-
if (!data.analytics ||
|
|
35753
|
+
if (!data.analytics ||
|
|
35754
|
+
!options.enabled ||
|
|
35755
|
+
((_b = options.ignoreEvents) === null || _b === void 0 ? void 0 : _b.includes((_c = data.analytics) === null || _c === void 0 ? void 0 : _c.type))) {
|
|
35719
35756
|
return;
|
|
35720
35757
|
}
|
|
35721
|
-
|
|
35722
|
-
|
|
35723
|
-
|
|
35724
|
-
|
|
35758
|
+
switch (options.type) {
|
|
35759
|
+
case "ua":
|
|
35760
|
+
sendUaAnalyticsEvent(data, options);
|
|
35761
|
+
break;
|
|
35762
|
+
case "ga4":
|
|
35763
|
+
sendGa4AnalyticsEvent(data, options);
|
|
35764
|
+
break;
|
|
35765
|
+
case "debug":
|
|
35766
|
+
processDebugEvent(data);
|
|
35767
|
+
break;
|
|
35768
|
+
default:
|
|
35769
|
+
sendUaAnalyticsEvent(data, options);
|
|
35725
35770
|
}
|
|
35726
|
-
sendGa("send", "event", options.parentEventName, data.analytics.type, data.analytics.label);
|
|
35727
35771
|
}
|
|
35728
|
-
catch (
|
|
35772
|
+
catch (_d) {
|
|
35729
35773
|
console.error("Unable to send an event to google analytics");
|
|
35730
35774
|
}
|
|
35731
35775
|
};
|
|
35776
|
+
const sendUaAnalyticsEvent = (data, options) => {
|
|
35777
|
+
var _a, _b, _c, _d;
|
|
35778
|
+
const ga = window.ga;
|
|
35779
|
+
if (!ga) {
|
|
35780
|
+
console.error("Google Analytics object not found");
|
|
35781
|
+
return;
|
|
35782
|
+
}
|
|
35783
|
+
sendGa("send", "event", options.parentEventName, (_b = (_a = data.analytics) === null || _a === void 0 ? void 0 : _a.type) !== null && _b !== void 0 ? _b : "", (_d = (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.label) !== null && _d !== void 0 ? _d : "");
|
|
35784
|
+
};
|
|
35785
|
+
const sendGa4AnalyticsEvent = (data, options) => {
|
|
35786
|
+
var _a, _b, _c, _d;
|
|
35787
|
+
if (!window || !window.dataLayer) {
|
|
35788
|
+
console.error("dataLayer object not found.");
|
|
35789
|
+
return;
|
|
35790
|
+
}
|
|
35791
|
+
const sendItemTitle = data.searchQuery !== ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.label);
|
|
35792
|
+
const params = {
|
|
35793
|
+
search_text: data.searchQuery,
|
|
35794
|
+
item_title: sendItemTitle ? (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.label : undefined,
|
|
35795
|
+
};
|
|
35796
|
+
window.dataLayer.push(Object.assign({ event: (_d = (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.type) !== null && _d !== void 0 ? _d : options.parentEventName }, params));
|
|
35797
|
+
};
|
|
35798
|
+
const processDebugEvent = (data) => {
|
|
35799
|
+
var _a, _b, _c;
|
|
35800
|
+
const sendItemTitle = data.searchQuery !== ((_a = data.analytics) === null || _a === void 0 ? void 0 : _a.label);
|
|
35801
|
+
const params = {
|
|
35802
|
+
event: (_b = data.analytics) === null || _b === void 0 ? void 0 : _b.type,
|
|
35803
|
+
search_text: data.searchQuery,
|
|
35804
|
+
item_title: sendItemTitle ? (_c = data.analytics) === null || _c === void 0 ? void 0 : _c.label : undefined,
|
|
35805
|
+
};
|
|
35806
|
+
console.debug("Analytics debug event:", params);
|
|
35807
|
+
};
|
|
35732
35808
|
const track = (queryKey, data = {}, options) => {
|
|
35733
|
-
if (!isTrackingEnabled()) {
|
|
35809
|
+
if (!isTrackingEnabled() || !data.searchQuery) {
|
|
35734
35810
|
return;
|
|
35735
35811
|
}
|
|
35736
35812
|
trackLupaEvent(queryKey, data, options);
|
|
@@ -37397,6 +37473,7 @@ let SearchResultsProducts = class SearchResultsProducts extends Vue$1 {
|
|
|
37397
37473
|
"labels",
|
|
37398
37474
|
"queryKey",
|
|
37399
37475
|
"idKey",
|
|
37476
|
+
"titleKey",
|
|
37400
37477
|
"routingBehavior",
|
|
37401
37478
|
]);
|
|
37402
37479
|
}
|
|
@@ -38083,7 +38160,11 @@ let SearchResults = class SearchResults extends Vue$1 {
|
|
|
38083
38160
|
this.query(getPublicQuery(publicQuery, this.initialFilters, this.isProductList));
|
|
38084
38161
|
}
|
|
38085
38162
|
query(publicQuery) {
|
|
38086
|
-
this.trackSearch({
|
|
38163
|
+
this.trackSearch({
|
|
38164
|
+
queryKey: this.options.queryKey,
|
|
38165
|
+
query: publicQuery,
|
|
38166
|
+
type: "search_form_submit",
|
|
38167
|
+
});
|
|
38087
38168
|
const context = getLupaTrackingContext();
|
|
38088
38169
|
const limit = publicQuery.limit || this.defaultSearchResultPageSize;
|
|
38089
38170
|
const query = Object.assign(Object.assign(Object.assign({}, publicQuery), context), { limit });
|
|
@@ -39349,6 +39430,7 @@ let SearchBoxModule = class SearchBoxModule extends VuexModule {
|
|
|
39349
39430
|
link: generateLink((_b = panel.links) === null || _b === void 0 ? void 0 : _b.details, doc),
|
|
39350
39431
|
queryKey: panel.queryKey,
|
|
39351
39432
|
id: panel.idKey ? doc[panel.idKey] : "",
|
|
39433
|
+
title: panel.titleKey ? doc[panel.titleKey] : "",
|
|
39352
39434
|
};
|
|
39353
39435
|
}
|
|
39354
39436
|
saveSuggestions({ queryKey, suggestions, inputValue, }) {
|
|
@@ -39825,11 +39907,6 @@ let ParamsModule = class ParamsModule extends VuexModule {
|
|
|
39825
39907
|
const routing = (_a = this.context.rootGetters["options/boxRoutingBehavior"]) !== null && _a !== void 0 ? _a : "direct-link";
|
|
39826
39908
|
redirectToResultsPage(this.searchResultsLink, searchText, facet, routing);
|
|
39827
39909
|
}
|
|
39828
|
-
this.context.dispatch("tracking/track", {
|
|
39829
|
-
data: {
|
|
39830
|
-
analytics: { type: "search_form_submit", label: searchText },
|
|
39831
|
-
},
|
|
39832
|
-
}, { root: true });
|
|
39833
39910
|
}
|
|
39834
39911
|
appendParams({ params, paramsToRemove, encode = true, save = true, searchResultsLink, }) {
|
|
39835
39912
|
if (!(params === null || params === void 0 ? void 0 : params.length)) {
|
|
@@ -39980,22 +40057,23 @@ const getSearchTrackingData = (searchText, type) => {
|
|
|
39980
40057
|
};
|
|
39981
40058
|
};
|
|
39982
40059
|
let TrackingModule = class TrackingModule extends VuexModule {
|
|
39983
|
-
trackSearch({ queryKey, query, }) {
|
|
40060
|
+
trackSearch({ queryKey, query, type = "search_query", }) {
|
|
39984
40061
|
var _a, _b;
|
|
39985
40062
|
const options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
39986
40063
|
const hasFilters = Object.keys((_b = query.filters) !== null && _b !== void 0 ? _b : {}).length > 0;
|
|
39987
40064
|
if (hasFilters) {
|
|
39988
|
-
const data = getSearchTrackingData(query.searchText, "
|
|
40065
|
+
const data = getSearchTrackingData(query.searchText, "search_filters");
|
|
39989
40066
|
track(queryKey, data, options);
|
|
40067
|
+
return;
|
|
39990
40068
|
}
|
|
39991
|
-
const data = getSearchTrackingData(query.searchText,
|
|
40069
|
+
const data = getSearchTrackingData(query.searchText, type);
|
|
39992
40070
|
track(queryKey, data, options);
|
|
39993
40071
|
}
|
|
39994
40072
|
trackResults({ queryKey, results, }) {
|
|
39995
40073
|
var _a;
|
|
39996
40074
|
const options = (_a = this.context.rootGetters["options/envOptions"]) !== null && _a !== void 0 ? _a : {};
|
|
39997
40075
|
if (results.total < 1) {
|
|
39998
|
-
const data = getSearchTrackingData(results.searchText, "
|
|
40076
|
+
const data = getSearchTrackingData(results.searchText, "search_zero_results");
|
|
39999
40077
|
track(queryKey, data, options);
|
|
40000
40078
|
}
|
|
40001
40079
|
}
|
|
@@ -1,10 +1,12 @@
|
|
|
1
|
+
import { AnalyticsEventType } from "@/types/AnalyticsOptions";
|
|
1
2
|
import { TrackableEventData } from "@/types/search-box/Common";
|
|
2
3
|
import { PublicQuery, SearchQueryResult } from "@getlupa/client-sdk/Types";
|
|
3
4
|
import { VuexModule } from "vuex-module-decorators";
|
|
4
5
|
export default class TrackingModule extends VuexModule {
|
|
5
|
-
trackSearch({ queryKey, query, }: {
|
|
6
|
+
trackSearch({ queryKey, query, type, }: {
|
|
6
7
|
queryKey: string;
|
|
7
8
|
query: PublicQuery;
|
|
9
|
+
type?: AnalyticsEventType;
|
|
8
10
|
}): void;
|
|
9
11
|
trackResults({ queryKey, results, }: {
|
|
10
12
|
queryKey: string;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export declare const PARENT_EVENT_NAME = "GetLupa";
|
|
2
|
-
export declare type AnalyticsEventType = "
|
|
2
|
+
export declare type AnalyticsEventType = "search_query" | "search_form_submit" | "autocomplete_suggestion_click" | "autocomplete_product_click" | "search_product_click" | "search_zero_results" | "search_filters" | "search_add_to_cart";
|
|
3
3
|
export declare type AnalyticsOptions = {
|
|
4
|
-
type: "ua";
|
|
4
|
+
type: "ua" | "ga4" | "debug";
|
|
5
5
|
enabled: boolean;
|
|
6
6
|
parentEventName: string;
|
|
7
|
+
ignoreEvents?: AnalyticsEventType[];
|
|
7
8
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchedData, HighlightedDocInfo, InputSuggestion, InputSuggestionFacet, SelectedData, TrackableEventData } from "@/types/search-box/Common";
|
|
2
2
|
import { SearchBoxInputOptions, SearchBoxOptions, SearchBoxPanelOptions } from "@/types/search-box/SearchBoxOptions";
|
|
3
3
|
import { QueryParams } from "@/types/search-results/QueryParams";
|
|
4
|
-
import { Document } from "@getlupa/client-sdk/Types";
|
|
4
|
+
import { Document, PublicQuery } from "@getlupa/client-sdk/Types";
|
|
5
5
|
import Vue from "vue";
|
|
6
6
|
declare const params: import("vuex-class/lib/bindings").BindingHelpers;
|
|
7
7
|
export default class SearchBox extends Vue {
|
|
@@ -28,6 +28,10 @@ export default class SearchBox extends Vue {
|
|
|
28
28
|
queryKey: string;
|
|
29
29
|
data: TrackableEventData;
|
|
30
30
|
}) => void;
|
|
31
|
+
trackSearch: ({ queryKey, query, }: {
|
|
32
|
+
queryKey: string;
|
|
33
|
+
query: PublicQuery;
|
|
34
|
+
}) => void;
|
|
31
35
|
setSearchResultsLink: (searchResultsLink: string) => {
|
|
32
36
|
searchResultsLink: string;
|
|
33
37
|
};
|
|
@@ -63,6 +67,7 @@ export default class SearchBox extends Vue {
|
|
|
63
67
|
query: string;
|
|
64
68
|
}): void;
|
|
65
69
|
trackDocumentClick(doc: HighlightedDocInfo): void;
|
|
70
|
+
trackSearchQuery(query?: string): void;
|
|
66
71
|
trackSuggestionClick(suggestion?: string): void;
|
|
67
72
|
resetValues(): void;
|
|
68
73
|
handleProductClick(): void;
|
|
@@ -2,6 +2,7 @@ import { QueryParams } from "@/types/search-results/QueryParams";
|
|
|
2
2
|
import { ProductGrid, SearchResultsDidYouMeanLabels, SearchResultsOptions, SearchResultsProductOptions } from "@/types/search-results/SearchResultsOptions";
|
|
3
3
|
import { FilterGroup, PublicQuery, SearchQueryResult } from "@getlupa/client-sdk/Types";
|
|
4
4
|
import Vue from "vue";
|
|
5
|
+
import { AnalyticsEventType } from "@/types/AnalyticsOptions";
|
|
5
6
|
export default class SearchResults extends Vue {
|
|
6
7
|
options: SearchResultsOptions;
|
|
7
8
|
initialFilters: FilterGroup;
|
|
@@ -16,6 +17,7 @@ export default class SearchResults extends Vue {
|
|
|
16
17
|
trackSearch: ({ queryKey, query, }: {
|
|
17
18
|
queryKey: string;
|
|
18
19
|
query: PublicQuery;
|
|
20
|
+
type?: AnalyticsEventType;
|
|
19
21
|
}) => void;
|
|
20
22
|
trackResults: ({ queryKey, results, }: {
|
|
21
23
|
queryKey: string;
|