@algolia/client-analytics 5.3.0 → 5.3.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/browser.d.ts +1 -1
- package/dist/builds/browser.js +52 -49
- 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 +52 -49
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +52 -49
- package/dist/builds/node.js.map +1 -1
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/src/analyticsClient.cjs +52 -49
- package/dist/src/analyticsClient.cjs.map +1 -1
- package/dist/src/analyticsClient.js +52 -49
- package/dist/src/analyticsClient.js.map +1 -1
- package/package.json +4 -4
package/dist/builds/node.js
CHANGED
|
@@ -10,7 +10,7 @@ import { createHttpRequester } from "@algolia/requester-node-http";
|
|
|
10
10
|
|
|
11
11
|
// src/analyticsClient.ts
|
|
12
12
|
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
13
|
-
var apiClientVersion = "5.3.
|
|
13
|
+
var apiClientVersion = "5.3.2";
|
|
14
14
|
var REGIONS = ["de", "us"];
|
|
15
15
|
function getDefaultHosts(region) {
|
|
16
16
|
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
|
|
@@ -25,25 +25,26 @@ function createAnalyticsClient({
|
|
|
25
25
|
...options
|
|
26
26
|
}) {
|
|
27
27
|
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
version: apiClientVersion
|
|
36
|
-
}),
|
|
37
|
-
baseHeaders: {
|
|
38
|
-
"content-type": "text/plain",
|
|
39
|
-
...auth.headers(),
|
|
40
|
-
...options.baseHeaders
|
|
41
|
-
},
|
|
42
|
-
baseQueryParameters: {
|
|
43
|
-
...auth.queryParameters(),
|
|
44
|
-
...options.baseQueryParameters
|
|
45
|
-
}
|
|
28
|
+
const transporter = createTransporter({
|
|
29
|
+
hosts: getDefaultHosts(regionOption),
|
|
30
|
+
...options,
|
|
31
|
+
algoliaAgent: getAlgoliaAgent({
|
|
32
|
+
algoliaAgents,
|
|
33
|
+
client: "Analytics",
|
|
34
|
+
version: apiClientVersion
|
|
46
35
|
}),
|
|
36
|
+
baseHeaders: {
|
|
37
|
+
"content-type": "text/plain",
|
|
38
|
+
...auth.headers(),
|
|
39
|
+
...options.baseHeaders
|
|
40
|
+
},
|
|
41
|
+
baseQueryParameters: {
|
|
42
|
+
...auth.queryParameters(),
|
|
43
|
+
...options.baseQueryParameters
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return {
|
|
47
|
+
transporter,
|
|
47
48
|
/**
|
|
48
49
|
* The `appId` currently in use.
|
|
49
50
|
*/
|
|
@@ -52,15 +53,13 @@ function createAnalyticsClient({
|
|
|
52
53
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
53
54
|
*/
|
|
54
55
|
clearCache() {
|
|
55
|
-
return Promise.all([
|
|
56
|
-
() => void 0
|
|
57
|
-
);
|
|
56
|
+
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
|
|
58
57
|
},
|
|
59
58
|
/**
|
|
60
59
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
61
60
|
*/
|
|
62
61
|
get _ua() {
|
|
63
|
-
return
|
|
62
|
+
return transporter.algoliaAgent.value;
|
|
64
63
|
},
|
|
65
64
|
/**
|
|
66
65
|
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
@@ -69,7 +68,7 @@ function createAnalyticsClient({
|
|
|
69
68
|
* @param version - The version of the agent.
|
|
70
69
|
*/
|
|
71
70
|
addAlgoliaAgent(segment, version) {
|
|
72
|
-
|
|
71
|
+
transporter.algoliaAgent.add({ segment, version });
|
|
73
72
|
},
|
|
74
73
|
/**
|
|
75
74
|
* Helper method to switch the API key used to authenticate the requests.
|
|
@@ -78,7 +77,11 @@ function createAnalyticsClient({
|
|
|
78
77
|
* @param params.apiKey - The new API Key to use.
|
|
79
78
|
*/
|
|
80
79
|
setClientApiKey({ apiKey }) {
|
|
81
|
-
|
|
80
|
+
if (!authMode || authMode === "WithinHeaders") {
|
|
81
|
+
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
82
|
+
} else {
|
|
83
|
+
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
|
|
84
|
+
}
|
|
82
85
|
},
|
|
83
86
|
/**
|
|
84
87
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -101,7 +104,7 @@ function createAnalyticsClient({
|
|
|
101
104
|
queryParameters,
|
|
102
105
|
headers
|
|
103
106
|
};
|
|
104
|
-
return
|
|
107
|
+
return transporter.request(request, requestOptions);
|
|
105
108
|
},
|
|
106
109
|
/**
|
|
107
110
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -124,7 +127,7 @@ function createAnalyticsClient({
|
|
|
124
127
|
queryParameters,
|
|
125
128
|
headers
|
|
126
129
|
};
|
|
127
|
-
return
|
|
130
|
+
return transporter.request(request, requestOptions);
|
|
128
131
|
},
|
|
129
132
|
/**
|
|
130
133
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -149,7 +152,7 @@ function createAnalyticsClient({
|
|
|
149
152
|
headers,
|
|
150
153
|
data: body ? body : {}
|
|
151
154
|
};
|
|
152
|
-
return
|
|
155
|
+
return transporter.request(request, requestOptions);
|
|
153
156
|
},
|
|
154
157
|
/**
|
|
155
158
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -174,7 +177,7 @@ function createAnalyticsClient({
|
|
|
174
177
|
headers,
|
|
175
178
|
data: body ? body : {}
|
|
176
179
|
};
|
|
177
|
-
return
|
|
180
|
+
return transporter.request(request, requestOptions);
|
|
178
181
|
},
|
|
179
182
|
/**
|
|
180
183
|
* 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.
|
|
@@ -214,7 +217,7 @@ function createAnalyticsClient({
|
|
|
214
217
|
queryParameters,
|
|
215
218
|
headers
|
|
216
219
|
};
|
|
217
|
-
return
|
|
220
|
+
return transporter.request(request, requestOptions);
|
|
218
221
|
},
|
|
219
222
|
/**
|
|
220
223
|
* 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.
|
|
@@ -254,7 +257,7 @@ function createAnalyticsClient({
|
|
|
254
257
|
queryParameters,
|
|
255
258
|
headers
|
|
256
259
|
};
|
|
257
|
-
return
|
|
260
|
+
return transporter.request(request, requestOptions);
|
|
258
261
|
},
|
|
259
262
|
/**
|
|
260
263
|
* 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.
|
|
@@ -294,7 +297,7 @@ function createAnalyticsClient({
|
|
|
294
297
|
queryParameters,
|
|
295
298
|
headers
|
|
296
299
|
};
|
|
297
|
-
return
|
|
300
|
+
return transporter.request(request, requestOptions);
|
|
298
301
|
},
|
|
299
302
|
/**
|
|
300
303
|
* 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.
|
|
@@ -334,7 +337,7 @@ function createAnalyticsClient({
|
|
|
334
337
|
queryParameters,
|
|
335
338
|
headers
|
|
336
339
|
};
|
|
337
|
-
return
|
|
340
|
+
return transporter.request(request, requestOptions);
|
|
338
341
|
},
|
|
339
342
|
/**
|
|
340
343
|
* 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.
|
|
@@ -374,7 +377,7 @@ function createAnalyticsClient({
|
|
|
374
377
|
queryParameters,
|
|
375
378
|
headers
|
|
376
379
|
};
|
|
377
|
-
return
|
|
380
|
+
return transporter.request(request, requestOptions);
|
|
378
381
|
},
|
|
379
382
|
/**
|
|
380
383
|
* 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.
|
|
@@ -414,7 +417,7 @@ function createAnalyticsClient({
|
|
|
414
417
|
queryParameters,
|
|
415
418
|
headers
|
|
416
419
|
};
|
|
417
|
-
return
|
|
420
|
+
return transporter.request(request, requestOptions);
|
|
418
421
|
},
|
|
419
422
|
/**
|
|
420
423
|
* 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.
|
|
@@ -454,7 +457,7 @@ function createAnalyticsClient({
|
|
|
454
457
|
queryParameters,
|
|
455
458
|
headers
|
|
456
459
|
};
|
|
457
|
-
return
|
|
460
|
+
return transporter.request(request, requestOptions);
|
|
458
461
|
},
|
|
459
462
|
/**
|
|
460
463
|
* 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.
|
|
@@ -494,7 +497,7 @@ function createAnalyticsClient({
|
|
|
494
497
|
queryParameters,
|
|
495
498
|
headers
|
|
496
499
|
};
|
|
497
|
-
return
|
|
500
|
+
return transporter.request(request, requestOptions);
|
|
498
501
|
},
|
|
499
502
|
/**
|
|
500
503
|
* 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.
|
|
@@ -534,7 +537,7 @@ function createAnalyticsClient({
|
|
|
534
537
|
queryParameters,
|
|
535
538
|
headers
|
|
536
539
|
};
|
|
537
|
-
return
|
|
540
|
+
return transporter.request(request, requestOptions);
|
|
538
541
|
},
|
|
539
542
|
/**
|
|
540
543
|
* 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.
|
|
@@ -574,7 +577,7 @@ function createAnalyticsClient({
|
|
|
574
577
|
queryParameters,
|
|
575
578
|
headers
|
|
576
579
|
};
|
|
577
|
-
return
|
|
580
|
+
return transporter.request(request, requestOptions);
|
|
578
581
|
},
|
|
579
582
|
/**
|
|
580
583
|
* Retrieves the most popular searches that didn\'t lead to any clicks, from the 1,000 most frequent searches.
|
|
@@ -622,7 +625,7 @@ function createAnalyticsClient({
|
|
|
622
625
|
queryParameters,
|
|
623
626
|
headers
|
|
624
627
|
};
|
|
625
|
-
return
|
|
628
|
+
return transporter.request(request, requestOptions);
|
|
626
629
|
},
|
|
627
630
|
/**
|
|
628
631
|
* Retrieves the most popular searches that didn\'t return any results.
|
|
@@ -670,7 +673,7 @@ function createAnalyticsClient({
|
|
|
670
673
|
queryParameters,
|
|
671
674
|
headers
|
|
672
675
|
};
|
|
673
|
-
return
|
|
676
|
+
return transporter.request(request, requestOptions);
|
|
674
677
|
},
|
|
675
678
|
/**
|
|
676
679
|
* Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes.
|
|
@@ -698,7 +701,7 @@ function createAnalyticsClient({
|
|
|
698
701
|
queryParameters,
|
|
699
702
|
headers
|
|
700
703
|
};
|
|
701
|
-
return
|
|
704
|
+
return transporter.request(request, requestOptions);
|
|
702
705
|
},
|
|
703
706
|
/**
|
|
704
707
|
* Retrieves the countries with the most searches to your index.
|
|
@@ -746,7 +749,7 @@ function createAnalyticsClient({
|
|
|
746
749
|
queryParameters,
|
|
747
750
|
headers
|
|
748
751
|
};
|
|
749
|
-
return
|
|
752
|
+
return transporter.request(request, requestOptions);
|
|
750
753
|
},
|
|
751
754
|
/**
|
|
752
755
|
* Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -798,7 +801,7 @@ function createAnalyticsClient({
|
|
|
798
801
|
queryParameters,
|
|
799
802
|
headers
|
|
800
803
|
};
|
|
801
|
-
return
|
|
804
|
+
return transporter.request(request, requestOptions);
|
|
802
805
|
},
|
|
803
806
|
/**
|
|
804
807
|
* Retrieves the most frequent filter (facet) values for a filter attribute. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -854,7 +857,7 @@ function createAnalyticsClient({
|
|
|
854
857
|
queryParameters,
|
|
855
858
|
headers
|
|
856
859
|
};
|
|
857
|
-
return
|
|
860
|
+
return transporter.request(request, requestOptions);
|
|
858
861
|
},
|
|
859
862
|
/**
|
|
860
863
|
* 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.
|
|
@@ -906,7 +909,7 @@ function createAnalyticsClient({
|
|
|
906
909
|
queryParameters,
|
|
907
910
|
headers
|
|
908
911
|
};
|
|
909
|
-
return
|
|
912
|
+
return transporter.request(request, requestOptions);
|
|
910
913
|
},
|
|
911
914
|
/**
|
|
912
915
|
* Retrieves the object IDs of the most frequent search results.
|
|
@@ -966,7 +969,7 @@ function createAnalyticsClient({
|
|
|
966
969
|
queryParameters,
|
|
967
970
|
headers
|
|
968
971
|
};
|
|
969
|
-
return
|
|
972
|
+
return transporter.request(request, requestOptions);
|
|
970
973
|
},
|
|
971
974
|
/**
|
|
972
975
|
* Returns the most popular search terms.
|
|
@@ -1041,7 +1044,7 @@ function createAnalyticsClient({
|
|
|
1041
1044
|
queryParameters,
|
|
1042
1045
|
headers
|
|
1043
1046
|
};
|
|
1044
|
-
return
|
|
1047
|
+
return transporter.request(request, requestOptions);
|
|
1045
1048
|
},
|
|
1046
1049
|
/**
|
|
1047
1050
|
* 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.
|
|
@@ -1081,7 +1084,7 @@ function createAnalyticsClient({
|
|
|
1081
1084
|
queryParameters,
|
|
1082
1085
|
headers
|
|
1083
1086
|
};
|
|
1084
|
-
return
|
|
1087
|
+
return transporter.request(request, requestOptions);
|
|
1085
1088
|
}
|
|
1086
1089
|
};
|
|
1087
1090
|
}
|