@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
|
@@ -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.3.
|
|
29
|
+
var apiClientVersion = "5.3.2";
|
|
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.
|
|
@@ -94,7 +93,11 @@ function createAnalyticsClient({
|
|
|
94
93
|
* @param params.apiKey - The new API Key to use.
|
|
95
94
|
*/
|
|
96
95
|
setClientApiKey({ apiKey }) {
|
|
97
|
-
|
|
96
|
+
if (!authMode || authMode === "WithinHeaders") {
|
|
97
|
+
transporter.baseHeaders["x-algolia-api-key"] = apiKey;
|
|
98
|
+
} else {
|
|
99
|
+
transporter.baseQueryParameters["x-algolia-api-key"] = apiKey;
|
|
100
|
+
}
|
|
98
101
|
},
|
|
99
102
|
/**
|
|
100
103
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -117,7 +120,7 @@ function createAnalyticsClient({
|
|
|
117
120
|
queryParameters,
|
|
118
121
|
headers
|
|
119
122
|
};
|
|
120
|
-
return
|
|
123
|
+
return transporter.request(request, requestOptions);
|
|
121
124
|
},
|
|
122
125
|
/**
|
|
123
126
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -140,7 +143,7 @@ function createAnalyticsClient({
|
|
|
140
143
|
queryParameters,
|
|
141
144
|
headers
|
|
142
145
|
};
|
|
143
|
-
return
|
|
146
|
+
return transporter.request(request, requestOptions);
|
|
144
147
|
},
|
|
145
148
|
/**
|
|
146
149
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -165,7 +168,7 @@ function createAnalyticsClient({
|
|
|
165
168
|
headers,
|
|
166
169
|
data: body ? body : {}
|
|
167
170
|
};
|
|
168
|
-
return
|
|
171
|
+
return transporter.request(request, requestOptions);
|
|
169
172
|
},
|
|
170
173
|
/**
|
|
171
174
|
* This method allow you to send requests to the Algolia REST API.
|
|
@@ -190,7 +193,7 @@ function createAnalyticsClient({
|
|
|
190
193
|
headers,
|
|
191
194
|
data: body ? body : {}
|
|
192
195
|
};
|
|
193
|
-
return
|
|
196
|
+
return transporter.request(request, requestOptions);
|
|
194
197
|
},
|
|
195
198
|
/**
|
|
196
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.
|
|
@@ -230,7 +233,7 @@ function createAnalyticsClient({
|
|
|
230
233
|
queryParameters,
|
|
231
234
|
headers
|
|
232
235
|
};
|
|
233
|
-
return
|
|
236
|
+
return transporter.request(request, requestOptions);
|
|
234
237
|
},
|
|
235
238
|
/**
|
|
236
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.
|
|
@@ -270,7 +273,7 @@ function createAnalyticsClient({
|
|
|
270
273
|
queryParameters,
|
|
271
274
|
headers
|
|
272
275
|
};
|
|
273
|
-
return
|
|
276
|
+
return transporter.request(request, requestOptions);
|
|
274
277
|
},
|
|
275
278
|
/**
|
|
276
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.
|
|
@@ -310,7 +313,7 @@ function createAnalyticsClient({
|
|
|
310
313
|
queryParameters,
|
|
311
314
|
headers
|
|
312
315
|
};
|
|
313
|
-
return
|
|
316
|
+
return transporter.request(request, requestOptions);
|
|
314
317
|
},
|
|
315
318
|
/**
|
|
316
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.
|
|
@@ -350,7 +353,7 @@ function createAnalyticsClient({
|
|
|
350
353
|
queryParameters,
|
|
351
354
|
headers
|
|
352
355
|
};
|
|
353
|
-
return
|
|
356
|
+
return transporter.request(request, requestOptions);
|
|
354
357
|
},
|
|
355
358
|
/**
|
|
356
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.
|
|
@@ -390,7 +393,7 @@ function createAnalyticsClient({
|
|
|
390
393
|
queryParameters,
|
|
391
394
|
headers
|
|
392
395
|
};
|
|
393
|
-
return
|
|
396
|
+
return transporter.request(request, requestOptions);
|
|
394
397
|
},
|
|
395
398
|
/**
|
|
396
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.
|
|
@@ -430,7 +433,7 @@ function createAnalyticsClient({
|
|
|
430
433
|
queryParameters,
|
|
431
434
|
headers
|
|
432
435
|
};
|
|
433
|
-
return
|
|
436
|
+
return transporter.request(request, requestOptions);
|
|
434
437
|
},
|
|
435
438
|
/**
|
|
436
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.
|
|
@@ -470,7 +473,7 @@ function createAnalyticsClient({
|
|
|
470
473
|
queryParameters,
|
|
471
474
|
headers
|
|
472
475
|
};
|
|
473
|
-
return
|
|
476
|
+
return transporter.request(request, requestOptions);
|
|
474
477
|
},
|
|
475
478
|
/**
|
|
476
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.
|
|
@@ -510,7 +513,7 @@ function createAnalyticsClient({
|
|
|
510
513
|
queryParameters,
|
|
511
514
|
headers
|
|
512
515
|
};
|
|
513
|
-
return
|
|
516
|
+
return transporter.request(request, requestOptions);
|
|
514
517
|
},
|
|
515
518
|
/**
|
|
516
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.
|
|
@@ -550,7 +553,7 @@ function createAnalyticsClient({
|
|
|
550
553
|
queryParameters,
|
|
551
554
|
headers
|
|
552
555
|
};
|
|
553
|
-
return
|
|
556
|
+
return transporter.request(request, requestOptions);
|
|
554
557
|
},
|
|
555
558
|
/**
|
|
556
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.
|
|
@@ -590,7 +593,7 @@ function createAnalyticsClient({
|
|
|
590
593
|
queryParameters,
|
|
591
594
|
headers
|
|
592
595
|
};
|
|
593
|
-
return
|
|
596
|
+
return transporter.request(request, requestOptions);
|
|
594
597
|
},
|
|
595
598
|
/**
|
|
596
599
|
* Retrieves the most popular searches that didn\'t lead to any clicks, from the 1,000 most frequent searches.
|
|
@@ -638,7 +641,7 @@ function createAnalyticsClient({
|
|
|
638
641
|
queryParameters,
|
|
639
642
|
headers
|
|
640
643
|
};
|
|
641
|
-
return
|
|
644
|
+
return transporter.request(request, requestOptions);
|
|
642
645
|
},
|
|
643
646
|
/**
|
|
644
647
|
* Retrieves the most popular searches that didn\'t return any results.
|
|
@@ -686,7 +689,7 @@ function createAnalyticsClient({
|
|
|
686
689
|
queryParameters,
|
|
687
690
|
headers
|
|
688
691
|
};
|
|
689
|
-
return
|
|
692
|
+
return transporter.request(request, requestOptions);
|
|
690
693
|
},
|
|
691
694
|
/**
|
|
692
695
|
* Retrieves the time when the Analytics data for the specified index was last updated. The Analytics data is updated every 5 minutes.
|
|
@@ -714,7 +717,7 @@ function createAnalyticsClient({
|
|
|
714
717
|
queryParameters,
|
|
715
718
|
headers
|
|
716
719
|
};
|
|
717
|
-
return
|
|
720
|
+
return transporter.request(request, requestOptions);
|
|
718
721
|
},
|
|
719
722
|
/**
|
|
720
723
|
* Retrieves the countries with the most searches to your index.
|
|
@@ -762,7 +765,7 @@ function createAnalyticsClient({
|
|
|
762
765
|
queryParameters,
|
|
763
766
|
headers
|
|
764
767
|
};
|
|
765
|
-
return
|
|
768
|
+
return transporter.request(request, requestOptions);
|
|
766
769
|
},
|
|
767
770
|
/**
|
|
768
771
|
* Retrieves the most frequently used filter attributes. These are attributes of your records that you included in the `attributesForFaceting` setting.
|
|
@@ -814,7 +817,7 @@ function createAnalyticsClient({
|
|
|
814
817
|
queryParameters,
|
|
815
818
|
headers
|
|
816
819
|
};
|
|
817
|
-
return
|
|
820
|
+
return transporter.request(request, requestOptions);
|
|
818
821
|
},
|
|
819
822
|
/**
|
|
820
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.
|
|
@@ -870,7 +873,7 @@ function createAnalyticsClient({
|
|
|
870
873
|
queryParameters,
|
|
871
874
|
headers
|
|
872
875
|
};
|
|
873
|
-
return
|
|
876
|
+
return transporter.request(request, requestOptions);
|
|
874
877
|
},
|
|
875
878
|
/**
|
|
876
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.
|
|
@@ -922,7 +925,7 @@ function createAnalyticsClient({
|
|
|
922
925
|
queryParameters,
|
|
923
926
|
headers
|
|
924
927
|
};
|
|
925
|
-
return
|
|
928
|
+
return transporter.request(request, requestOptions);
|
|
926
929
|
},
|
|
927
930
|
/**
|
|
928
931
|
* Retrieves the object IDs of the most frequent search results.
|
|
@@ -982,7 +985,7 @@ function createAnalyticsClient({
|
|
|
982
985
|
queryParameters,
|
|
983
986
|
headers
|
|
984
987
|
};
|
|
985
|
-
return
|
|
988
|
+
return transporter.request(request, requestOptions);
|
|
986
989
|
},
|
|
987
990
|
/**
|
|
988
991
|
* Returns the most popular search terms.
|
|
@@ -1057,7 +1060,7 @@ function createAnalyticsClient({
|
|
|
1057
1060
|
queryParameters,
|
|
1058
1061
|
headers
|
|
1059
1062
|
};
|
|
1060
|
-
return
|
|
1063
|
+
return transporter.request(request, requestOptions);
|
|
1061
1064
|
},
|
|
1062
1065
|
/**
|
|
1063
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.
|
|
@@ -1097,7 +1100,7 @@ function createAnalyticsClient({
|
|
|
1097
1100
|
queryParameters,
|
|
1098
1101
|
headers
|
|
1099
1102
|
};
|
|
1100
|
-
return
|
|
1103
|
+
return transporter.request(request, requestOptions);
|
|
1101
1104
|
}
|
|
1102
1105
|
};
|
|
1103
1106
|
}
|