@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/node.d.cts
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/node.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 & {
|
|
@@ -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.4.0";
|
|
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,25 +41,26 @@ function createAnalyticsClient({
|
|
|
41
41
|
...options
|
|
42
42
|
}) {
|
|
43
43
|
const auth = (0, import_client_common.createAuth)(appIdOption, apiKeyOption, authMode);
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
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
|
-
}
|
|
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
|
|
62
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
|
+
return {
|
|
63
|
+
transporter,
|
|
63
64
|
/**
|
|
64
65
|
* The `appId` currently in use.
|
|
65
66
|
*/
|
|
@@ -68,15 +69,13 @@ function createAnalyticsClient({
|
|
|
68
69
|
* Clears the cache of the transporter for the `requestsCache` and `responsesCache` properties.
|
|
69
70
|
*/
|
|
70
71
|
clearCache() {
|
|
71
|
-
return Promise.all([
|
|
72
|
-
() => void 0
|
|
73
|
-
);
|
|
72
|
+
return Promise.all([transporter.requestsCache.clear(), transporter.responsesCache.clear()]).then(() => void 0);
|
|
74
73
|
},
|
|
75
74
|
/**
|
|
76
75
|
* Get the value of the `algoliaAgent`, used by our libraries internally and telemetry system.
|
|
77
76
|
*/
|
|
78
77
|
get _ua() {
|
|
79
|
-
return
|
|
78
|
+
return transporter.algoliaAgent.value;
|
|
80
79
|
},
|
|
81
80
|
/**
|
|
82
81
|
* Adds a `segment` to the `x-algolia-agent` sent with every requests.
|
|
@@ -85,7 +84,7 @@ function createAnalyticsClient({
|
|
|
85
84
|
* @param version - The version of the agent.
|
|
86
85
|
*/
|
|
87
86
|
addAlgoliaAgent(segment, version) {
|
|
88
|
-
|
|
87
|
+
transporter.algoliaAgent.add({ segment, version });
|
|
89
88
|
},
|
|
90
89
|
/**
|
|
91
90
|
* Helper method to switch the API key used to authenticate the requests.
|
|
@@ -95,9 +94,9 @@ function createAnalyticsClient({
|
|
|
95
94
|
*/
|
|
96
95
|
setClientApiKey({ apiKey }) {
|
|
97
96
|
if (!authMode || authMode === "WithinHeaders") {
|
|
98
|
-
|
|
97
|
+
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
99
98
|
} else {
|
|
100
|
-
|
|
99
|
+
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
|
|
101
100
|
}
|
|
102
101
|
},
|
|
103
102
|
/**
|
|
@@ -121,7 +120,7 @@ function createAnalyticsClient({
|
|
|
121
120
|
queryParameters,
|
|
122
121
|
headers
|
|
123
122
|
};
|
|
124
|
-
return
|
|
123
|
+
return transporter.request(request, requestOptions);
|
|
125
124
|
},
|
|
126
125
|
/**
|
|
127
126
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -144,7 +143,7 @@ function createAnalyticsClient({
|
|
|
144
143
|
queryParameters,
|
|
145
144
|
headers
|
|
146
145
|
};
|
|
147
|
-
return
|
|
146
|
+
return transporter.request(request, requestOptions);
|
|
148
147
|
},
|
|
149
148
|
/**
|
|
150
149
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -169,7 +168,7 @@ function createAnalyticsClient({
|
|
|
169
168
|
headers,
|
|
170
169
|
data: body ? body : {}
|
|
171
170
|
};
|
|
172
|
-
return
|
|
171
|
+
return transporter.request(request, requestOptions);
|
|
173
172
|
},
|
|
174
173
|
/**
|
|
175
174
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -194,7 +193,7 @@ function createAnalyticsClient({
|
|
|
194
193
|
headers,
|
|
195
194
|
data: body ? body : {}
|
|
196
195
|
};
|
|
197
|
-
return
|
|
196
|
+
return transporter.request(request, requestOptions);
|
|
198
197
|
},
|
|
199
198
|
/**
|
|
200
199
|
* 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.
|
|
@@ -234,7 +233,7 @@ function createAnalyticsClient({
|
|
|
234
233
|
queryParameters,
|
|
235
234
|
headers
|
|
236
235
|
};
|
|
237
|
-
return
|
|
236
|
+
return transporter.request(request, requestOptions);
|
|
238
237
|
},
|
|
239
238
|
/**
|
|
240
239
|
* 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.
|
|
@@ -274,7 +273,7 @@ function createAnalyticsClient({
|
|
|
274
273
|
queryParameters,
|
|
275
274
|
headers
|
|
276
275
|
};
|
|
277
|
-
return
|
|
276
|
+
return transporter.request(request, requestOptions);
|
|
278
277
|
},
|
|
279
278
|
/**
|
|
280
279
|
* 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.
|
|
@@ -314,7 +313,7 @@ function createAnalyticsClient({
|
|
|
314
313
|
queryParameters,
|
|
315
314
|
headers
|
|
316
315
|
};
|
|
317
|
-
return
|
|
316
|
+
return transporter.request(request, requestOptions);
|
|
318
317
|
},
|
|
319
318
|
/**
|
|
320
319
|
* 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.
|
|
@@ -354,7 +353,7 @@ function createAnalyticsClient({
|
|
|
354
353
|
queryParameters,
|
|
355
354
|
headers
|
|
356
355
|
};
|
|
357
|
-
return
|
|
356
|
+
return transporter.request(request, requestOptions);
|
|
358
357
|
},
|
|
359
358
|
/**
|
|
360
359
|
* 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.
|
|
@@ -394,7 +393,7 @@ function createAnalyticsClient({
|
|
|
394
393
|
queryParameters,
|
|
395
394
|
headers
|
|
396
395
|
};
|
|
397
|
-
return
|
|
396
|
+
return transporter.request(request, requestOptions);
|
|
398
397
|
},
|
|
399
398
|
/**
|
|
400
399
|
* 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.
|
|
@@ -434,7 +433,7 @@ function createAnalyticsClient({
|
|
|
434
433
|
queryParameters,
|
|
435
434
|
headers
|
|
436
435
|
};
|
|
437
|
-
return
|
|
436
|
+
return transporter.request(request, requestOptions);
|
|
438
437
|
},
|
|
439
438
|
/**
|
|
440
439
|
* 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.
|
|
@@ -474,7 +473,7 @@ function createAnalyticsClient({
|
|
|
474
473
|
queryParameters,
|
|
475
474
|
headers
|
|
476
475
|
};
|
|
477
|
-
return
|
|
476
|
+
return transporter.request(request, requestOptions);
|
|
478
477
|
},
|
|
479
478
|
/**
|
|
480
479
|
* 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.
|
|
@@ -514,7 +513,7 @@ function createAnalyticsClient({
|
|
|
514
513
|
queryParameters,
|
|
515
514
|
headers
|
|
516
515
|
};
|
|
517
|
-
return
|
|
516
|
+
return transporter.request(request, requestOptions);
|
|
518
517
|
},
|
|
519
518
|
/**
|
|
520
519
|
* 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.
|
|
@@ -554,7 +553,7 @@ function createAnalyticsClient({
|
|
|
554
553
|
queryParameters,
|
|
555
554
|
headers
|
|
556
555
|
};
|
|
557
|
-
return
|
|
556
|
+
return transporter.request(request, requestOptions);
|
|
558
557
|
},
|
|
559
558
|
/**
|
|
560
559
|
* 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.
|
|
@@ -594,7 +593,7 @@ function createAnalyticsClient({
|
|
|
594
593
|
queryParameters,
|
|
595
594
|
headers
|
|
596
595
|
};
|
|
597
|
-
return
|
|
596
|
+
return transporter.request(request, requestOptions);
|
|
598
597
|
},
|
|
599
598
|
/**
|
|
600
599
|
* Retrieves the most popular searches that didn\'t lead to any clicks, from the 1,000 most frequent searches.
|
|
@@ -642,7 +641,7 @@ function createAnalyticsClient({
|
|
|
642
641
|
queryParameters,
|
|
643
642
|
headers
|
|
644
643
|
};
|
|
645
|
-
return
|
|
644
|
+
return transporter.request(request, requestOptions);
|
|
646
645
|
},
|
|
647
646
|
/**
|
|
648
647
|
* Retrieves the most popular searches that didn\'t return any results.
|
|
@@ -690,7 +689,7 @@ function createAnalyticsClient({
|
|
|
690
689
|
queryParameters,
|
|
691
690
|
headers
|
|
692
691
|
};
|
|
693
|
-
return
|
|
692
|
+
return transporter.request(request, requestOptions);
|
|
694
693
|
},
|
|
695
694
|
/**
|
|
696
695
|
* Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes.
|
|
@@ -718,7 +717,7 @@ function createAnalyticsClient({
|
|
|
718
717
|
queryParameters,
|
|
719
718
|
headers
|
|
720
719
|
};
|
|
721
|
-
return
|
|
720
|
+
return transporter.request(request, requestOptions);
|
|
722
721
|
},
|
|
723
722
|
/**
|
|
724
723
|
* Retrieves the countries with the most searches to your index.
|
|
@@ -766,7 +765,7 @@ function createAnalyticsClient({
|
|
|
766
765
|
queryParameters,
|
|
767
766
|
headers
|
|
768
767
|
};
|
|
769
|
-
return
|
|
768
|
+
return transporter.request(request, requestOptions);
|
|
770
769
|
},
|
|
771
770
|
/**
|
|
772
771
|
* Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -818,7 +817,7 @@ function createAnalyticsClient({
|
|
|
818
817
|
queryParameters,
|
|
819
818
|
headers
|
|
820
819
|
};
|
|
821
|
-
return
|
|
820
|
+
return transporter.request(request, requestOptions);
|
|
822
821
|
},
|
|
823
822
|
/**
|
|
824
823
|
* Retrieves the most frequent filter (facet) values for a filter attribute. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -874,7 +873,7 @@ function createAnalyticsClient({
|
|
|
874
873
|
queryParameters,
|
|
875
874
|
headers
|
|
876
875
|
};
|
|
877
|
-
return
|
|
876
|
+
return transporter.request(request, requestOptions);
|
|
878
877
|
},
|
|
879
878
|
/**
|
|
880
879
|
* 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.
|
|
@@ -926,7 +925,7 @@ function createAnalyticsClient({
|
|
|
926
925
|
queryParameters,
|
|
927
926
|
headers
|
|
928
927
|
};
|
|
929
|
-
return
|
|
928
|
+
return transporter.request(request, requestOptions);
|
|
930
929
|
},
|
|
931
930
|
/**
|
|
932
931
|
* Retrieves the object IDs of the most frequent search results.
|
|
@@ -986,7 +985,7 @@ function createAnalyticsClient({
|
|
|
986
985
|
queryParameters,
|
|
987
986
|
headers
|
|
988
987
|
};
|
|
989
|
-
return
|
|
988
|
+
return transporter.request(request, requestOptions);
|
|
990
989
|
},
|
|
991
990
|
/**
|
|
992
991
|
* Returns the most popular search terms.
|
|
@@ -1061,7 +1060,7 @@ function createAnalyticsClient({
|
|
|
1061
1060
|
queryParameters,
|
|
1062
1061
|
headers
|
|
1063
1062
|
};
|
|
1064
|
-
return
|
|
1063
|
+
return transporter.request(request, requestOptions);
|
|
1065
1064
|
},
|
|
1066
1065
|
/**
|
|
1067
1066
|
* 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.
|
|
@@ -1101,7 +1100,7 @@ function createAnalyticsClient({
|
|
|
1101
1100
|
queryParameters,
|
|
1102
1101
|
headers
|
|
1103
1102
|
};
|
|
1104
|
-
return
|
|
1103
|
+
return transporter.request(request, requestOptions);
|
|
1105
1104
|
}
|
|
1106
1105
|
};
|
|
1107
1106
|
}
|