@algolia/client-analytics 5.3.1 → 5.4.0
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 +49 -50
- 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 +3 -3
- package/dist/builds/fetch.js +1126 -0
- package/dist/builds/fetch.js.map +1 -0
- package/dist/builds/node.cjs +49 -50
- package/dist/builds/node.cjs.map +1 -1
- package/dist/builds/node.js +49 -50
- package/dist/builds/node.js.map +1 -1
- package/dist/fetch.d.ts +1742 -0
- package/dist/node.d.cts +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/src/analyticsClient.cjs +49 -50
- package/dist/src/analyticsClient.cjs.map +1 -1
- package/dist/src/analyticsClient.js +49 -50
- package/dist/src/analyticsClient.js.map +1 -1
- package/package.json +9 -4
package/dist/browser.d.ts
CHANGED
|
@@ -1349,7 +1349,7 @@ type GetUsersCountResponse = {
|
|
|
1349
1349
|
dates: DailyUsers[];
|
|
1350
1350
|
};
|
|
1351
1351
|
|
|
1352
|
-
declare const apiClientVersion = "5.
|
|
1352
|
+
declare const apiClientVersion = "5.4.0";
|
|
1353
1353
|
declare const REGIONS: readonly ["de", "us"];
|
|
1354
1354
|
type Region = (typeof REGIONS)[number];
|
|
1355
1355
|
declare function createAnalyticsClient({ appId: appIdOption, apiKey: apiKeyOption, authMode, algoliaAgents, region: regionOption, ...options }: CreateClientOptions & {
|
package/dist/builds/browser.js
CHANGED
|
@@ -11,7 +11,7 @@ import { createXhrRequester } from "@algolia/requester-browser-xhr";
|
|
|
11
11
|
|
|
12
12
|
// src/analyticsClient.ts
|
|
13
13
|
import { createAuth, createTransporter, getAlgoliaAgent } from "@algolia/client-common";
|
|
14
|
-
var apiClientVersion = "5.
|
|
14
|
+
var apiClientVersion = "5.4.0";
|
|
15
15
|
var REGIONS = ["de", "us"];
|
|
16
16
|
function getDefaultHosts(region) {
|
|
17
17
|
const url = !region ? "analytics.algolia.com" : "analytics.{region}.algolia.com".replace("{region}", region);
|
|
@@ -26,25 +26,26 @@ function createAnalyticsClient({
|
|
|
26
26
|
...options
|
|
27
27
|
}) {
|
|
28
28
|
const auth = createAuth(appIdOption, apiKeyOption, authMode);
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
version: apiClientVersion
|
|
37
|
-
}),
|
|
38
|
-
baseHeaders: {
|
|
39
|
-
"content-type": "text/plain",
|
|
40
|
-
...auth.headers(),
|
|
41
|
-
...options.baseHeaders
|
|
42
|
-
},
|
|
43
|
-
baseQueryParameters: {
|
|
44
|
-
...auth.queryParameters(),
|
|
45
|
-
...options.baseQueryParameters
|
|
46
|
-
}
|
|
29
|
+
const transporter = createTransporter({
|
|
30
|
+
hosts: getDefaultHosts(regionOption),
|
|
31
|
+
...options,
|
|
32
|
+
algoliaAgent: getAlgoliaAgent({
|
|
33
|
+
algoliaAgents,
|
|
34
|
+
client: "Analytics",
|
|
35
|
+
version: apiClientVersion
|
|
47
36
|
}),
|
|
37
|
+
baseHeaders: {
|
|
38
|
+
"content-type": "text/plain",
|
|
39
|
+
...auth.headers(),
|
|
40
|
+
...options.baseHeaders
|
|
41
|
+
},
|
|
42
|
+
baseQueryParameters: {
|
|
43
|
+
...auth.queryParameters(),
|
|
44
|
+
...options.baseQueryParameters
|
|
45
|
+
}
|
|
46
|
+
});
|
|
47
|
+
return {
|
|
48
|
+
transporter,
|
|
48
49
|
/**
|
|
49
50
|
* The `appId` currently in use.
|
|
50
51
|
*/
|
|
@@ -53,15 +54,13 @@ function createAnalyticsClient({
|
|
|
53
54
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
54
55
|
*/
|
|
55
56
|
clearCache() {
|
|
56
|
-
return Promise.all([
|
|
57
|
-
() => void 0
|
|
58
|
-
);
|
|
57
|
+
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
|
|
59
58
|
},
|
|
60
59
|
/**
|
|
61
60
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
62
61
|
*/
|
|
63
62
|
get _ua() {
|
|
64
|
-
return
|
|
63
|
+
return transporter.algoliaAgent.value;
|
|
65
64
|
},
|
|
66
65
|
/**
|
|
67
66
|
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
@@ -70,7 +69,7 @@ function createAnalyticsClient({
|
|
|
70
69
|
* @param version - The version of the agent.
|
|
71
70
|
*/
|
|
72
71
|
addAlgoliaAgent(segment, version) {
|
|
73
|
-
|
|
72
|
+
transporter.algoliaAgent.add({ segment, version });
|
|
74
73
|
},
|
|
75
74
|
/**
|
|
76
75
|
* Helper method to switch the API key used to authenticate the requests.
|
|
@@ -80,9 +79,9 @@ function createAnalyticsClient({
|
|
|
80
79
|
*/
|
|
81
80
|
setClientApiKey({ apiKey }) {
|
|
82
81
|
if (!authMode || authMode === "WithinHeaders") {
|
|
83
|
-
|
|
82
|
+
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
84
83
|
} else {
|
|
85
|
-
|
|
84
|
+
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
|
|
86
85
|
}
|
|
87
86
|
},
|
|
88
87
|
/**
|
|
@@ -106,7 +105,7 @@ function createAnalyticsClient({
|
|
|
106
105
|
queryParameters,
|
|
107
106
|
headers
|
|
108
107
|
};
|
|
109
|
-
return
|
|
108
|
+
return transporter.request(request, requestOptions);
|
|
110
109
|
},
|
|
111
110
|
/**
|
|
112
111
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -129,7 +128,7 @@ function createAnalyticsClient({
|
|
|
129
128
|
queryParameters,
|
|
130
129
|
headers
|
|
131
130
|
};
|
|
132
|
-
return
|
|
131
|
+
return transporter.request(request, requestOptions);
|
|
133
132
|
},
|
|
134
133
|
/**
|
|
135
134
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -154,7 +153,7 @@ function createAnalyticsClient({
|
|
|
154
153
|
headers,
|
|
155
154
|
data: body ? body : {}
|
|
156
155
|
};
|
|
157
|
-
return
|
|
156
|
+
return transporter.request(request, requestOptions);
|
|
158
157
|
},
|
|
159
158
|
/**
|
|
160
159
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -179,7 +178,7 @@ function createAnalyticsClient({
|
|
|
179
178
|
headers,
|
|
180
179
|
data: body ? body : {}
|
|
181
180
|
};
|
|
182
|
-
return
|
|
181
|
+
return transporter.request(request, requestOptions);
|
|
183
182
|
},
|
|
184
183
|
/**
|
|
185
184
|
* 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.
|
|
@@ -219,7 +218,7 @@ function createAnalyticsClient({
|
|
|
219
218
|
queryParameters,
|
|
220
219
|
headers
|
|
221
220
|
};
|
|
222
|
-
return
|
|
221
|
+
return transporter.request(request, requestOptions);
|
|
223
222
|
},
|
|
224
223
|
/**
|
|
225
224
|
* 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.
|
|
@@ -259,7 +258,7 @@ function createAnalyticsClient({
|
|
|
259
258
|
queryParameters,
|
|
260
259
|
headers
|
|
261
260
|
};
|
|
262
|
-
return
|
|
261
|
+
return transporter.request(request, requestOptions);
|
|
263
262
|
},
|
|
264
263
|
/**
|
|
265
264
|
* 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.
|
|
@@ -299,7 +298,7 @@ function createAnalyticsClient({
|
|
|
299
298
|
queryParameters,
|
|
300
299
|
headers
|
|
301
300
|
};
|
|
302
|
-
return
|
|
301
|
+
return transporter.request(request, requestOptions);
|
|
303
302
|
},
|
|
304
303
|
/**
|
|
305
304
|
* 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.
|
|
@@ -339,7 +338,7 @@ function createAnalyticsClient({
|
|
|
339
338
|
queryParameters,
|
|
340
339
|
headers
|
|
341
340
|
};
|
|
342
|
-
return
|
|
341
|
+
return transporter.request(request, requestOptions);
|
|
343
342
|
},
|
|
344
343
|
/**
|
|
345
344
|
* 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.
|
|
@@ -379,7 +378,7 @@ function createAnalyticsClient({
|
|
|
379
378
|
queryParameters,
|
|
380
379
|
headers
|
|
381
380
|
};
|
|
382
|
-
return
|
|
381
|
+
return transporter.request(request, requestOptions);
|
|
383
382
|
},
|
|
384
383
|
/**
|
|
385
384
|
* 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.
|
|
@@ -419,7 +418,7 @@ function createAnalyticsClient({
|
|
|
419
418
|
queryParameters,
|
|
420
419
|
headers
|
|
421
420
|
};
|
|
422
|
-
return
|
|
421
|
+
return transporter.request(request, requestOptions);
|
|
423
422
|
},
|
|
424
423
|
/**
|
|
425
424
|
* 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.
|
|
@@ -459,7 +458,7 @@ function createAnalyticsClient({
|
|
|
459
458
|
queryParameters,
|
|
460
459
|
headers
|
|
461
460
|
};
|
|
462
|
-
return
|
|
461
|
+
return transporter.request(request, requestOptions);
|
|
463
462
|
},
|
|
464
463
|
/**
|
|
465
464
|
* 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.
|
|
@@ -499,7 +498,7 @@ function createAnalyticsClient({
|
|
|
499
498
|
queryParameters,
|
|
500
499
|
headers
|
|
501
500
|
};
|
|
502
|
-
return
|
|
501
|
+
return transporter.request(request, requestOptions);
|
|
503
502
|
},
|
|
504
503
|
/**
|
|
505
504
|
* 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.
|
|
@@ -539,7 +538,7 @@ function createAnalyticsClient({
|
|
|
539
538
|
queryParameters,
|
|
540
539
|
headers
|
|
541
540
|
};
|
|
542
|
-
return
|
|
541
|
+
return transporter.request(request, requestOptions);
|
|
543
542
|
},
|
|
544
543
|
/**
|
|
545
544
|
* 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.
|
|
@@ -579,7 +578,7 @@ function createAnalyticsClient({
|
|
|
579
578
|
queryParameters,
|
|
580
579
|
headers
|
|
581
580
|
};
|
|
582
|
-
return
|
|
581
|
+
return transporter.request(request, requestOptions);
|
|
583
582
|
},
|
|
584
583
|
/**
|
|
585
584
|
* Retrieves the most popular searches that didn\'t lead to any clicks, from the 1,000 most frequent searches.
|
|
@@ -627,7 +626,7 @@ function createAnalyticsClient({
|
|
|
627
626
|
queryParameters,
|
|
628
627
|
headers
|
|
629
628
|
};
|
|
630
|
-
return
|
|
629
|
+
return transporter.request(request, requestOptions);
|
|
631
630
|
},
|
|
632
631
|
/**
|
|
633
632
|
* Retrieves the most popular searches that didn\'t return any results.
|
|
@@ -675,7 +674,7 @@ function createAnalyticsClient({
|
|
|
675
674
|
queryParameters,
|
|
676
675
|
headers
|
|
677
676
|
};
|
|
678
|
-
return
|
|
677
|
+
return transporter.request(request, requestOptions);
|
|
679
678
|
},
|
|
680
679
|
/**
|
|
681
680
|
* Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes.
|
|
@@ -703,7 +702,7 @@ function createAnalyticsClient({
|
|
|
703
702
|
queryParameters,
|
|
704
703
|
headers
|
|
705
704
|
};
|
|
706
|
-
return
|
|
705
|
+
return transporter.request(request, requestOptions);
|
|
707
706
|
},
|
|
708
707
|
/**
|
|
709
708
|
* Retrieves the countries with the most searches to your index.
|
|
@@ -751,7 +750,7 @@ function createAnalyticsClient({
|
|
|
751
750
|
queryParameters,
|
|
752
751
|
headers
|
|
753
752
|
};
|
|
754
|
-
return
|
|
753
|
+
return transporter.request(request, requestOptions);
|
|
755
754
|
},
|
|
756
755
|
/**
|
|
757
756
|
* Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -803,7 +802,7 @@ function createAnalyticsClient({
|
|
|
803
802
|
queryParameters,
|
|
804
803
|
headers
|
|
805
804
|
};
|
|
806
|
-
return
|
|
805
|
+
return transporter.request(request, requestOptions);
|
|
807
806
|
},
|
|
808
807
|
/**
|
|
809
808
|
* Retrieves the most frequent filter (facet) values for a filter attribute. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -859,7 +858,7 @@ function createAnalyticsClient({
|
|
|
859
858
|
queryParameters,
|
|
860
859
|
headers
|
|
861
860
|
};
|
|
862
|
-
return
|
|
861
|
+
return transporter.request(request, requestOptions);
|
|
863
862
|
},
|
|
864
863
|
/**
|
|
865
864
|
* 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.
|
|
@@ -911,7 +910,7 @@ function createAnalyticsClient({
|
|
|
911
910
|
queryParameters,
|
|
912
911
|
headers
|
|
913
912
|
};
|
|
914
|
-
return
|
|
913
|
+
return transporter.request(request, requestOptions);
|
|
915
914
|
},
|
|
916
915
|
/**
|
|
917
916
|
* Retrieves the object IDs of the most frequent search results.
|
|
@@ -971,7 +970,7 @@ function createAnalyticsClient({
|
|
|
971
970
|
queryParameters,
|
|
972
971
|
headers
|
|
973
972
|
};
|
|
974
|
-
return
|
|
973
|
+
return transporter.request(request, requestOptions);
|
|
975
974
|
},
|
|
976
975
|
/**
|
|
977
976
|
* Returns the most popular search terms.
|
|
@@ -1046,7 +1045,7 @@ function createAnalyticsClient({
|
|
|
1046
1045
|
queryParameters,
|
|
1047
1046
|
headers
|
|
1048
1047
|
};
|
|
1049
|
-
return
|
|
1048
|
+
return transporter.request(request, requestOptions);
|
|
1050
1049
|
},
|
|
1051
1050
|
/**
|
|
1052
1051
|
* 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.
|
|
@@ -1086,7 +1085,7 @@ function createAnalyticsClient({
|
|
|
1086
1085
|
queryParameters,
|
|
1087
1086
|
headers
|
|
1088
1087
|
};
|
|
1089
|
-
return
|
|
1088
|
+
return transporter.request(request, requestOptions);
|
|
1090
1089
|
}
|
|
1091
1090
|
};
|
|
1092
1091
|
}
|