@algolia/client-analytics 5.2.5 → 5.3.1
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/browser.d.ts +1152 -809
- package/dist/builds/browser.js +61 -47
- package/dist/builds/browser.js.map +1 -1
- package/dist/builds/browser.min.js +1 -1
- package/dist/builds/browser.min.js.map +1 -1
- package/dist/builds/browser.umd.js +1 -1
- package/dist/builds/node.cjs +61 -47
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +61 -47
- package/dist/builds/node.js.map +1 -1
- package/dist/node.d.cts +1153 -810
- package/dist/node.d.ts +1153 -810
- package/dist/src/analyticsClient.cjs +61 -47
- package/dist/src/analyticsClient.cjs.map +1 -1
- package/dist/src/analyticsClient.js +61 -47
- package/dist/src/analyticsClient.js.map +1 -1
- package/package.json +4 -4
|
@@ -26,7 +26,7 @@ __export(analyticsClient_exports, {
|
|
|
26
26
|
});
|
|
27
27
|
module.exports = __toCommonJS(analyticsClient_exports);
|
|
28
28
|
var import_client_common = require("@algolia/client-common");
|
|
29
|
-
var apiClientVersion = "5.
|
|
29
|
+
var apiClientVersion = "5.3.1";
|
|
30
30
|
var REGIONS = ["de", "us"];
|
|
31
31
|
function getDefaultHosts(region) {
|
|
32
32
|
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
|
|
@@ -41,26 +41,25 @@ function createAnalyticsClient({
|
|
|
41
41
|
...options
|
|
42
42
|
}) {
|
|
43
43
|
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
|
|
44
|
-
const transporter = (0, import_client_common.createTransporter)({
|
|
45
|
-
hosts: getDefaultHosts(regionOption),
|
|
46
|
-
...options,
|
|
47
|
-
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
|
|
48
|
-
algoliaAgents,
|
|
49
|
-
client: "Analytics",
|
|
50
|
-
version: apiClientVersion
|
|
51
|
-
}),
|
|
52
|
-
baseHeaders: {
|
|
53
|
-
"content-type": "text/plain",
|
|
54
|
-
...auth.headers(),
|
|
55
|
-
...options.baseHeaders
|
|
56
|
-
},
|
|
57
|
-
baseQueryParameters: {
|
|
58
|
-
...auth.queryParameters(),
|
|
59
|
-
...options.baseQueryParameters
|
|
60
|
-
}
|
|
61
|
-
});
|
|
62
44
|
return {
|
|
63
|
-
transporter,
|
|
45
|
+
transporter: (0, import_client_common.createTransporter)({
|
|
46
|
+
hosts: getDefaultHosts(regionOption),
|
|
47
|
+
...options,
|
|
48
|
+
algoliaAgent: (0, import_client_common.getAlgoliaAgent)({
|
|
49
|
+
algoliaAgents,
|
|
50
|
+
client: "Analytics",
|
|
51
|
+
version: apiClientVersion
|
|
52
|
+
}),
|
|
53
|
+
baseHeaders: {
|
|
54
|
+
"content-type": "text/plain",
|
|
55
|
+
...auth.headers(),
|
|
56
|
+
...options.baseHeaders
|
|
57
|
+
},
|
|
58
|
+
baseQueryParameters: {
|
|
59
|
+
...auth.queryParameters(),
|
|
60
|
+
...options.baseQueryParameters
|
|
61
|
+
}
|
|
62
|
+
}),
|
|
64
63
|
/**
|
|
65
64
|
* The `appId` currently in use.
|
|
66
65
|
*/
|
|
@@ -69,13 +68,15 @@ function createAnalyticsClient({
|
|
|
69
68
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
70
69
|
*/
|
|
71
70
|
clearCache() {
|
|
72
|
-
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(
|
|
71
|
+
return Promise.all([this.transporter.requestsCache.clear(), this.transporter.responsesCache.clear()]).then(
|
|
72
|
+
() => void 0
|
|
73
|
+
);
|
|
73
74
|
},
|
|
74
75
|
/**
|
|
75
76
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
76
77
|
*/
|
|
77
78
|
get _ua() {
|
|
78
|
-
return transporter.algoliaAgent.value;
|
|
79
|
+
return this.transporter.algoliaAgent.value;
|
|
79
80
|
},
|
|
80
81
|
/**
|
|
81
82
|
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
@@ -84,7 +85,20 @@ function createAnalyticsClient({
|
|
|
84
85
|
* @param version - The version of the agent.
|
|
85
86
|
*/
|
|
86
87
|
addAlgoliaAgent(segment, version) {
|
|
87
|
-
transporter.algoliaAgent.add({ segment, version });
|
|
88
|
+
this.transporter.algoliaAgent.add({ segment, version });
|
|
89
|
+
},
|
|
90
|
+
/**
|
|
91
|
+
* Helper method to switch the API key used to authenticate the requests.
|
|
92
|
+
*
|
|
93
|
+
* @param params - Method params.
|
|
94
|
+
* @param params.apiKey - The new API Key to use.
|
|
95
|
+
*/
|
|
96
|
+
setClientApiKey({ apiKey }) {
|
|
97
|
+
if (!authMode || authMode === "WithinHeaders") {
|
|
98
|
+
this.transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
99
|
+
} else {
|
|
100
|
+
this.transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
|
|
101
|
+
}
|
|
88
102
|
},
|
|
89
103
|
/**
|
|
90
104
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -107,7 +121,7 @@ function createAnalyticsClient({
|
|
|
107
121
|
queryParameters,
|
|
108
122
|
headers
|
|
109
123
|
};
|
|
110
|
-
return transporter.request(request, requestOptions);
|
|
124
|
+
return this.transporter.request(request, requestOptions);
|
|
111
125
|
},
|
|
112
126
|
/**
|
|
113
127
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -130,7 +144,7 @@ function createAnalyticsClient({
|
|
|
130
144
|
queryParameters,
|
|
131
145
|
headers
|
|
132
146
|
};
|
|
133
|
-
return transporter.request(request, requestOptions);
|
|
147
|
+
return this.transporter.request(request, requestOptions);
|
|
134
148
|
},
|
|
135
149
|
/**
|
|
136
150
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -155,7 +169,7 @@ function createAnalyticsClient({
|
|
|
155
169
|
headers,
|
|
156
170
|
data: body ? body : {}
|
|
157
171
|
};
|
|
158
|
-
return transporter.request(request, requestOptions);
|
|
172
|
+
return this.transporter.request(request, requestOptions);
|
|
159
173
|
},
|
|
160
174
|
/**
|
|
161
175
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -180,7 +194,7 @@ function createAnalyticsClient({
|
|
|
180
194
|
headers,
|
|
181
195
|
data: body ? body : {}
|
|
182
196
|
};
|
|
183
|
-
return transporter.request(request, requestOptions);
|
|
197
|
+
return this.transporter.request(request, requestOptions);
|
|
184
198
|
},
|
|
185
199
|
/**
|
|
186
200
|
* Retrieves the add-to-cart rate for all of your searches with at least one add-to-cart event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -220,7 +234,7 @@ function createAnalyticsClient({
|
|
|
220
234
|
queryParameters,
|
|
221
235
|
headers
|
|
222
236
|
};
|
|
223
|
-
return transporter.request(request, requestOptions);
|
|
237
|
+
return this.transporter.request(request, requestOptions);
|
|
224
238
|
},
|
|
225
239
|
/**
|
|
226
240
|
* Retrieves the average click position of your search results, including a daily breakdown. The average click position is the average of all clicked search results\' positions. For example, if users only ever click on the first result for any search, the average click position is 1. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -260,7 +274,7 @@ function createAnalyticsClient({
|
|
|
260
274
|
queryParameters,
|
|
261
275
|
headers
|
|
262
276
|
};
|
|
263
|
-
return transporter.request(request, requestOptions);
|
|
277
|
+
return this.transporter.request(request, requestOptions);
|
|
264
278
|
},
|
|
265
279
|
/**
|
|
266
280
|
* Retrieves the positions in the search results and their associated number of clicks. This lets you check how many clicks the first, second, or tenth search results receive.
|
|
@@ -300,7 +314,7 @@ function createAnalyticsClient({
|
|
|
300
314
|
queryParameters,
|
|
301
315
|
headers
|
|
302
316
|
};
|
|
303
|
-
return transporter.request(request, requestOptions);
|
|
317
|
+
return this.transporter.request(request, requestOptions);
|
|
304
318
|
},
|
|
305
319
|
/**
|
|
306
320
|
* Retrieves the click-through rate for all of your searches with at least one click event, including a daily breakdown By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -340,7 +354,7 @@ function createAnalyticsClient({
|
|
|
340
354
|
queryParameters,
|
|
341
355
|
headers
|
|
342
356
|
};
|
|
343
|
-
return transporter.request(request, requestOptions);
|
|
357
|
+
return this.transporter.request(request, requestOptions);
|
|
344
358
|
},
|
|
345
359
|
/**
|
|
346
360
|
* Retrieves the conversion rate for all of your searches with at least one conversion event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -380,7 +394,7 @@ function createAnalyticsClient({
|
|
|
380
394
|
queryParameters,
|
|
381
395
|
headers
|
|
382
396
|
};
|
|
383
|
-
return transporter.request(request, requestOptions);
|
|
397
|
+
return this.transporter.request(request, requestOptions);
|
|
384
398
|
},
|
|
385
399
|
/**
|
|
386
400
|
* Retrieves the fraction of searches that didn\'t lead to any click within a time range, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -420,7 +434,7 @@ function createAnalyticsClient({
|
|
|
420
434
|
queryParameters,
|
|
421
435
|
headers
|
|
422
436
|
};
|
|
423
|
-
return transporter.request(request, requestOptions);
|
|
437
|
+
return this.transporter.request(request, requestOptions);
|
|
424
438
|
},
|
|
425
439
|
/**
|
|
426
440
|
* Retrieves the fraction of searches that didn\'t return any results within a time range, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -460,7 +474,7 @@ function createAnalyticsClient({
|
|
|
460
474
|
queryParameters,
|
|
461
475
|
headers
|
|
462
476
|
};
|
|
463
|
-
return transporter.request(request, requestOptions);
|
|
477
|
+
return this.transporter.request(request, requestOptions);
|
|
464
478
|
},
|
|
465
479
|
/**
|
|
466
480
|
* Retrieves the purchase rate for all of your searches with at least one purchase event, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -500,7 +514,7 @@ function createAnalyticsClient({
|
|
|
500
514
|
queryParameters,
|
|
501
515
|
headers
|
|
502
516
|
};
|
|
503
|
-
return transporter.request(request, requestOptions);
|
|
517
|
+
return this.transporter.request(request, requestOptions);
|
|
504
518
|
},
|
|
505
519
|
/**
|
|
506
520
|
* Retrieves revenue-related metrics, such as the total revenue or the average order value. To retrieve revenue-related metrics, sent purchase events. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -540,7 +554,7 @@ function createAnalyticsClient({
|
|
|
540
554
|
queryParameters,
|
|
541
555
|
headers
|
|
542
556
|
};
|
|
543
|
-
return transporter.request(request, requestOptions);
|
|
557
|
+
return this.transporter.request(request, requestOptions);
|
|
544
558
|
},
|
|
545
559
|
/**
|
|
546
560
|
* Retrieves the number of searches within a time range, including a daily breakdown. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -580,7 +594,7 @@ function createAnalyticsClient({
|
|
|
580
594
|
queryParameters,
|
|
581
595
|
headers
|
|
582
596
|
};
|
|
583
|
-
return transporter.request(request, requestOptions);
|
|
597
|
+
return this.transporter.request(request, requestOptions);
|
|
584
598
|
},
|
|
585
599
|
/**
|
|
586
600
|
* Retrieves the most popular searches that didn\'t lead to any clicks, from the 1,000 most frequent searches.
|
|
@@ -628,7 +642,7 @@ function createAnalyticsClient({
|
|
|
628
642
|
queryParameters,
|
|
629
643
|
headers
|
|
630
644
|
};
|
|
631
|
-
return transporter.request(request, requestOptions);
|
|
645
|
+
return this.transporter.request(request, requestOptions);
|
|
632
646
|
},
|
|
633
647
|
/**
|
|
634
648
|
* Retrieves the most popular searches that didn\'t return any results.
|
|
@@ -676,7 +690,7 @@ function createAnalyticsClient({
|
|
|
676
690
|
queryParameters,
|
|
677
691
|
headers
|
|
678
692
|
};
|
|
679
|
-
return transporter.request(request, requestOptions);
|
|
693
|
+
return this.transporter.request(request, requestOptions);
|
|
680
694
|
},
|
|
681
695
|
/**
|
|
682
696
|
* Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes.
|
|
@@ -704,7 +718,7 @@ function createAnalyticsClient({
|
|
|
704
718
|
queryParameters,
|
|
705
719
|
headers
|
|
706
720
|
};
|
|
707
|
-
return transporter.request(request, requestOptions);
|
|
721
|
+
return this.transporter.request(request, requestOptions);
|
|
708
722
|
},
|
|
709
723
|
/**
|
|
710
724
|
* Retrieves the countries with the most searches to your index.
|
|
@@ -752,7 +766,7 @@ function createAnalyticsClient({
|
|
|
752
766
|
queryParameters,
|
|
753
767
|
headers
|
|
754
768
|
};
|
|
755
|
-
return transporter.request(request, requestOptions);
|
|
769
|
+
return this.transporter.request(request, requestOptions);
|
|
756
770
|
},
|
|
757
771
|
/**
|
|
758
772
|
* Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -804,7 +818,7 @@ function createAnalyticsClient({
|
|
|
804
818
|
queryParameters,
|
|
805
819
|
headers
|
|
806
820
|
};
|
|
807
|
-
return transporter.request(request, requestOptions);
|
|
821
|
+
return this.transporter.request(request, requestOptions);
|
|
808
822
|
},
|
|
809
823
|
/**
|
|
810
824
|
* Retrieves the most frequent filter (facet) values for a filter attribute. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -860,7 +874,7 @@ function createAnalyticsClient({
|
|
|
860
874
|
queryParameters,
|
|
861
875
|
headers
|
|
862
876
|
};
|
|
863
|
-
return transporter.request(request, requestOptions);
|
|
877
|
+
return this.transporter.request(request, requestOptions);
|
|
864
878
|
},
|
|
865
879
|
/**
|
|
866
880
|
* Retrieves the most frequently used filters for a search that didn\'t return any results. To get the most frequent searches without results, use the [Retrieve searches without results](#tag/search/operation/getSearchesNoResults) operation.
|
|
@@ -912,7 +926,7 @@ function createAnalyticsClient({
|
|
|
912
926
|
queryParameters,
|
|
913
927
|
headers
|
|
914
928
|
};
|
|
915
|
-
return transporter.request(request, requestOptions);
|
|
929
|
+
return this.transporter.request(request, requestOptions);
|
|
916
930
|
},
|
|
917
931
|
/**
|
|
918
932
|
* Retrieves the object IDs of the most frequent search results.
|
|
@@ -972,7 +986,7 @@ function createAnalyticsClient({
|
|
|
972
986
|
queryParameters,
|
|
973
987
|
headers
|
|
974
988
|
};
|
|
975
|
-
return transporter.request(request, requestOptions);
|
|
989
|
+
return this.transporter.request(request, requestOptions);
|
|
976
990
|
},
|
|
977
991
|
/**
|
|
978
992
|
* Returns the most popular search terms.
|
|
@@ -1047,7 +1061,7 @@ function createAnalyticsClient({
|
|
|
1047
1061
|
queryParameters,
|
|
1048
1062
|
headers
|
|
1049
1063
|
};
|
|
1050
|
-
return transporter.request(request, requestOptions);
|
|
1064
|
+
return this.transporter.request(request, requestOptions);
|
|
1051
1065
|
},
|
|
1052
1066
|
/**
|
|
1053
1067
|
* Retrieves the number of unique users within a time range, including a daily breakdown. Since this endpoint returns the number of unique users, the sum of the daily values might be different from the total number. By default, Algolia distinguishes search users by their IP address, _unless_ you include a pseudonymous user identifier in your search requests with the `userToken` API parameter or `x-algolia-usertoken` request header. By default, the analyzed period includes the last eight days including the current day.
|
|
@@ -1087,7 +1101,7 @@ function createAnalyticsClient({
|
|
|
1087
1101
|
queryParameters,
|
|
1088
1102
|
headers
|
|
1089
1103
|
};
|
|
1090
|
-
return transporter.request(request, requestOptions);
|
|
1104
|
+
return this.transporter.request(request, requestOptions);
|
|
1091
1105
|
}
|
|
1092
1106
|
};
|
|
1093
1107
|
}
|