@ezmar/yandex-metric-parser-lib 0.1.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/LICENSE +21 -0
- package/README.md +213 -0
- package/dist/index.cjs +2790 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +999 -0
- package/dist/index.d.ts +999 -0
- package/dist/index.js +2707 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,2790 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/index.ts
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
|
+
AuthError: () => AuthError,
|
|
24
|
+
CounterLookupError: () => CounterLookupError,
|
|
25
|
+
DEFAULT_BASE_URL: () => DEFAULT_BASE_URL,
|
|
26
|
+
DEPRECATED_ATTRIBUTIONS: () => DEPRECATED_ATTRIBUTIONS,
|
|
27
|
+
DIM: () => DIM,
|
|
28
|
+
DIMENSION_IDS: () => DIMENSION_IDS,
|
|
29
|
+
InvalidRequestError: () => InvalidRequestError,
|
|
30
|
+
LIMITS: () => LIMITS,
|
|
31
|
+
MAX_TIMELINE_ROWS: () => MAX_TIMELINE_ROWS,
|
|
32
|
+
METRIC: () => METRIC,
|
|
33
|
+
METRIC_IDS: () => METRIC_IDS,
|
|
34
|
+
ManagementApi: () => ManagementApi,
|
|
35
|
+
MetrikaError: () => MetrikaError,
|
|
36
|
+
MetrikaHttpClient: () => MetrikaHttpClient,
|
|
37
|
+
NotFoundError: () => NotFoundError,
|
|
38
|
+
PRESET_IDS: () => PRESET_IDS,
|
|
39
|
+
PRIVACY_THRESHOLD_USERS: () => PRIVACY_THRESHOLD_USERS,
|
|
40
|
+
QuotaError: () => QuotaError,
|
|
41
|
+
RateLimiter: () => RateLimiter,
|
|
42
|
+
ReportsApi: () => ReportsApi,
|
|
43
|
+
RequestValidationError: () => RequestValidationError,
|
|
44
|
+
SETTLED_LAG_DAYS: () => SETTLED_LAG_DAYS,
|
|
45
|
+
ServerError: () => ServerError,
|
|
46
|
+
USED_DIMENSIONS: () => USED_DIMENSIONS,
|
|
47
|
+
USED_METRICS: () => USED_METRICS,
|
|
48
|
+
USED_PRESETS: () => USED_PRESETS,
|
|
49
|
+
YandexMetrika: () => YandexMetrika,
|
|
50
|
+
aggregateDirectKeywords: () => aggregateDirectKeywords,
|
|
51
|
+
andFilters: () => andFilters,
|
|
52
|
+
buildUrl: () => buildUrl,
|
|
53
|
+
consoleWarningHandler: () => consoleWarningHandler,
|
|
54
|
+
contractParsedAt: () => contractParsedAt,
|
|
55
|
+
contractSourceSha256: () => contractSourceSha256,
|
|
56
|
+
contractVersion: () => contractVersion,
|
|
57
|
+
getDirectKeywordsByVisits: () => getDirectKeywordsByVisits,
|
|
58
|
+
getDirectSearchPhraseCost: () => getDirectSearchPhraseCost,
|
|
59
|
+
getOrganicSearchPhrases: () => getOrganicSearchPhrases,
|
|
60
|
+
getPhraseLandingMap: () => getPhraseLandingMap,
|
|
61
|
+
getPhraseTimeline: () => getPhraseTimeline,
|
|
62
|
+
hasDimension: () => hasDimension,
|
|
63
|
+
hasMetric: () => hasMetric,
|
|
64
|
+
hasPreset: () => hasPreset,
|
|
65
|
+
inspectResponse: () => inspectResponse,
|
|
66
|
+
isBelowPrivacyThreshold: () => isBelowPrivacyThreshold,
|
|
67
|
+
isRetryable: () => isRetryable,
|
|
68
|
+
mergeKeywords: () => mergeKeywords,
|
|
69
|
+
mergeMeta: () => mergeMeta,
|
|
70
|
+
mergeQuality: () => mergeQuality,
|
|
71
|
+
namespaceOf: () => namespaceOf,
|
|
72
|
+
normalizePhrase: () => normalizePhrase,
|
|
73
|
+
organicFilters: () => organicFilters,
|
|
74
|
+
qualityOf: () => qualityOf,
|
|
75
|
+
settledRange: () => settledRange,
|
|
76
|
+
toContractForm: () => toContractForm,
|
|
77
|
+
toMetrikaError: () => toMetrikaError,
|
|
78
|
+
toQueryParams: () => toQueryParams,
|
|
79
|
+
validateQuery: () => validateQuery
|
|
80
|
+
});
|
|
81
|
+
module.exports = __toCommonJS(index_exports);
|
|
82
|
+
|
|
83
|
+
// src/contract/registry.generated.ts
|
|
84
|
+
var contractVersion = "5695d8903f6d";
|
|
85
|
+
var contractSourceSha256 = "5695d8903f6d252cdd95f058ed3b5984815fe96a215bbd6c23db3e349d4eb784";
|
|
86
|
+
var contractParsedAt = "2026-09-05T13:29:26.759Z";
|
|
87
|
+
var DIMENSION_IDS = /* @__PURE__ */ new Set([
|
|
88
|
+
"ym:ad:<attribution>Currency",
|
|
89
|
+
"ym:ad:<attribution>DirectBanner",
|
|
90
|
+
"ym:ad:<attribution>DirectBannerGroup",
|
|
91
|
+
"ym:ad:<attribution>DirectConditionType",
|
|
92
|
+
"ym:ad:<attribution>DirectOrder",
|
|
93
|
+
"ym:ad:<attribution>DirectPhraseOrCond",
|
|
94
|
+
"ym:ad:<attribution>DirectPlatform",
|
|
95
|
+
"ym:ad:<attribution>DirectPlatformType",
|
|
96
|
+
"ym:ad:<attribution>DirectSearchPhrase",
|
|
97
|
+
"ym:ad:<attribution>DisplayCampaign",
|
|
98
|
+
"ym:ad:ageInterval",
|
|
99
|
+
"ym:ad:gender",
|
|
100
|
+
"ym:ad:regionArea",
|
|
101
|
+
"ym:ad:regionCity",
|
|
102
|
+
"ym:ad:regionCitySize",
|
|
103
|
+
"ym:ad:regionContinent",
|
|
104
|
+
"ym:ad:regionCountry",
|
|
105
|
+
"ym:ad:regionDistrict",
|
|
106
|
+
"ym:dl:ageInterval",
|
|
107
|
+
"ym:dl:browser",
|
|
108
|
+
"ym:dl:browserAndVersion",
|
|
109
|
+
"ym:dl:browserAndVersionMajor",
|
|
110
|
+
"ym:dl:browserCountry",
|
|
111
|
+
"ym:dl:browserDate",
|
|
112
|
+
"ym:dl:browserDatePeriod<group>",
|
|
113
|
+
"ym:dl:browserDateTime",
|
|
114
|
+
"ym:dl:browserDayOfMonth",
|
|
115
|
+
"ym:dl:browserDayOfWeek",
|
|
116
|
+
"ym:dl:browserDekaminute",
|
|
117
|
+
"ym:dl:browserEngine",
|
|
118
|
+
"ym:dl:browserEngineVersion1",
|
|
119
|
+
"ym:dl:browserEngineVersion2",
|
|
120
|
+
"ym:dl:browserEngineVersion3",
|
|
121
|
+
"ym:dl:browserEngineVersion4",
|
|
122
|
+
"ym:dl:browserHour",
|
|
123
|
+
"ym:dl:browserHourMinute",
|
|
124
|
+
"ym:dl:browserLanguage",
|
|
125
|
+
"ym:dl:browserMinute",
|
|
126
|
+
"ym:dl:browserMonth",
|
|
127
|
+
"ym:dl:browserStartOfDekaminute",
|
|
128
|
+
"ym:dl:browserStartOfHour",
|
|
129
|
+
"ym:dl:browserStartOfMinute",
|
|
130
|
+
"ym:dl:browserStartOfMonth",
|
|
131
|
+
"ym:dl:browserStartOfQuarter",
|
|
132
|
+
"ym:dl:browserStartOfWeek",
|
|
133
|
+
"ym:dl:browserStartOfYear",
|
|
134
|
+
"ym:dl:browserYear",
|
|
135
|
+
"ym:dl:clientTimeZone",
|
|
136
|
+
"ym:dl:cookieEnabled",
|
|
137
|
+
"ym:dl:date",
|
|
138
|
+
"ym:dl:datePeriod<group>",
|
|
139
|
+
"ym:dl:dateTime",
|
|
140
|
+
"ym:dl:dayOfMonth",
|
|
141
|
+
"ym:dl:dayOfWeek",
|
|
142
|
+
"ym:dl:dekaminute",
|
|
143
|
+
"ym:dl:deviceCategory",
|
|
144
|
+
"ym:dl:downloadURL",
|
|
145
|
+
"ym:dl:from",
|
|
146
|
+
"ym:dl:gender",
|
|
147
|
+
"ym:dl:hasAdBlocker",
|
|
148
|
+
"ym:dl:hasGCLID",
|
|
149
|
+
"ym:dl:hasSBCLID",
|
|
150
|
+
"ym:dl:hour",
|
|
151
|
+
"ym:dl:hourMinute",
|
|
152
|
+
"ym:dl:ipAddress",
|
|
153
|
+
"ym:dl:javascriptEnabled",
|
|
154
|
+
"ym:dl:minute",
|
|
155
|
+
"ym:dl:mobilePhone",
|
|
156
|
+
"ym:dl:mobilePhoneModel",
|
|
157
|
+
"ym:dl:month",
|
|
158
|
+
"ym:dl:openstatAd",
|
|
159
|
+
"ym:dl:openstatCampaign",
|
|
160
|
+
"ym:dl:openstatService",
|
|
161
|
+
"ym:dl:openstatSource",
|
|
162
|
+
"ym:dl:operatingSystem",
|
|
163
|
+
"ym:dl:operatingSystemRoot",
|
|
164
|
+
"ym:dl:pageURL",
|
|
165
|
+
"ym:dl:physicalScreenHeight",
|
|
166
|
+
"ym:dl:physicalScreenResolution",
|
|
167
|
+
"ym:dl:physicalScreenWidth",
|
|
168
|
+
"ym:dl:regionArea",
|
|
169
|
+
"ym:dl:regionCity",
|
|
170
|
+
"ym:dl:regionCitySize",
|
|
171
|
+
"ym:dl:regionContinent",
|
|
172
|
+
"ym:dl:regionCountry",
|
|
173
|
+
"ym:dl:regionDistrict",
|
|
174
|
+
"ym:dl:SBCLID",
|
|
175
|
+
"ym:dl:screenColors",
|
|
176
|
+
"ym:dl:screenFormat",
|
|
177
|
+
"ym:dl:screenHeight",
|
|
178
|
+
"ym:dl:screenOrientation",
|
|
179
|
+
"ym:dl:screenResolution",
|
|
180
|
+
"ym:dl:screenWidth",
|
|
181
|
+
"ym:dl:startOfDekaminute",
|
|
182
|
+
"ym:dl:startOfHour",
|
|
183
|
+
"ym:dl:startOfMinute",
|
|
184
|
+
"ym:dl:startOfMonth",
|
|
185
|
+
"ym:dl:startOfQuarter",
|
|
186
|
+
"ym:dl:startOfWeek",
|
|
187
|
+
"ym:dl:startOfYear",
|
|
188
|
+
"ym:dl:thirdPartyCookieEnabled",
|
|
189
|
+
"ym:dl:title",
|
|
190
|
+
"ym:dl:URL",
|
|
191
|
+
"ym:dl:URLDomain",
|
|
192
|
+
"ym:dl:URLParamName",
|
|
193
|
+
"ym:dl:URLParamNameAndValue",
|
|
194
|
+
"ym:dl:URLParamValue",
|
|
195
|
+
"ym:dl:URLPath",
|
|
196
|
+
"ym:dl:URLPathFull",
|
|
197
|
+
"ym:dl:URLPathLevel1",
|
|
198
|
+
"ym:dl:URLPathLevel2",
|
|
199
|
+
"ym:dl:URLPathLevel3",
|
|
200
|
+
"ym:dl:URLPathLevel4",
|
|
201
|
+
"ym:dl:URLPathLevel5",
|
|
202
|
+
"ym:dl:URLProto",
|
|
203
|
+
"ym:dl:UTMCampaign",
|
|
204
|
+
"ym:dl:UTMContent",
|
|
205
|
+
"ym:dl:UTMMedium",
|
|
206
|
+
"ym:dl:UTMSource",
|
|
207
|
+
"ym:dl:UTMTerm",
|
|
208
|
+
"ym:dl:windowClientArea",
|
|
209
|
+
"ym:dl:windowClientHeight",
|
|
210
|
+
"ym:dl:windowClientWidth",
|
|
211
|
+
"ym:dl:year",
|
|
212
|
+
"ym:ep:actionGoal",
|
|
213
|
+
"ym:ep:ageInterval",
|
|
214
|
+
"ym:ep:browser",
|
|
215
|
+
"ym:ep:browserAndVersion",
|
|
216
|
+
"ym:ep:browserAndVersionMajor",
|
|
217
|
+
"ym:ep:browserDate",
|
|
218
|
+
"ym:ep:browserDatePeriod<group>",
|
|
219
|
+
"ym:ep:browserDateTime",
|
|
220
|
+
"ym:ep:browserDayOfMonth",
|
|
221
|
+
"ym:ep:browserDayOfWeek",
|
|
222
|
+
"ym:ep:browserDekaminute",
|
|
223
|
+
"ym:ep:browserEngine",
|
|
224
|
+
"ym:ep:browserEngineVersion1",
|
|
225
|
+
"ym:ep:browserEngineVersion2",
|
|
226
|
+
"ym:ep:browserEngineVersion3",
|
|
227
|
+
"ym:ep:browserEngineVersion4",
|
|
228
|
+
"ym:ep:browserHour",
|
|
229
|
+
"ym:ep:browserHourMinute",
|
|
230
|
+
"ym:ep:browserMinute",
|
|
231
|
+
"ym:ep:browserMonth",
|
|
232
|
+
"ym:ep:browserStartOfDekaminute",
|
|
233
|
+
"ym:ep:browserStartOfHour",
|
|
234
|
+
"ym:ep:browserStartOfMinute",
|
|
235
|
+
"ym:ep:browserStartOfMonth",
|
|
236
|
+
"ym:ep:browserStartOfQuarter",
|
|
237
|
+
"ym:ep:browserStartOfWeek",
|
|
238
|
+
"ym:ep:browserStartOfYear",
|
|
239
|
+
"ym:ep:browserYear",
|
|
240
|
+
"ym:ep:cookieEnabled",
|
|
241
|
+
"ym:ep:date",
|
|
242
|
+
"ym:ep:datePeriod<group>",
|
|
243
|
+
"ym:ep:dateTime",
|
|
244
|
+
"ym:ep:dayOfMonth",
|
|
245
|
+
"ym:ep:dayOfWeek",
|
|
246
|
+
"ym:ep:dekaminute",
|
|
247
|
+
"ym:ep:deviceCategory",
|
|
248
|
+
"ym:ep:eventParamsLevel1",
|
|
249
|
+
"ym:ep:eventParamsLevel10",
|
|
250
|
+
"ym:ep:eventParamsLevel2",
|
|
251
|
+
"ym:ep:eventParamsLevel3",
|
|
252
|
+
"ym:ep:eventParamsLevel4",
|
|
253
|
+
"ym:ep:eventParamsLevel5",
|
|
254
|
+
"ym:ep:eventParamsLevel6",
|
|
255
|
+
"ym:ep:eventParamsLevel7",
|
|
256
|
+
"ym:ep:eventParamsLevel8",
|
|
257
|
+
"ym:ep:eventParamsLevel9",
|
|
258
|
+
"ym:ep:eventURL",
|
|
259
|
+
"ym:ep:eventURLDomain",
|
|
260
|
+
"ym:ep:eventURLParamName",
|
|
261
|
+
"ym:ep:eventURLParamNameAndValue",
|
|
262
|
+
"ym:ep:eventURLParamValue",
|
|
263
|
+
"ym:ep:eventURLPath",
|
|
264
|
+
"ym:ep:eventURLPathFull",
|
|
265
|
+
"ym:ep:eventURLPathLevel1",
|
|
266
|
+
"ym:ep:eventURLPathLevel2",
|
|
267
|
+
"ym:ep:eventURLPathLevel3",
|
|
268
|
+
"ym:ep:eventURLPathLevel4",
|
|
269
|
+
"ym:ep:eventURLPathLevel5",
|
|
270
|
+
"ym:ep:eventURLProto",
|
|
271
|
+
"ym:ep:gender",
|
|
272
|
+
"ym:ep:hasAdBlocker",
|
|
273
|
+
"ym:ep:hour",
|
|
274
|
+
"ym:ep:hourMinute",
|
|
275
|
+
"ym:ep:ipAddress",
|
|
276
|
+
"ym:ep:javascriptEnabled",
|
|
277
|
+
"ym:ep:minute",
|
|
278
|
+
"ym:ep:mobilePhone",
|
|
279
|
+
"ym:ep:mobilePhoneModel",
|
|
280
|
+
"ym:ep:month",
|
|
281
|
+
"ym:ep:operatingSystem",
|
|
282
|
+
"ym:ep:operatingSystemRoot",
|
|
283
|
+
"ym:ep:physicalScreenHeight",
|
|
284
|
+
"ym:ep:physicalScreenResolution",
|
|
285
|
+
"ym:ep:physicalScreenWidth",
|
|
286
|
+
"ym:ep:regionArea",
|
|
287
|
+
"ym:ep:regionCity",
|
|
288
|
+
"ym:ep:regionCitySize",
|
|
289
|
+
"ym:ep:regionContinent",
|
|
290
|
+
"ym:ep:regionCountry",
|
|
291
|
+
"ym:ep:regionDistrict",
|
|
292
|
+
"ym:ep:screenColors",
|
|
293
|
+
"ym:ep:screenFormat",
|
|
294
|
+
"ym:ep:screenHeight",
|
|
295
|
+
"ym:ep:screenOrientation",
|
|
296
|
+
"ym:ep:screenResolution",
|
|
297
|
+
"ym:ep:screenWidth",
|
|
298
|
+
"ym:ep:startOfDekaminute",
|
|
299
|
+
"ym:ep:startOfHour",
|
|
300
|
+
"ym:ep:startOfMinute",
|
|
301
|
+
"ym:ep:startOfMonth",
|
|
302
|
+
"ym:ep:startOfQuarter",
|
|
303
|
+
"ym:ep:startOfWeek",
|
|
304
|
+
"ym:ep:startOfYear",
|
|
305
|
+
"ym:ep:thirdPartyCookieEnabled",
|
|
306
|
+
"ym:ep:windowClientArea",
|
|
307
|
+
"ym:ep:windowClientHeight",
|
|
308
|
+
"ym:ep:windowClientWidth",
|
|
309
|
+
"ym:ep:year",
|
|
310
|
+
"ym:ev:<attribution>ExpenseCampaign",
|
|
311
|
+
"ym:ev:<attribution>ExpenseContent",
|
|
312
|
+
"ym:ev:<attribution>ExpenseMedium",
|
|
313
|
+
"ym:ev:<attribution>ExpenseSource",
|
|
314
|
+
"ym:ev:<attribution>ExpenseTerm",
|
|
315
|
+
"ym:ev:<attribution>SourceEngine",
|
|
316
|
+
"ym:ev:<attribution>TrafficSource",
|
|
317
|
+
"ym:pv:ageInterval",
|
|
318
|
+
"ym:pv:browser",
|
|
319
|
+
"ym:pv:browserAndVersion",
|
|
320
|
+
"ym:pv:browserAndVersionMajor",
|
|
321
|
+
"ym:pv:browserCountry",
|
|
322
|
+
"ym:pv:browserDate",
|
|
323
|
+
"ym:pv:browserDatePeriod<group>",
|
|
324
|
+
"ym:pv:browserDateTime",
|
|
325
|
+
"ym:pv:browserDayOfMonth",
|
|
326
|
+
"ym:pv:browserDayOfWeek",
|
|
327
|
+
"ym:pv:browserDekaminute",
|
|
328
|
+
"ym:pv:browserEngine",
|
|
329
|
+
"ym:pv:browserEngineVersion1",
|
|
330
|
+
"ym:pv:browserEngineVersion2",
|
|
331
|
+
"ym:pv:browserEngineVersion3",
|
|
332
|
+
"ym:pv:browserEngineVersion4",
|
|
333
|
+
"ym:pv:browserHour",
|
|
334
|
+
"ym:pv:browserHourMinute",
|
|
335
|
+
"ym:pv:browserLanguage",
|
|
336
|
+
"ym:pv:browserMinute",
|
|
337
|
+
"ym:pv:browserMonth",
|
|
338
|
+
"ym:pv:browserStartOfDekaminute",
|
|
339
|
+
"ym:pv:browserStartOfHour",
|
|
340
|
+
"ym:pv:browserStartOfMinute",
|
|
341
|
+
"ym:pv:browserStartOfMonth",
|
|
342
|
+
"ym:pv:browserStartOfQuarter",
|
|
343
|
+
"ym:pv:browserStartOfWeek",
|
|
344
|
+
"ym:pv:browserStartOfYear",
|
|
345
|
+
"ym:pv:browserYear",
|
|
346
|
+
"ym:pv:clientTimeZone",
|
|
347
|
+
"ym:pv:cookieEnabled",
|
|
348
|
+
"ym:pv:counterID",
|
|
349
|
+
"ym:pv:date",
|
|
350
|
+
"ym:pv:datePeriod<group>",
|
|
351
|
+
"ym:pv:dateTime",
|
|
352
|
+
"ym:pv:dayOfMonth",
|
|
353
|
+
"ym:pv:dayOfWeek",
|
|
354
|
+
"ym:pv:dekaminute",
|
|
355
|
+
"ym:pv:deviceCategory",
|
|
356
|
+
"ym:pv:from",
|
|
357
|
+
"ym:pv:gender",
|
|
358
|
+
"ym:pv:hasAdBlocker",
|
|
359
|
+
"ym:pv:hasGCLID",
|
|
360
|
+
"ym:pv:hasSBCLID",
|
|
361
|
+
"ym:pv:hour",
|
|
362
|
+
"ym:pv:hourMinute",
|
|
363
|
+
"ym:pv:ipAddress",
|
|
364
|
+
"ym:pv:isTurboPage",
|
|
365
|
+
"ym:pv:javascriptEnabled",
|
|
366
|
+
"ym:pv:minute",
|
|
367
|
+
"ym:pv:mobilePhone",
|
|
368
|
+
"ym:pv:mobilePhoneModel",
|
|
369
|
+
"ym:pv:month",
|
|
370
|
+
"ym:pv:openstatAd",
|
|
371
|
+
"ym:pv:openstatCampaign",
|
|
372
|
+
"ym:pv:openstatService",
|
|
373
|
+
"ym:pv:openstatSource",
|
|
374
|
+
"ym:pv:operatingSystem",
|
|
375
|
+
"ym:pv:operatingSystemRoot",
|
|
376
|
+
"ym:pv:physicalScreenHeight",
|
|
377
|
+
"ym:pv:physicalScreenResolution",
|
|
378
|
+
"ym:pv:physicalScreenWidth",
|
|
379
|
+
"ym:pv:referer",
|
|
380
|
+
"ym:pv:refererDomain",
|
|
381
|
+
"ym:pv:refererPath",
|
|
382
|
+
"ym:pv:refererPathFull",
|
|
383
|
+
"ym:pv:refererPathLevel1",
|
|
384
|
+
"ym:pv:refererPathLevel2",
|
|
385
|
+
"ym:pv:refererPathLevel3",
|
|
386
|
+
"ym:pv:refererPathLevel4",
|
|
387
|
+
"ym:pv:refererPathLevel5",
|
|
388
|
+
"ym:pv:refererProto",
|
|
389
|
+
"ym:pv:regionArea",
|
|
390
|
+
"ym:pv:regionCity",
|
|
391
|
+
"ym:pv:regionCitySize",
|
|
392
|
+
"ym:pv:regionContinent",
|
|
393
|
+
"ym:pv:regionCountry",
|
|
394
|
+
"ym:pv:regionDistrict",
|
|
395
|
+
"ym:pv:SBCLID",
|
|
396
|
+
"ym:pv:screenColors",
|
|
397
|
+
"ym:pv:screenFormat",
|
|
398
|
+
"ym:pv:screenHeight",
|
|
399
|
+
"ym:pv:screenOrientation",
|
|
400
|
+
"ym:pv:screenResolution",
|
|
401
|
+
"ym:pv:screenWidth",
|
|
402
|
+
"ym:pv:startOfDekaminute",
|
|
403
|
+
"ym:pv:startOfHour",
|
|
404
|
+
"ym:pv:startOfMinute",
|
|
405
|
+
"ym:pv:startOfMonth",
|
|
406
|
+
"ym:pv:startOfQuarter",
|
|
407
|
+
"ym:pv:startOfWeek",
|
|
408
|
+
"ym:pv:startOfYear",
|
|
409
|
+
"ym:pv:thirdPartyCookieEnabled",
|
|
410
|
+
"ym:pv:title",
|
|
411
|
+
"ym:pv:URL",
|
|
412
|
+
"ym:pv:URLDomain",
|
|
413
|
+
"ym:pv:URLParamName",
|
|
414
|
+
"ym:pv:URLParamNameAndValue",
|
|
415
|
+
"ym:pv:URLParamValue",
|
|
416
|
+
"ym:pv:URLPath",
|
|
417
|
+
"ym:pv:URLPathFull",
|
|
418
|
+
"ym:pv:URLPathLevel1",
|
|
419
|
+
"ym:pv:URLPathLevel2",
|
|
420
|
+
"ym:pv:URLPathLevel3",
|
|
421
|
+
"ym:pv:URLPathLevel4",
|
|
422
|
+
"ym:pv:URLPathLevel5",
|
|
423
|
+
"ym:pv:URLProto",
|
|
424
|
+
"ym:pv:UTMCampaign",
|
|
425
|
+
"ym:pv:UTMContent",
|
|
426
|
+
"ym:pv:UTMMedium",
|
|
427
|
+
"ym:pv:UTMSource",
|
|
428
|
+
"ym:pv:UTMTerm",
|
|
429
|
+
"ym:pv:windowClientArea",
|
|
430
|
+
"ym:pv:windowClientHeight",
|
|
431
|
+
"ym:pv:windowClientWidth",
|
|
432
|
+
"ym:pv:year",
|
|
433
|
+
"ym:s:<attribution>AdvEngine",
|
|
434
|
+
"ym:s:<attribution>Currency",
|
|
435
|
+
"ym:s:<attribution>DirectBannerGroup",
|
|
436
|
+
"ym:s:<attribution>DirectClickBanner",
|
|
437
|
+
"ym:s:<attribution>DirectClickOrder",
|
|
438
|
+
"ym:s:<attribution>DirectConditionType",
|
|
439
|
+
"ym:s:<attribution>DirectID",
|
|
440
|
+
"ym:s:<attribution>DirectPhraseOrCond",
|
|
441
|
+
"ym:s:<attribution>DirectPlatform",
|
|
442
|
+
"ym:s:<attribution>DirectPlatformType",
|
|
443
|
+
"ym:s:<attribution>DirectSearchPhrase",
|
|
444
|
+
"ym:s:<attribution>DisplayCampaign",
|
|
445
|
+
"ym:s:<attribution>From",
|
|
446
|
+
"ym:s:<attribution>HasGCLID",
|
|
447
|
+
"ym:s:<attribution>HasSBCLID",
|
|
448
|
+
"ym:s:<attribution>Messenger",
|
|
449
|
+
"ym:s:<attribution>OpenstatAd",
|
|
450
|
+
"ym:s:<attribution>OpenstatCampaign",
|
|
451
|
+
"ym:s:<attribution>OpenstatService",
|
|
452
|
+
"ym:s:<attribution>OpenstatSource",
|
|
453
|
+
"ym:s:<attribution>QRCodeProvider",
|
|
454
|
+
"ym:s:<attribution>RecommendationSystem",
|
|
455
|
+
"ym:s:<attribution>ReferalSource",
|
|
456
|
+
"ym:s:<attribution>SBCLID",
|
|
457
|
+
"ym:s:<attribution>SearchEngineRoot",
|
|
458
|
+
"ym:s:<attribution>SearchPhrase",
|
|
459
|
+
"ym:s:<attribution>SocialNetwork",
|
|
460
|
+
"ym:s:<attribution>SocialNetworkProfile",
|
|
461
|
+
"ym:s:<attribution>SourceEngine",
|
|
462
|
+
"ym:s:<attribution>TrafficSource",
|
|
463
|
+
"ym:s:<attribution>UTMCampaign",
|
|
464
|
+
"ym:s:<attribution>UTMContent",
|
|
465
|
+
"ym:s:<attribution>UTMMedium",
|
|
466
|
+
"ym:s:<attribution>UTMSource",
|
|
467
|
+
"ym:s:<attribution>UTMTerm",
|
|
468
|
+
"ym:s:<attribution>YandexRythmDetailed",
|
|
469
|
+
"ym:s:adfoxBanner",
|
|
470
|
+
"ym:s:adfoxBannerType",
|
|
471
|
+
"ym:s:adfoxCampaign",
|
|
472
|
+
"ym:s:adfoxHeaderBidding",
|
|
473
|
+
"ym:s:adfoxLevel1",
|
|
474
|
+
"ym:s:adfoxLevel1Chained",
|
|
475
|
+
"ym:s:adfoxLevel2",
|
|
476
|
+
"ym:s:adfoxLevel2Chained",
|
|
477
|
+
"ym:s:adfoxLevel3Chained",
|
|
478
|
+
"ym:s:adfoxLevel4Chained",
|
|
479
|
+
"ym:s:adfoxOwner",
|
|
480
|
+
"ym:s:adfoxPlace",
|
|
481
|
+
"ym:s:adfoxPuidKey",
|
|
482
|
+
"ym:s:adfoxPuidValue",
|
|
483
|
+
"ym:s:adfoxSection",
|
|
484
|
+
"ym:s:adfoxSite",
|
|
485
|
+
"ym:s:adfoxUrlPathLevel1",
|
|
486
|
+
"ym:s:adfoxUrlPathLevel2",
|
|
487
|
+
"ym:s:adfoxUrlPathLevel3",
|
|
488
|
+
"ym:s:adfoxUrlPathLevel4",
|
|
489
|
+
"ym:s:adfoxYanImp",
|
|
490
|
+
"ym:s:adfoxYanPage",
|
|
491
|
+
"ym:s:ageInterval",
|
|
492
|
+
"ym:s:bounce",
|
|
493
|
+
"ym:s:browser",
|
|
494
|
+
"ym:s:browserAndVersion",
|
|
495
|
+
"ym:s:browserAndVersionMajor",
|
|
496
|
+
"ym:s:browserCountry",
|
|
497
|
+
"ym:s:browserDate",
|
|
498
|
+
"ym:s:browserDatePeriod<group>",
|
|
499
|
+
"ym:s:browserDateTime",
|
|
500
|
+
"ym:s:browserDayOfMonth",
|
|
501
|
+
"ym:s:browserDayOfWeek",
|
|
502
|
+
"ym:s:browserDekaminute",
|
|
503
|
+
"ym:s:browserEngine",
|
|
504
|
+
"ym:s:browserEngineVersion1",
|
|
505
|
+
"ym:s:browserEngineVersion2",
|
|
506
|
+
"ym:s:browserEngineVersion3",
|
|
507
|
+
"ym:s:browserEngineVersion4",
|
|
508
|
+
"ym:s:browserHour",
|
|
509
|
+
"ym:s:browserHourMinute",
|
|
510
|
+
"ym:s:browserLanguage",
|
|
511
|
+
"ym:s:browserMinute",
|
|
512
|
+
"ym:s:browserMonth",
|
|
513
|
+
"ym:s:browserStartOfDekaminute",
|
|
514
|
+
"ym:s:browserStartOfHour",
|
|
515
|
+
"ym:s:browserStartOfMinute",
|
|
516
|
+
"ym:s:browserStartOfMonth",
|
|
517
|
+
"ym:s:browserStartOfQuarter",
|
|
518
|
+
"ym:s:browserStartOfWeek",
|
|
519
|
+
"ym:s:browserStartOfYear",
|
|
520
|
+
"ym:s:browserYear",
|
|
521
|
+
"ym:s:clientID",
|
|
522
|
+
"ym:s:clientTimeZone",
|
|
523
|
+
"ym:s:cookieEnabled",
|
|
524
|
+
"ym:s:counterID",
|
|
525
|
+
"ym:s:date",
|
|
526
|
+
"ym:s:datePeriod<group>",
|
|
527
|
+
"ym:s:dateTime",
|
|
528
|
+
"ym:s:dayOfMonth",
|
|
529
|
+
"ym:s:dayOfWeek",
|
|
530
|
+
"ym:s:daysSinceFirstVisit",
|
|
531
|
+
"ym:s:daysSinceFirstVisitInterval",
|
|
532
|
+
"ym:s:daysSincePreviousVisit",
|
|
533
|
+
"ym:s:daysSincePreviousVisitInterval",
|
|
534
|
+
"ym:s:dekaminute",
|
|
535
|
+
"ym:s:deviceCategory",
|
|
536
|
+
"ym:s:endURL",
|
|
537
|
+
"ym:s:endURLDomain",
|
|
538
|
+
"ym:s:endURLPath",
|
|
539
|
+
"ym:s:endURLPathFull",
|
|
540
|
+
"ym:s:endURLPathLevel1",
|
|
541
|
+
"ym:s:endURLPathLevel2",
|
|
542
|
+
"ym:s:endURLPathLevel3",
|
|
543
|
+
"ym:s:endURLPathLevel4",
|
|
544
|
+
"ym:s:endURLPathLevel5",
|
|
545
|
+
"ym:s:endURLProto",
|
|
546
|
+
"ym:s:EPromotionCreative",
|
|
547
|
+
"ym:s:EPromotionCreativeSlot",
|
|
548
|
+
"ym:s:EPromotionEventURL",
|
|
549
|
+
"ym:s:EPromotionID",
|
|
550
|
+
"ym:s:EPromotionName",
|
|
551
|
+
"ym:s:EPromotionPosition",
|
|
552
|
+
"ym:s:experimentAB<experiment_ab>",
|
|
553
|
+
"ym:s:externalReferer",
|
|
554
|
+
"ym:s:externalRefererDomain",
|
|
555
|
+
"ym:s:externalRefererPath",
|
|
556
|
+
"ym:s:externalRefererPathFull",
|
|
557
|
+
"ym:s:externalRefererPathLevel1",
|
|
558
|
+
"ym:s:externalRefererPathLevel2",
|
|
559
|
+
"ym:s:externalRefererPathLevel3",
|
|
560
|
+
"ym:s:externalRefererPathLevel4",
|
|
561
|
+
"ym:s:externalRefererPathLevel5",
|
|
562
|
+
"ym:s:externalRefererProto",
|
|
563
|
+
"ym:s:firstVisitDate",
|
|
564
|
+
"ym:s:firstVisitDatePeriod<group>",
|
|
565
|
+
"ym:s:firstVisitDateTime",
|
|
566
|
+
"ym:s:firstVisitDayOfMonth",
|
|
567
|
+
"ym:s:firstVisitDayOfWeek",
|
|
568
|
+
"ym:s:firstVisitDekaminute",
|
|
569
|
+
"ym:s:firstVisitHour",
|
|
570
|
+
"ym:s:firstVisitHourMinute",
|
|
571
|
+
"ym:s:firstVisitMinute",
|
|
572
|
+
"ym:s:firstVisitMonth",
|
|
573
|
+
"ym:s:firstVisitStartOfDekaminute",
|
|
574
|
+
"ym:s:firstVisitStartOfHour",
|
|
575
|
+
"ym:s:firstVisitStartOfMinute",
|
|
576
|
+
"ym:s:firstVisitStartOfMonth",
|
|
577
|
+
"ym:s:firstVisitStartOfQuarter",
|
|
578
|
+
"ym:s:firstVisitStartOfWeek",
|
|
579
|
+
"ym:s:firstVisitStartOfYear",
|
|
580
|
+
"ym:s:firstVisitYear",
|
|
581
|
+
"ym:s:gender",
|
|
582
|
+
"ym:s:goal",
|
|
583
|
+
"ym:s:hasAdBlocker",
|
|
584
|
+
"ym:s:hour",
|
|
585
|
+
"ym:s:hourMinute",
|
|
586
|
+
"ym:s:interest",
|
|
587
|
+
"ym:s:interest2d1",
|
|
588
|
+
"ym:s:interest2d2",
|
|
589
|
+
"ym:s:interest2d3",
|
|
590
|
+
"ym:s:ipAddress",
|
|
591
|
+
"ym:s:isNewUser",
|
|
592
|
+
"ym:s:isRobot",
|
|
593
|
+
"ym:s:isRobotPro",
|
|
594
|
+
"ym:s:isTurboPage",
|
|
595
|
+
"ym:s:javascriptEnabled",
|
|
596
|
+
"ym:s:marketSearchPhrase",
|
|
597
|
+
"ym:s:minute",
|
|
598
|
+
"ym:s:mobilePhone",
|
|
599
|
+
"ym:s:mobilePhoneModel",
|
|
600
|
+
"ym:s:month",
|
|
601
|
+
"ym:s:offlineCallFirstTimeCaller",
|
|
602
|
+
"ym:s:offlineCallHoldDuration",
|
|
603
|
+
"ym:s:offlineCallMissed",
|
|
604
|
+
"ym:s:offlineCallTag",
|
|
605
|
+
"ym:s:offlineCallTalkDuration",
|
|
606
|
+
"ym:s:offlineChatAnswered",
|
|
607
|
+
"ym:s:offlineChatPlatform",
|
|
608
|
+
"ym:s:offlineChatTag",
|
|
609
|
+
"ym:s:operatingSystem",
|
|
610
|
+
"ym:s:operatingSystemRoot",
|
|
611
|
+
"ym:s:originalBounce",
|
|
612
|
+
"ym:s:originalPageViews",
|
|
613
|
+
"ym:s:originalVisitDuration",
|
|
614
|
+
"ym:s:originalVisitDurationInterval",
|
|
615
|
+
"ym:s:pageViews",
|
|
616
|
+
"ym:s:pageViewsInterval",
|
|
617
|
+
"ym:s:paramsLevel1",
|
|
618
|
+
"ym:s:paramsLevel10",
|
|
619
|
+
"ym:s:paramsLevel2",
|
|
620
|
+
"ym:s:paramsLevel3",
|
|
621
|
+
"ym:s:paramsLevel4",
|
|
622
|
+
"ym:s:paramsLevel5",
|
|
623
|
+
"ym:s:paramsLevel6",
|
|
624
|
+
"ym:s:paramsLevel7",
|
|
625
|
+
"ym:s:paramsLevel8",
|
|
626
|
+
"ym:s:paramsLevel9",
|
|
627
|
+
"ym:s:physicalScreenHeight",
|
|
628
|
+
"ym:s:physicalScreenResolution",
|
|
629
|
+
"ym:s:physicalScreenWidth",
|
|
630
|
+
"ym:s:PProductBrand",
|
|
631
|
+
"ym:s:PProductID",
|
|
632
|
+
"ym:s:PProductName",
|
|
633
|
+
"ym:s:previousVisitDate",
|
|
634
|
+
"ym:s:previousVisitDatePeriod<group>",
|
|
635
|
+
"ym:s:previousVisitDayOfMonth",
|
|
636
|
+
"ym:s:previousVisitDayOfWeek",
|
|
637
|
+
"ym:s:previousVisitMonth",
|
|
638
|
+
"ym:s:previousVisitStartOfMonth",
|
|
639
|
+
"ym:s:previousVisitStartOfQuarter",
|
|
640
|
+
"ym:s:previousVisitStartOfWeek",
|
|
641
|
+
"ym:s:previousVisitStartOfYear",
|
|
642
|
+
"ym:s:previousVisitYear",
|
|
643
|
+
"ym:s:productBrand",
|
|
644
|
+
"ym:s:productBrandCart",
|
|
645
|
+
"ym:s:productCategoryLevel1",
|
|
646
|
+
"ym:s:productCategoryLevel2",
|
|
647
|
+
"ym:s:productCategoryLevel3",
|
|
648
|
+
"ym:s:productCategoryLevel4",
|
|
649
|
+
"ym:s:productCategoryLevel5",
|
|
650
|
+
"ym:s:productCoupon",
|
|
651
|
+
"ym:s:productCurrency",
|
|
652
|
+
"ym:s:productDiscount",
|
|
653
|
+
"ym:s:productEventType",
|
|
654
|
+
"ym:s:productEventURL",
|
|
655
|
+
"ym:s:productID",
|
|
656
|
+
"ym:s:productIDCart",
|
|
657
|
+
"ym:s:productList",
|
|
658
|
+
"ym:s:productName",
|
|
659
|
+
"ym:s:productNameCart",
|
|
660
|
+
"ym:s:productPosition",
|
|
661
|
+
"ym:s:productPrice",
|
|
662
|
+
"ym:s:productSum",
|
|
663
|
+
"ym:s:productVariant",
|
|
664
|
+
"ym:s:publisherArticleAuthor",
|
|
665
|
+
"ym:s:publisherArticleFromTitle",
|
|
666
|
+
"ym:s:publisherArticleHasFullRead",
|
|
667
|
+
"ym:s:publisherArticleHasFullScroll",
|
|
668
|
+
"ym:s:publisherArticleHasRecircled",
|
|
669
|
+
"ym:s:publisherArticlePublishedDate",
|
|
670
|
+
"ym:s:publisherArticleReadPart",
|
|
671
|
+
"ym:s:publisherArticleRubric",
|
|
672
|
+
"ym:s:publisherArticleRubric2",
|
|
673
|
+
"ym:s:publisherArticleScrollDown",
|
|
674
|
+
"ym:s:publisherArticleTitle",
|
|
675
|
+
"ym:s:publisherArticleTopic",
|
|
676
|
+
"ym:s:publisherArticleURL",
|
|
677
|
+
"ym:s:publisherLongArticle",
|
|
678
|
+
"ym:s:publisherPageFormat",
|
|
679
|
+
"ym:s:publisherTrafficSource",
|
|
680
|
+
"ym:s:publisherTrafficSource2",
|
|
681
|
+
"ym:s:purchaseCoupon",
|
|
682
|
+
"ym:s:purchaseExistsVisit",
|
|
683
|
+
"ym:s:purchaseID",
|
|
684
|
+
"ym:s:purchaseRevenue",
|
|
685
|
+
"ym:s:purchaseRevenueVisit",
|
|
686
|
+
"ym:s:referer",
|
|
687
|
+
"ym:s:refererDomain",
|
|
688
|
+
"ym:s:refererPath",
|
|
689
|
+
"ym:s:refererPathFull",
|
|
690
|
+
"ym:s:refererPathLevel1",
|
|
691
|
+
"ym:s:refererPathLevel2",
|
|
692
|
+
"ym:s:refererPathLevel3",
|
|
693
|
+
"ym:s:refererPathLevel4",
|
|
694
|
+
"ym:s:refererPathLevel5",
|
|
695
|
+
"ym:s:refererProto",
|
|
696
|
+
"ym:s:regionArea",
|
|
697
|
+
"ym:s:regionCity",
|
|
698
|
+
"ym:s:regionCitySize",
|
|
699
|
+
"ym:s:regionContinent",
|
|
700
|
+
"ym:s:regionCountry",
|
|
701
|
+
"ym:s:regionDistrict",
|
|
702
|
+
"ym:s:RWArticleURLHash",
|
|
703
|
+
"ym:s:RWArticleURLPathLevel1Hash",
|
|
704
|
+
"ym:s:RWArticleURLPathLevel2Hash",
|
|
705
|
+
"ym:s:RWArticleURLPathLevel3Hash",
|
|
706
|
+
"ym:s:RWArticleURLPathLevel4Hash",
|
|
707
|
+
"ym:s:RWArticleURLPathLevel5Hash",
|
|
708
|
+
"ym:s:RWConversion",
|
|
709
|
+
"ym:s:RWURLHash",
|
|
710
|
+
"ym:s:RWURLPathLevel1Hash",
|
|
711
|
+
"ym:s:RWURLPathLevel2Hash",
|
|
712
|
+
"ym:s:RWURLPathLevel3Hash",
|
|
713
|
+
"ym:s:RWURLPathLevel4Hash",
|
|
714
|
+
"ym:s:RWURLPathLevel5Hash",
|
|
715
|
+
"ym:s:screenColors",
|
|
716
|
+
"ym:s:screenFormat",
|
|
717
|
+
"ym:s:screenHeight",
|
|
718
|
+
"ym:s:screenOrientation",
|
|
719
|
+
"ym:s:screenResolution",
|
|
720
|
+
"ym:s:screenWidth",
|
|
721
|
+
"ym:s:startOfDekaminute",
|
|
722
|
+
"ym:s:startOfHour",
|
|
723
|
+
"ym:s:startOfMinute",
|
|
724
|
+
"ym:s:startOfMonth",
|
|
725
|
+
"ym:s:startOfQuarter",
|
|
726
|
+
"ym:s:startOfWeek",
|
|
727
|
+
"ym:s:startOfYear",
|
|
728
|
+
"ym:s:startURL",
|
|
729
|
+
"ym:s:startURLDomain",
|
|
730
|
+
"ym:s:startURLPath",
|
|
731
|
+
"ym:s:startURLPathFull",
|
|
732
|
+
"ym:s:startURLPathLevel1",
|
|
733
|
+
"ym:s:startURLPathLevel2",
|
|
734
|
+
"ym:s:startURLPathLevel3",
|
|
735
|
+
"ym:s:startURLPathLevel4",
|
|
736
|
+
"ym:s:startURLPathLevel5",
|
|
737
|
+
"ym:s:startURLProto",
|
|
738
|
+
"ym:s:thirdPartyCookieEnabled",
|
|
739
|
+
"ym:s:topLevelDomain",
|
|
740
|
+
"ym:s:userClientUserId",
|
|
741
|
+
"ym:s:userParamsLevel1",
|
|
742
|
+
"ym:s:userParamsLevel2",
|
|
743
|
+
"ym:s:userParamsLevel3",
|
|
744
|
+
"ym:s:userParamsLevel4",
|
|
745
|
+
"ym:s:userParamsLevel5",
|
|
746
|
+
"ym:s:userVisits",
|
|
747
|
+
"ym:s:userVisitsInterval",
|
|
748
|
+
"ym:s:userVisitsPeriod",
|
|
749
|
+
"ym:s:userVisitsPeriodInterval",
|
|
750
|
+
"ym:s:vacuumEvent",
|
|
751
|
+
"ym:s:vacuumOrganization",
|
|
752
|
+
"ym:s:vacuumSurface",
|
|
753
|
+
"ym:s:visitDuration",
|
|
754
|
+
"ym:s:visitDurationInterval",
|
|
755
|
+
"ym:s:windowClientArea",
|
|
756
|
+
"ym:s:windowClientHeight",
|
|
757
|
+
"ym:s:windowClientWidth",
|
|
758
|
+
"ym:s:yanBlockID",
|
|
759
|
+
"ym:s:yanBlockSize",
|
|
760
|
+
"ym:s:yanPageID",
|
|
761
|
+
"ym:s:yanUrl",
|
|
762
|
+
"ym:s:yanUrlPathLevel1",
|
|
763
|
+
"ym:s:yanUrlPathLevel2",
|
|
764
|
+
"ym:s:yanUrlPathLevel3",
|
|
765
|
+
"ym:s:yanUrlPathLevel4",
|
|
766
|
+
"ym:s:year",
|
|
767
|
+
"ym:up:paramsLevel1",
|
|
768
|
+
"ym:up:paramsLevel2",
|
|
769
|
+
"ym:up:paramsLevel3",
|
|
770
|
+
"ym:up:paramsLevel4",
|
|
771
|
+
"ym:up:paramsLevel5"
|
|
772
|
+
]);
|
|
773
|
+
var METRIC_IDS = /* @__PURE__ */ new Set([
|
|
774
|
+
"ym:ad:<currency>ConvertedAdCost",
|
|
775
|
+
"ym:ad:<currency>ConvertedAdCostPerVisit",
|
|
776
|
+
"ym:ad:affinityIndexInterests",
|
|
777
|
+
"ym:ad:affinityIndexInterests2",
|
|
778
|
+
"ym:ad:anyGoalConversionRate",
|
|
779
|
+
"ym:ad:anyGoalConverted<currency>Revenue",
|
|
780
|
+
"ym:ad:anyGoalReaches",
|
|
781
|
+
"ym:ad:anyGoalReachesPerUser",
|
|
782
|
+
"ym:ad:anyGoalUserConversionRate",
|
|
783
|
+
"ym:ad:anyGoalUsers",
|
|
784
|
+
"ym:ad:anyGoalVisits",
|
|
785
|
+
"ym:ad:avgDaysBetweenVisits",
|
|
786
|
+
"ym:ad:avgDaysSinceFirstVisit",
|
|
787
|
+
"ym:ad:avgParams",
|
|
788
|
+
"ym:ad:avgVisitDurationSeconds",
|
|
789
|
+
"ym:ad:blockedPercentage",
|
|
790
|
+
"ym:ad:bounceRate",
|
|
791
|
+
"ym:ad:clicks",
|
|
792
|
+
"ym:ad:cookieEnabledPercentage",
|
|
793
|
+
"ym:ad:ecommerce<currency>ConvertedRevenue",
|
|
794
|
+
"ym:ad:ecommerce<currency>ConvertedRevenuePerPurchase",
|
|
795
|
+
"ym:ad:ecommerce<currency>ConvertedRevenuePerVisit",
|
|
796
|
+
"ym:ad:ecommerceCartPercents",
|
|
797
|
+
"ym:ad:ecommerceCartVisits",
|
|
798
|
+
"ym:ad:ecommerceDetailsPercents",
|
|
799
|
+
"ym:ad:ecommerceDetailsVisits",
|
|
800
|
+
"ym:ad:ecommercePurchasePercents",
|
|
801
|
+
"ym:ad:ecommercePurchases",
|
|
802
|
+
"ym:ad:ecommercePurchaseVisits",
|
|
803
|
+
"ym:ad:ePromotionClicks",
|
|
804
|
+
"ym:ad:ePromotionClicksUniq",
|
|
805
|
+
"ym:ad:ePromotionClicksUserPercentage",
|
|
806
|
+
"ym:ad:ePromotionImpressions",
|
|
807
|
+
"ym:ad:ePromotionImpressionsUniq",
|
|
808
|
+
"ym:ad:ePromotionImpressionsUserPercentage",
|
|
809
|
+
"ym:ad:favoriteGoalsConversionRate",
|
|
810
|
+
"ym:ad:favoriteGoalsConverted<currency>Revenue",
|
|
811
|
+
"ym:ad:favoriteGoalsConverted<currency>RevenuePerVisit",
|
|
812
|
+
"ym:ad:favoriteGoalsReaches",
|
|
813
|
+
"ym:ad:favoriteGoalsReachesPerUser",
|
|
814
|
+
"ym:ad:favoriteGoalsUserConversionRate",
|
|
815
|
+
"ym:ad:favoriteGoalsUsers",
|
|
816
|
+
"ym:ad:favoriteGoalsVisits",
|
|
817
|
+
"ym:ad:GCLIDPercentage",
|
|
818
|
+
"ym:ad:goal<goal_id>conversionRate",
|
|
819
|
+
"ym:ad:goal<goal_id>converted<currency>AdCostPerVisit",
|
|
820
|
+
"ym:ad:goal<goal_id>converted<currency>CPA",
|
|
821
|
+
"ym:ad:goal<goal_id>converted<currency>Revenue",
|
|
822
|
+
"ym:ad:goal<goal_id>reaches",
|
|
823
|
+
"ym:ad:goal<goal_id>reachesPerUser",
|
|
824
|
+
"ym:ad:goal<goal_id>userConversionRate",
|
|
825
|
+
"ym:ad:goal<goal_id>users",
|
|
826
|
+
"ym:ad:goal<goal_id>visits",
|
|
827
|
+
"ym:ad:jsEnabledPercentage",
|
|
828
|
+
"ym:ad:manPercentage",
|
|
829
|
+
"ym:ad:mobilePercentage",
|
|
830
|
+
"ym:ad:newUsers",
|
|
831
|
+
"ym:ad:newUserVisitsPercentage",
|
|
832
|
+
"ym:ad:oneDayBetweenVisitsPercentage",
|
|
833
|
+
"ym:ad:oneVisitPerUserPercentage",
|
|
834
|
+
"ym:ad:over32VisitsPerUserPercentage",
|
|
835
|
+
"ym:ad:over54AgePercentage",
|
|
836
|
+
"ym:ad:overMonthBetweenVisitsPercentage",
|
|
837
|
+
"ym:ad:overYearSinceFirstVisitPercentage",
|
|
838
|
+
"ym:ad:overYearUserRecencyPercentage",
|
|
839
|
+
"ym:ad:pageDepth",
|
|
840
|
+
"ym:ad:pageviews",
|
|
841
|
+
"ym:ad:paramsNumber",
|
|
842
|
+
"ym:ad:percentNewVisitors",
|
|
843
|
+
"ym:ad:productBaskets<currency>ConvertedPrice",
|
|
844
|
+
"ym:ad:productBasketsPrice",
|
|
845
|
+
"ym:ad:productBasketsQuantity",
|
|
846
|
+
"ym:ad:productBasketsRemoveUniq",
|
|
847
|
+
"ym:ad:productBasketsRemoveUserPercentage",
|
|
848
|
+
"ym:ad:productBasketsUniq",
|
|
849
|
+
"ym:ad:productBasketsUserPercentage",
|
|
850
|
+
"ym:ad:productClicks",
|
|
851
|
+
"ym:ad:productClicksUniq",
|
|
852
|
+
"ym:ad:productClicksUserPercentage",
|
|
853
|
+
"ym:ad:productImpressions",
|
|
854
|
+
"ym:ad:productImpressionsUniq",
|
|
855
|
+
"ym:ad:productImpressionsUserPercentage",
|
|
856
|
+
"ym:ad:productInListImpressions",
|
|
857
|
+
"ym:ad:productInListImpressionsUniq",
|
|
858
|
+
"ym:ad:productInListImpressionsUserPercentage",
|
|
859
|
+
"ym:ad:productPurchased<currency>ConvertedPrice",
|
|
860
|
+
"ym:ad:productPurchasedPrice",
|
|
861
|
+
"ym:ad:productPurchasedQuantity",
|
|
862
|
+
"ym:ad:productPurchasedUniq",
|
|
863
|
+
"ym:ad:robotPercentage",
|
|
864
|
+
"ym:ad:robotVisits",
|
|
865
|
+
"ym:ad:sumParams",
|
|
866
|
+
"ym:ad:thirdPartyCookieEnabledPercentage",
|
|
867
|
+
"ym:ad:under18AgePercentage",
|
|
868
|
+
"ym:ad:upTo24AgePercentage",
|
|
869
|
+
"ym:ad:upTo31VisitsPerUserPercentage",
|
|
870
|
+
"ym:ad:upTo34AgePercentage",
|
|
871
|
+
"ym:ad:upTo3VisitsPerUserPercentage",
|
|
872
|
+
"ym:ad:upTo44AgePercentage",
|
|
873
|
+
"ym:ad:upTo54AgePercentage",
|
|
874
|
+
"ym:ad:upTo7VisitsPerUserPercentage",
|
|
875
|
+
"ym:ad:upToDaySinceFirstVisitPercentage",
|
|
876
|
+
"ym:ad:upToDayUserRecencyPercentage",
|
|
877
|
+
"ym:ad:upToMonthBetweenVisitsPercentage",
|
|
878
|
+
"ym:ad:upToMonthSinceFirstVisitPercentage",
|
|
879
|
+
"ym:ad:upToMonthUserRecencyPercentage",
|
|
880
|
+
"ym:ad:upToQuarterSinceFirstVisitPercentage",
|
|
881
|
+
"ym:ad:upToQuarterUserRecencyPercentage",
|
|
882
|
+
"ym:ad:upToWeekBetweenVisitsPercentage",
|
|
883
|
+
"ym:ad:upToWeekSinceFirstVisitPercentage",
|
|
884
|
+
"ym:ad:upToWeekUserRecencyPercentage",
|
|
885
|
+
"ym:ad:upToYearSinceFirstVisitPercentage",
|
|
886
|
+
"ym:ad:upToYearUserRecencyPercentage",
|
|
887
|
+
"ym:ad:userRecencyDays",
|
|
888
|
+
"ym:ad:users",
|
|
889
|
+
"ym:ad:usersPurchasePercentage",
|
|
890
|
+
"ym:ad:visits",
|
|
891
|
+
"ym:ad:visitsPerDay",
|
|
892
|
+
"ym:ad:visitsPerHour",
|
|
893
|
+
"ym:ad:visitsPerMinute",
|
|
894
|
+
"ym:ad:womanPercentage",
|
|
895
|
+
"ym:dl:blockedPercentage",
|
|
896
|
+
"ym:dl:cookieEnabledPercentage",
|
|
897
|
+
"ym:dl:downloads",
|
|
898
|
+
"ym:dl:jsEnabledPercentage",
|
|
899
|
+
"ym:dl:mobilePercentage",
|
|
900
|
+
"ym:dl:pageviewsPerDay",
|
|
901
|
+
"ym:dl:pageviewsPerHour",
|
|
902
|
+
"ym:dl:pageviewsPerMinute",
|
|
903
|
+
"ym:dl:thirdPartyCookieEnabledPercentage",
|
|
904
|
+
"ym:dl:users",
|
|
905
|
+
"ym:ep:avgEventParams",
|
|
906
|
+
"ym:ep:eventPageViews",
|
|
907
|
+
"ym:ep:eventParamsNumber",
|
|
908
|
+
"ym:ep:eventsNumber",
|
|
909
|
+
"ym:ep:sumEventParams",
|
|
910
|
+
"ym:ev:affinityIndexInterests",
|
|
911
|
+
"ym:ev:affinityIndexInterests2",
|
|
912
|
+
"ym:ev:anyGoalConversionRate",
|
|
913
|
+
"ym:ev:anyGoalConverted<currency>Revenue",
|
|
914
|
+
"ym:ev:anyGoalReaches",
|
|
915
|
+
"ym:ev:anyGoalReachesPerUser",
|
|
916
|
+
"ym:ev:anyGoalUserConversionRate",
|
|
917
|
+
"ym:ev:anyGoalUsers",
|
|
918
|
+
"ym:ev:anyGoalVisits",
|
|
919
|
+
"ym:ev:avgDaysBetweenVisits",
|
|
920
|
+
"ym:ev:avgDaysSinceFirstVisit",
|
|
921
|
+
"ym:ev:avgOriginalVisitDurationSeconds",
|
|
922
|
+
"ym:ev:avgParams",
|
|
923
|
+
"ym:ev:avgVisitDurationSeconds",
|
|
924
|
+
"ym:ev:blockedPercentage",
|
|
925
|
+
"ym:ev:bounceRate",
|
|
926
|
+
"ym:ev:cdpOrders<currency>AverageCheque",
|
|
927
|
+
"ym:ev:cdpOrders<currency>Profit",
|
|
928
|
+
"ym:ev:cdpOrders<currency>Revenue",
|
|
929
|
+
"ym:ev:cdpOrdersAllOrders",
|
|
930
|
+
"ym:ev:cdpOrdersCancelled",
|
|
931
|
+
"ym:ev:cdpOrdersConversionIntoOrder",
|
|
932
|
+
"ym:ev:cdpOrdersConversionIntoPayment",
|
|
933
|
+
"ym:ev:cdpOrdersInProgress",
|
|
934
|
+
"ym:ev:cdpOrdersOther",
|
|
935
|
+
"ym:ev:cdpOrdersPayed",
|
|
936
|
+
"ym:ev:cdpOrdersSpam",
|
|
937
|
+
"ym:ev:cookieEnabledPercentage",
|
|
938
|
+
"ym:ev:ecommerce<currency>ConvertedRevenue",
|
|
939
|
+
"ym:ev:ecommerce<currency>ConvertedRevenuePerPurchase",
|
|
940
|
+
"ym:ev:ecommerce<currency>ConvertedRevenuePerVisit",
|
|
941
|
+
"ym:ev:ecommerceCartPercents",
|
|
942
|
+
"ym:ev:ecommerceCartVisits",
|
|
943
|
+
"ym:ev:ecommerceDetailsPercents",
|
|
944
|
+
"ym:ev:ecommerceDetailsVisits",
|
|
945
|
+
"ym:ev:ecommercePurchasePercents",
|
|
946
|
+
"ym:ev:ecommercePurchases",
|
|
947
|
+
"ym:ev:ecommercePurchaseVisits",
|
|
948
|
+
"ym:ev:ePromotionClicks",
|
|
949
|
+
"ym:ev:ePromotionClicksUniq",
|
|
950
|
+
"ym:ev:ePromotionClicksUserPercentage",
|
|
951
|
+
"ym:ev:ePromotionImpressions",
|
|
952
|
+
"ym:ev:ePromotionImpressionsUniq",
|
|
953
|
+
"ym:ev:ePromotionImpressionsUserPercentage",
|
|
954
|
+
"ym:ev:expense<currency>CPC",
|
|
955
|
+
"ym:ev:expense<currency>EcommerceCPA",
|
|
956
|
+
"ym:ev:expense<currency>EcommerceCRR",
|
|
957
|
+
"ym:ev:expense<currency>EcommerceROI",
|
|
958
|
+
"ym:ev:expense<currency>FavoriteGoalsCPA",
|
|
959
|
+
"ym:ev:expense<currency>FavoriteGoalsCRR",
|
|
960
|
+
"ym:ev:expense<currency>FavoriteGoalsROI",
|
|
961
|
+
"ym:ev:expense<currency>FavoriteGoalsUserCPA",
|
|
962
|
+
"ym:ev:expense<currency>FavoriteGoalsVisitCPA",
|
|
963
|
+
"ym:ev:expenseClicks",
|
|
964
|
+
"ym:ev:expenses<currency>",
|
|
965
|
+
"ym:ev:favoriteGoalsConversionRate",
|
|
966
|
+
"ym:ev:favoriteGoalsConverted<currency>Revenue",
|
|
967
|
+
"ym:ev:favoriteGoalsConverted<currency>RevenuePerVisit",
|
|
968
|
+
"ym:ev:favoriteGoalsReaches",
|
|
969
|
+
"ym:ev:favoriteGoalsReachesPerUser",
|
|
970
|
+
"ym:ev:favoriteGoalsUserConversionRate",
|
|
971
|
+
"ym:ev:favoriteGoalsUsers",
|
|
972
|
+
"ym:ev:favoriteGoalsVisits",
|
|
973
|
+
"ym:ev:GCLIDPercentage",
|
|
974
|
+
"ym:ev:goal<goal_id>conversionRate",
|
|
975
|
+
"ym:ev:goal<goal_id>converted<currency>Revenue",
|
|
976
|
+
"ym:ev:goal<goal_id>expense<currency>CRR",
|
|
977
|
+
"ym:ev:goal<goal_id>expense<currency>ReachCPA",
|
|
978
|
+
"ym:ev:goal<goal_id>expense<currency>ROI",
|
|
979
|
+
"ym:ev:goal<goal_id>expense<currency>UserCPA",
|
|
980
|
+
"ym:ev:goal<goal_id>expense<currency>VisitCPA",
|
|
981
|
+
"ym:ev:goal<goal_id>reaches",
|
|
982
|
+
"ym:ev:goal<goal_id>reachesPerUser",
|
|
983
|
+
"ym:ev:goal<goal_id>userConversionRate",
|
|
984
|
+
"ym:ev:goal<goal_id>users",
|
|
985
|
+
"ym:ev:goal<goal_id>visits",
|
|
986
|
+
"ym:ev:jsEnabledPercentage",
|
|
987
|
+
"ym:ev:manPercentage",
|
|
988
|
+
"ym:ev:mobilePercentage",
|
|
989
|
+
"ym:ev:newUsers",
|
|
990
|
+
"ym:ev:newUserVisitsPercentage",
|
|
991
|
+
"ym:ev:oneDayBetweenVisitsPercentage",
|
|
992
|
+
"ym:ev:oneVisitPerUserPercentage",
|
|
993
|
+
"ym:ev:originalBounceRate",
|
|
994
|
+
"ym:ev:originalPageDepth",
|
|
995
|
+
"ym:ev:originalPageviews",
|
|
996
|
+
"ym:ev:over32VisitsPerUserPercentage",
|
|
997
|
+
"ym:ev:over54AgePercentage",
|
|
998
|
+
"ym:ev:overMonthBetweenVisitsPercentage",
|
|
999
|
+
"ym:ev:overYearSinceFirstVisitPercentage",
|
|
1000
|
+
"ym:ev:overYearUserRecencyPercentage",
|
|
1001
|
+
"ym:ev:pageDepth",
|
|
1002
|
+
"ym:ev:pageviews",
|
|
1003
|
+
"ym:ev:paramsNumber",
|
|
1004
|
+
"ym:ev:percentNewVisitors",
|
|
1005
|
+
"ym:ev:productBaskets<currency>ConvertedPrice",
|
|
1006
|
+
"ym:ev:productBasketsPrice",
|
|
1007
|
+
"ym:ev:productBasketsQuantity",
|
|
1008
|
+
"ym:ev:productBasketsRemoveUniq",
|
|
1009
|
+
"ym:ev:productBasketsRemoveUserPercentage",
|
|
1010
|
+
"ym:ev:productBasketsUniq",
|
|
1011
|
+
"ym:ev:productBasketsUserPercentage",
|
|
1012
|
+
"ym:ev:productClicks",
|
|
1013
|
+
"ym:ev:productClicksUniq",
|
|
1014
|
+
"ym:ev:productClicksUserPercentage",
|
|
1015
|
+
"ym:ev:productImpressions",
|
|
1016
|
+
"ym:ev:productImpressionsUniq",
|
|
1017
|
+
"ym:ev:productImpressionsUserPercentage",
|
|
1018
|
+
"ym:ev:productInListImpressions",
|
|
1019
|
+
"ym:ev:productInListImpressionsUniq",
|
|
1020
|
+
"ym:ev:productInListImpressionsUserPercentage",
|
|
1021
|
+
"ym:ev:productPurchased<currency>ConvertedPrice",
|
|
1022
|
+
"ym:ev:productPurchasedPrice",
|
|
1023
|
+
"ym:ev:productPurchasedQuantity",
|
|
1024
|
+
"ym:ev:productPurchasedUniq",
|
|
1025
|
+
"ym:ev:robotPercentage",
|
|
1026
|
+
"ym:ev:robotVisits",
|
|
1027
|
+
"ym:ev:sumParams",
|
|
1028
|
+
"ym:ev:thirdPartyCookieEnabledPercentage",
|
|
1029
|
+
"ym:ev:under18AgePercentage",
|
|
1030
|
+
"ym:ev:upTo24AgePercentage",
|
|
1031
|
+
"ym:ev:upTo31VisitsPerUserPercentage",
|
|
1032
|
+
"ym:ev:upTo34AgePercentage",
|
|
1033
|
+
"ym:ev:upTo3VisitsPerUserPercentage",
|
|
1034
|
+
"ym:ev:upTo44AgePercentage",
|
|
1035
|
+
"ym:ev:upTo54AgePercentage",
|
|
1036
|
+
"ym:ev:upTo7VisitsPerUserPercentage",
|
|
1037
|
+
"ym:ev:upToDaySinceFirstVisitPercentage",
|
|
1038
|
+
"ym:ev:upToDayUserRecencyPercentage",
|
|
1039
|
+
"ym:ev:upToMonthBetweenVisitsPercentage",
|
|
1040
|
+
"ym:ev:upToMonthSinceFirstVisitPercentage",
|
|
1041
|
+
"ym:ev:upToMonthUserRecencyPercentage",
|
|
1042
|
+
"ym:ev:upToQuarterSinceFirstVisitPercentage",
|
|
1043
|
+
"ym:ev:upToQuarterUserRecencyPercentage",
|
|
1044
|
+
"ym:ev:upToWeekBetweenVisitsPercentage",
|
|
1045
|
+
"ym:ev:upToWeekSinceFirstVisitPercentage",
|
|
1046
|
+
"ym:ev:upToWeekUserRecencyPercentage",
|
|
1047
|
+
"ym:ev:upToYearSinceFirstVisitPercentage",
|
|
1048
|
+
"ym:ev:upToYearUserRecencyPercentage",
|
|
1049
|
+
"ym:ev:userRecencyDays",
|
|
1050
|
+
"ym:ev:users",
|
|
1051
|
+
"ym:ev:usersPurchasePercentage",
|
|
1052
|
+
"ym:ev:visits",
|
|
1053
|
+
"ym:ev:visitsPerDay",
|
|
1054
|
+
"ym:ev:visitsPerHour",
|
|
1055
|
+
"ym:ev:visitsPerMinute",
|
|
1056
|
+
"ym:ev:womanPercentage",
|
|
1057
|
+
"ym:pv:blockedPercentage",
|
|
1058
|
+
"ym:pv:cookieEnabledPercentage",
|
|
1059
|
+
"ym:pv:jsEnabledPercentage",
|
|
1060
|
+
"ym:pv:mobilePercentage",
|
|
1061
|
+
"ym:pv:pageviews",
|
|
1062
|
+
"ym:pv:pageviewsPerDay",
|
|
1063
|
+
"ym:pv:pageviewsPerHour",
|
|
1064
|
+
"ym:pv:pageviewsPerMinute",
|
|
1065
|
+
"ym:pv:thirdPartyCookieEnabledPercentage",
|
|
1066
|
+
"ym:pv:users",
|
|
1067
|
+
"ym:s:adfoxARPU",
|
|
1068
|
+
"ym:s:adfoxClicks",
|
|
1069
|
+
"ym:s:adfoxCountEvent1",
|
|
1070
|
+
"ym:s:adfoxCountEvent10",
|
|
1071
|
+
"ym:s:adfoxCountEvent11",
|
|
1072
|
+
"ym:s:adfoxCountEvent12",
|
|
1073
|
+
"ym:s:adfoxCountEvent13",
|
|
1074
|
+
"ym:s:adfoxCountEvent14",
|
|
1075
|
+
"ym:s:adfoxCountEvent15",
|
|
1076
|
+
"ym:s:adfoxCountEvent16",
|
|
1077
|
+
"ym:s:adfoxCountEvent17",
|
|
1078
|
+
"ym:s:adfoxCountEvent18",
|
|
1079
|
+
"ym:s:adfoxCountEvent19",
|
|
1080
|
+
"ym:s:adfoxCountEvent2",
|
|
1081
|
+
"ym:s:adfoxCountEvent20",
|
|
1082
|
+
"ym:s:adfoxCountEvent21",
|
|
1083
|
+
"ym:s:adfoxCountEvent22",
|
|
1084
|
+
"ym:s:adfoxCountEvent23",
|
|
1085
|
+
"ym:s:adfoxCountEvent24",
|
|
1086
|
+
"ym:s:adfoxCountEvent25",
|
|
1087
|
+
"ym:s:adfoxCountEvent26",
|
|
1088
|
+
"ym:s:adfoxCountEvent27",
|
|
1089
|
+
"ym:s:adfoxCountEvent28",
|
|
1090
|
+
"ym:s:adfoxCountEvent29",
|
|
1091
|
+
"ym:s:adfoxCountEvent3",
|
|
1092
|
+
"ym:s:adfoxCountEvent30",
|
|
1093
|
+
"ym:s:adfoxCountEvent4",
|
|
1094
|
+
"ym:s:adfoxCountEvent5",
|
|
1095
|
+
"ym:s:adfoxCountEvent6",
|
|
1096
|
+
"ym:s:adfoxCountEvent7",
|
|
1097
|
+
"ym:s:adfoxCountEvent8",
|
|
1098
|
+
"ym:s:adfoxCountEvent9",
|
|
1099
|
+
"ym:s:adfoxCPMV",
|
|
1100
|
+
"ym:s:adfoxECPM",
|
|
1101
|
+
"ym:s:adfoxPrice",
|
|
1102
|
+
"ym:s:adfoxPriceGoogle",
|
|
1103
|
+
"ym:s:adfoxPriceHeaderBidding",
|
|
1104
|
+
"ym:s:adfoxPricePerHit",
|
|
1105
|
+
"ym:s:adfoxPricePerUser",
|
|
1106
|
+
"ym:s:adfoxPricePerVisit",
|
|
1107
|
+
"ym:s:adfoxPriceStrict",
|
|
1108
|
+
"ym:s:adfoxPriceYan",
|
|
1109
|
+
"ym:s:adfoxRenders",
|
|
1110
|
+
"ym:s:adfoxRendersDefault",
|
|
1111
|
+
"ym:s:adfoxRendersDefaultShare",
|
|
1112
|
+
"ym:s:adfoxRendersPerHit",
|
|
1113
|
+
"ym:s:adfoxRendersPerUser",
|
|
1114
|
+
"ym:s:adfoxRendersPerVisit",
|
|
1115
|
+
"ym:s:adfoxRequests",
|
|
1116
|
+
"ym:s:adfoxRPM",
|
|
1117
|
+
"ym:s:adfoxShows",
|
|
1118
|
+
"ym:s:adfoxVisibility",
|
|
1119
|
+
"ym:s:affinityIndexInterests",
|
|
1120
|
+
"ym:s:affinityIndexInterests2",
|
|
1121
|
+
"ym:s:anyGoalConversionRate",
|
|
1122
|
+
"ym:s:anyGoalConverted<currency>Revenue",
|
|
1123
|
+
"ym:s:anyGoalReaches",
|
|
1124
|
+
"ym:s:anyGoalReachesPerUser",
|
|
1125
|
+
"ym:s:anyGoalUserConversionRate",
|
|
1126
|
+
"ym:s:anyGoalUsers",
|
|
1127
|
+
"ym:s:anyGoalVisits",
|
|
1128
|
+
"ym:s:avgDaysBetweenVisits",
|
|
1129
|
+
"ym:s:avgDaysSinceFirstVisit",
|
|
1130
|
+
"ym:s:avgOriginalVisitDurationSeconds",
|
|
1131
|
+
"ym:s:avgParams",
|
|
1132
|
+
"ym:s:avgPublisherArticleInvolvedTimeSeconds",
|
|
1133
|
+
"ym:s:avgUserParams",
|
|
1134
|
+
"ym:s:avgVisitDurationSeconds",
|
|
1135
|
+
"ym:s:blockedPercentage",
|
|
1136
|
+
"ym:s:bounceRate",
|
|
1137
|
+
"ym:s:cdpOrders<currency>AverageCheque",
|
|
1138
|
+
"ym:s:cdpOrders<currency>Profit",
|
|
1139
|
+
"ym:s:cdpOrders<currency>Revenue",
|
|
1140
|
+
"ym:s:cdpOrdersAllOrders",
|
|
1141
|
+
"ym:s:cdpOrdersCancelled",
|
|
1142
|
+
"ym:s:cdpOrdersConversionIntoOrder",
|
|
1143
|
+
"ym:s:cdpOrdersConversionIntoPayment",
|
|
1144
|
+
"ym:s:cdpOrdersInProgress",
|
|
1145
|
+
"ym:s:cdpOrdersOther",
|
|
1146
|
+
"ym:s:cdpOrdersPayed",
|
|
1147
|
+
"ym:s:cdpOrdersSpam",
|
|
1148
|
+
"ym:s:cookieEnabledPercentage",
|
|
1149
|
+
"ym:s:crossDeviceUsers",
|
|
1150
|
+
"ym:s:ecommerce<currency>ConvertedRevenue",
|
|
1151
|
+
"ym:s:ecommerce<currency>ConvertedRevenuePerPurchase",
|
|
1152
|
+
"ym:s:ecommerce<currency>ConvertedRevenuePerVisit",
|
|
1153
|
+
"ym:s:ecommerceCartPercents",
|
|
1154
|
+
"ym:s:ecommerceCartVisits",
|
|
1155
|
+
"ym:s:ecommerceDetailsPercents",
|
|
1156
|
+
"ym:s:ecommerceDetailsVisits",
|
|
1157
|
+
"ym:s:ecommercePurchasePercents",
|
|
1158
|
+
"ym:s:ecommercePurchases",
|
|
1159
|
+
"ym:s:ecommercePurchaseVisits",
|
|
1160
|
+
"ym:s:ePromotionClicks",
|
|
1161
|
+
"ym:s:ePromotionClicksUniq",
|
|
1162
|
+
"ym:s:ePromotionClicksUserPercentage",
|
|
1163
|
+
"ym:s:ePromotionImpressions",
|
|
1164
|
+
"ym:s:ePromotionImpressionsUniq",
|
|
1165
|
+
"ym:s:ePromotionImpressionsUserPercentage",
|
|
1166
|
+
"ym:s:favoriteGoalsConversionRate",
|
|
1167
|
+
"ym:s:favoriteGoalsConverted<currency>Revenue",
|
|
1168
|
+
"ym:s:favoriteGoalsConverted<currency>RevenuePerVisit",
|
|
1169
|
+
"ym:s:favoriteGoalsReaches",
|
|
1170
|
+
"ym:s:favoriteGoalsReachesPerUser",
|
|
1171
|
+
"ym:s:favoriteGoalsUserConversionRate",
|
|
1172
|
+
"ym:s:favoriteGoalsUsers",
|
|
1173
|
+
"ym:s:favoriteGoalsVisits",
|
|
1174
|
+
"ym:s:GCLIDPercentage",
|
|
1175
|
+
"ym:s:goal<goal_id>conversionRate",
|
|
1176
|
+
"ym:s:goal<goal_id>converted<currency>Revenue",
|
|
1177
|
+
"ym:s:goal<goal_id>reaches",
|
|
1178
|
+
"ym:s:goal<goal_id>reachesPerUser",
|
|
1179
|
+
"ym:s:goal<goal_id>userConversionRate",
|
|
1180
|
+
"ym:s:goal<goal_id>users",
|
|
1181
|
+
"ym:s:goal<goal_id>visits",
|
|
1182
|
+
"ym:s:jsEnabledPercentage",
|
|
1183
|
+
"ym:s:manPercentage",
|
|
1184
|
+
"ym:s:mobilePercentage",
|
|
1185
|
+
"ym:s:newUsers",
|
|
1186
|
+
"ym:s:newUserVisitsPercentage",
|
|
1187
|
+
"ym:s:offlineCall<currency>ConvertedRevenue",
|
|
1188
|
+
"ym:s:offlineCall<currency>ConvertedRevenueAvg",
|
|
1189
|
+
"ym:s:offlineCallDurationAvg",
|
|
1190
|
+
"ym:s:offlineCallHoldDurationTillAnswerAvg",
|
|
1191
|
+
"ym:s:offlineCallHoldDurationTillMissAvg",
|
|
1192
|
+
"ym:s:offlineCalls",
|
|
1193
|
+
"ym:s:offlineCallsFirstTimeCaller",
|
|
1194
|
+
"ym:s:offlineCallsFirstTimeCallerPercentage",
|
|
1195
|
+
"ym:s:offlineCallsMissed",
|
|
1196
|
+
"ym:s:offlineCallsMissedPercentage",
|
|
1197
|
+
"ym:s:offlineCallsUniq",
|
|
1198
|
+
"ym:s:offlineCallTalkDurationAvg",
|
|
1199
|
+
"ym:s:offlineChats",
|
|
1200
|
+
"ym:s:offlineChatsMissed",
|
|
1201
|
+
"ym:s:offlineChatsMissedPercentage",
|
|
1202
|
+
"ym:s:oneDayBetweenVisitsPercentage",
|
|
1203
|
+
"ym:s:oneVisitPerUserPercentage",
|
|
1204
|
+
"ym:s:originalBounceRate",
|
|
1205
|
+
"ym:s:originalPageDepth",
|
|
1206
|
+
"ym:s:originalPageviews",
|
|
1207
|
+
"ym:s:over32VisitsPerUserPercentage",
|
|
1208
|
+
"ym:s:over54AgePercentage",
|
|
1209
|
+
"ym:s:overMonthBetweenVisitsPercentage",
|
|
1210
|
+
"ym:s:overYearSinceFirstVisitPercentage",
|
|
1211
|
+
"ym:s:overYearUserRecencyPercentage",
|
|
1212
|
+
"ym:s:pageDepth",
|
|
1213
|
+
"ym:s:pageviews",
|
|
1214
|
+
"ym:s:paramsNumber",
|
|
1215
|
+
"ym:s:percentNewVisitors",
|
|
1216
|
+
"ym:s:productBaskets<currency>ConvertedPrice",
|
|
1217
|
+
"ym:s:productBasketsPrice",
|
|
1218
|
+
"ym:s:productBasketsQuantity",
|
|
1219
|
+
"ym:s:productBasketsRemoveUniq",
|
|
1220
|
+
"ym:s:productBasketsRemoveUserPercentage",
|
|
1221
|
+
"ym:s:productBasketsUniq",
|
|
1222
|
+
"ym:s:productBasketsUserPercentage",
|
|
1223
|
+
"ym:s:productClicks",
|
|
1224
|
+
"ym:s:productClicksUniq",
|
|
1225
|
+
"ym:s:productClicksUserPercentage",
|
|
1226
|
+
"ym:s:productImpressions",
|
|
1227
|
+
"ym:s:productImpressionsUniq",
|
|
1228
|
+
"ym:s:productImpressionsUserPercentage",
|
|
1229
|
+
"ym:s:productInListImpressions",
|
|
1230
|
+
"ym:s:productInListImpressionsUniq",
|
|
1231
|
+
"ym:s:productInListImpressionsUserPercentage",
|
|
1232
|
+
"ym:s:productPurchased<currency>ConvertedPrice",
|
|
1233
|
+
"ym:s:productPurchasedPrice",
|
|
1234
|
+
"ym:s:productPurchasedQuantity",
|
|
1235
|
+
"ym:s:productPurchasedUniq",
|
|
1236
|
+
"ym:s:publisherArticleFullReadShare",
|
|
1237
|
+
"ym:s:publisherArticleRecirculation",
|
|
1238
|
+
"ym:s:publisherArticleUsersRecircled",
|
|
1239
|
+
"ym:s:publisherArticleViewsFullScrollShare",
|
|
1240
|
+
"ym:s:publisherMobileOrTabletViews",
|
|
1241
|
+
"ym:s:publisherMobileOrTabletViewsShare",
|
|
1242
|
+
"ym:s:publisherusers",
|
|
1243
|
+
"ym:s:publisherviews",
|
|
1244
|
+
"ym:s:publisherViewsFullRead",
|
|
1245
|
+
"ym:s:publisherViewsFullScroll",
|
|
1246
|
+
"ym:s:publisherviewsPerDay",
|
|
1247
|
+
"ym:s:publisherviewsPerHour",
|
|
1248
|
+
"ym:s:publisherviewsPerMinute",
|
|
1249
|
+
"ym:s:robotPercentage",
|
|
1250
|
+
"ym:s:robotProPercentage",
|
|
1251
|
+
"ym:s:robotVisits",
|
|
1252
|
+
"ym:s:rwArticleClicks",
|
|
1253
|
+
"ym:s:rwArticleCTR",
|
|
1254
|
+
"ym:s:rwArticleShows",
|
|
1255
|
+
"ym:s:rwArticleVisibility",
|
|
1256
|
+
"ym:s:rwClicksSum",
|
|
1257
|
+
"ym:s:rwCTR",
|
|
1258
|
+
"ym:s:rwShows",
|
|
1259
|
+
"ym:s:rwVisibility",
|
|
1260
|
+
"ym:s:sumParams",
|
|
1261
|
+
"ym:s:sumPublisherArticleInvolvedTimeSeconds",
|
|
1262
|
+
"ym:s:sumUserParams",
|
|
1263
|
+
"ym:s:thirdPartyCookieEnabledPercentage",
|
|
1264
|
+
"ym:s:under18AgePercentage",
|
|
1265
|
+
"ym:s:upTo24AgePercentage",
|
|
1266
|
+
"ym:s:upTo31VisitsPerUserPercentage",
|
|
1267
|
+
"ym:s:upTo34AgePercentage",
|
|
1268
|
+
"ym:s:upTo3VisitsPerUserPercentage",
|
|
1269
|
+
"ym:s:upTo44AgePercentage",
|
|
1270
|
+
"ym:s:upTo54AgePercentage",
|
|
1271
|
+
"ym:s:upTo7VisitsPerUserPercentage",
|
|
1272
|
+
"ym:s:upToDaySinceFirstVisitPercentage",
|
|
1273
|
+
"ym:s:upToDayUserRecencyPercentage",
|
|
1274
|
+
"ym:s:upToMonthBetweenVisitsPercentage",
|
|
1275
|
+
"ym:s:upToMonthSinceFirstVisitPercentage",
|
|
1276
|
+
"ym:s:upToMonthUserRecencyPercentage",
|
|
1277
|
+
"ym:s:upToQuarterSinceFirstVisitPercentage",
|
|
1278
|
+
"ym:s:upToQuarterUserRecencyPercentage",
|
|
1279
|
+
"ym:s:upToWeekBetweenVisitsPercentage",
|
|
1280
|
+
"ym:s:upToWeekSinceFirstVisitPercentage",
|
|
1281
|
+
"ym:s:upToWeekUserRecencyPercentage",
|
|
1282
|
+
"ym:s:upToYearSinceFirstVisitPercentage",
|
|
1283
|
+
"ym:s:upToYearUserRecencyPercentage",
|
|
1284
|
+
"ym:s:userParamsNumber",
|
|
1285
|
+
"ym:s:userRecencyDays",
|
|
1286
|
+
"ym:s:users",
|
|
1287
|
+
"ym:s:usersPurchasePercentage",
|
|
1288
|
+
"ym:s:vacuumevents",
|
|
1289
|
+
"ym:s:vacuumeventsPerUser",
|
|
1290
|
+
"ym:s:vacuumusers",
|
|
1291
|
+
"ym:s:visits",
|
|
1292
|
+
"ym:s:visitsPerDay",
|
|
1293
|
+
"ym:s:visitsPerHour",
|
|
1294
|
+
"ym:s:visitsPerMinute",
|
|
1295
|
+
"ym:s:womanPercentage",
|
|
1296
|
+
"ym:s:yanARPU",
|
|
1297
|
+
"ym:s:yanCPMV",
|
|
1298
|
+
"ym:s:yanECPM",
|
|
1299
|
+
"ym:s:yanPartnerPrice",
|
|
1300
|
+
"ym:s:yanRenders",
|
|
1301
|
+
"ym:s:yanRendersPerHit",
|
|
1302
|
+
"ym:s:yanRendersPerUser",
|
|
1303
|
+
"ym:s:yanRendersPerVisit",
|
|
1304
|
+
"ym:s:yanRequests",
|
|
1305
|
+
"ym:s:yanRevenuePerHit",
|
|
1306
|
+
"ym:s:yanRevenuePerVisit",
|
|
1307
|
+
"ym:s:yanRPM",
|
|
1308
|
+
"ym:s:yanShows",
|
|
1309
|
+
"ym:s:yanVisibility",
|
|
1310
|
+
"ym:up:params",
|
|
1311
|
+
"ym:up:users"
|
|
1312
|
+
]);
|
|
1313
|
+
var PRESET_IDS = /* @__PURE__ */ new Set([
|
|
1314
|
+
"adfox_defaults",
|
|
1315
|
+
"adfox_geo",
|
|
1316
|
+
"adfox_header_bidding",
|
|
1317
|
+
"adfox_invent",
|
|
1318
|
+
"adfox_puids",
|
|
1319
|
+
"adfox_shows",
|
|
1320
|
+
"adfox_sources",
|
|
1321
|
+
"adfox_urls",
|
|
1322
|
+
"adv_engine",
|
|
1323
|
+
"age",
|
|
1324
|
+
"age_gender",
|
|
1325
|
+
"basket",
|
|
1326
|
+
"basket_products",
|
|
1327
|
+
"content_entrance",
|
|
1328
|
+
"content_exit",
|
|
1329
|
+
"content_user_params",
|
|
1330
|
+
"content_visit_params",
|
|
1331
|
+
"conversion",
|
|
1332
|
+
"coupon",
|
|
1333
|
+
"deepness_depth",
|
|
1334
|
+
"deepness_time",
|
|
1335
|
+
"downloads",
|
|
1336
|
+
"ecom_funnel",
|
|
1337
|
+
"event_params",
|
|
1338
|
+
"expenses",
|
|
1339
|
+
"experiment_ab",
|
|
1340
|
+
"gender",
|
|
1341
|
+
"geo_country",
|
|
1342
|
+
"goal_params",
|
|
1343
|
+
"hidden_metrics_goal",
|
|
1344
|
+
"hourly",
|
|
1345
|
+
"interests",
|
|
1346
|
+
"interests2",
|
|
1347
|
+
"loyalty_newness",
|
|
1348
|
+
"loyalty_period",
|
|
1349
|
+
"loyalty_recency",
|
|
1350
|
+
"loyalty_visits",
|
|
1351
|
+
"offline_calls_quality",
|
|
1352
|
+
"offline_calls_sources",
|
|
1353
|
+
"orders_sources",
|
|
1354
|
+
"popular",
|
|
1355
|
+
"product_list",
|
|
1356
|
+
"promo_campaigns",
|
|
1357
|
+
"publishers_authors",
|
|
1358
|
+
"publishers_rubrics",
|
|
1359
|
+
"publishers_sources",
|
|
1360
|
+
"publishers_thematics",
|
|
1361
|
+
"purchase",
|
|
1362
|
+
"recommendation_widget_articles",
|
|
1363
|
+
"recommendation_widget_conversion",
|
|
1364
|
+
"recommendation_widget_page",
|
|
1365
|
+
"resolution_map",
|
|
1366
|
+
"search_engines",
|
|
1367
|
+
"sources_direct_clicks",
|
|
1368
|
+
"sources_direct_platforms",
|
|
1369
|
+
"sources_direct_platforms_types",
|
|
1370
|
+
"sources_direct_summary",
|
|
1371
|
+
"sources_expenses_and_roi",
|
|
1372
|
+
"sources_messenger",
|
|
1373
|
+
"sources_recommend",
|
|
1374
|
+
"sources_search_phrases",
|
|
1375
|
+
"sources_sites",
|
|
1376
|
+
"sources_social",
|
|
1377
|
+
"sources_summary",
|
|
1378
|
+
"tags_from",
|
|
1379
|
+
"tags_gclid",
|
|
1380
|
+
"tags_openstat",
|
|
1381
|
+
"tags_u_t_m",
|
|
1382
|
+
"tech_browsers",
|
|
1383
|
+
"tech_cookies",
|
|
1384
|
+
"tech_devices",
|
|
1385
|
+
"tech_display",
|
|
1386
|
+
"tech_display_groups",
|
|
1387
|
+
"tech_java_script",
|
|
1388
|
+
"tech_platforms",
|
|
1389
|
+
"tech_third_party_cookies",
|
|
1390
|
+
"titles",
|
|
1391
|
+
"top_brands",
|
|
1392
|
+
"top_products",
|
|
1393
|
+
"traffic",
|
|
1394
|
+
"turbo_app",
|
|
1395
|
+
"turbo_pages",
|
|
1396
|
+
"url_params",
|
|
1397
|
+
"vacuum",
|
|
1398
|
+
"visits_by_client_user_id",
|
|
1399
|
+
"visits_by_user_param",
|
|
1400
|
+
"yan",
|
|
1401
|
+
"yan_adb",
|
|
1402
|
+
"yan_browsers",
|
|
1403
|
+
"yan_device",
|
|
1404
|
+
"yan_geo",
|
|
1405
|
+
"yan_sources",
|
|
1406
|
+
"yandex_rythm"
|
|
1407
|
+
]);
|
|
1408
|
+
|
|
1409
|
+
// src/contract/registry.ts
|
|
1410
|
+
var NAMESPACE_RE = /^ym:([a-z]{1,3}):/;
|
|
1411
|
+
function namespaceOf(id2) {
|
|
1412
|
+
return NAMESPACE_RE.exec(id2)?.[1];
|
|
1413
|
+
}
|
|
1414
|
+
var DEPRECATED_ATTRIBUTIONS = {
|
|
1415
|
+
first: "cross_device_first",
|
|
1416
|
+
last_significant: "cross_device_last_significant",
|
|
1417
|
+
last_yandex_direct_click: "automatic"
|
|
1418
|
+
};
|
|
1419
|
+
function hasDimension(id2) {
|
|
1420
|
+
return DIMENSION_IDS.has(id2);
|
|
1421
|
+
}
|
|
1422
|
+
function hasMetric(id2) {
|
|
1423
|
+
return METRIC_IDS.has(id2);
|
|
1424
|
+
}
|
|
1425
|
+
function hasPreset(id2) {
|
|
1426
|
+
return PRESET_IDS.has(id2);
|
|
1427
|
+
}
|
|
1428
|
+
|
|
1429
|
+
// src/client/errors.ts
|
|
1430
|
+
var MetrikaError = class extends Error {
|
|
1431
|
+
status;
|
|
1432
|
+
errorType;
|
|
1433
|
+
details;
|
|
1434
|
+
requestUrl;
|
|
1435
|
+
constructor(message, options) {
|
|
1436
|
+
super(message);
|
|
1437
|
+
this.name = new.target.name;
|
|
1438
|
+
this.status = options.status;
|
|
1439
|
+
this.errorType = options.errorType;
|
|
1440
|
+
this.details = options.details;
|
|
1441
|
+
this.requestUrl = options.requestUrl;
|
|
1442
|
+
}
|
|
1443
|
+
};
|
|
1444
|
+
var QuotaError = class extends MetrikaError {
|
|
1445
|
+
/** Через сколько миллисекунд разумно повторить попытку. */
|
|
1446
|
+
retryAfterMs;
|
|
1447
|
+
constructor(message, options) {
|
|
1448
|
+
super(message, options);
|
|
1449
|
+
this.retryAfterMs = options.retryAfterMs;
|
|
1450
|
+
}
|
|
1451
|
+
};
|
|
1452
|
+
var AuthError = class extends MetrikaError {
|
|
1453
|
+
};
|
|
1454
|
+
var InvalidRequestError = class extends MetrikaError {
|
|
1455
|
+
};
|
|
1456
|
+
var NotFoundError = class extends MetrikaError {
|
|
1457
|
+
};
|
|
1458
|
+
var ServerError = class extends MetrikaError {
|
|
1459
|
+
};
|
|
1460
|
+
var RequestValidationError = class extends Error {
|
|
1461
|
+
constructor(message) {
|
|
1462
|
+
super(message);
|
|
1463
|
+
this.name = "RequestValidationError";
|
|
1464
|
+
}
|
|
1465
|
+
};
|
|
1466
|
+
var AUTH_TYPES = /* @__PURE__ */ new Set(["invalid_token", "unauthorized", "access_denied", "counter_in_connect"]);
|
|
1467
|
+
var SERVER_TYPES = /* @__PURE__ */ new Set(["backend_error", "timeout"]);
|
|
1468
|
+
var QUOTA_RETRY_MS = {
|
|
1469
|
+
quota_requests_by_ip: 1e3,
|
|
1470
|
+
quota_parallel_requests: 1e3,
|
|
1471
|
+
quota_requests_by_uid: 5 * 6e4,
|
|
1472
|
+
quota_requests_by_counter_id: 5 * 6e4,
|
|
1473
|
+
quota_delegate_requests: 60 * 6e4,
|
|
1474
|
+
quota_grants_requests: 60 * 6e4
|
|
1475
|
+
};
|
|
1476
|
+
function toMetrikaError(status, body, requestUrl) {
|
|
1477
|
+
const details = body?.errors ?? [];
|
|
1478
|
+
const errorType = details[0]?.error_type ?? `http_${status}`;
|
|
1479
|
+
const message = details[0]?.message ?? body?.message ?? `\u0417\u0430\u043F\u0440\u043E\u0441 \u043A API \u041C\u0435\u0442\u0440\u0438\u043A\u0438 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043B\u0441\u044F \u0441\u043E \u0441\u0442\u0430\u0442\u0443\u0441\u043E\u043C ${status}`;
|
|
1480
|
+
const options = { status, errorType, details, requestUrl };
|
|
1481
|
+
const full = `${message} (${errorType}, HTTP ${status})`;
|
|
1482
|
+
if (status === 429 || errorType.startsWith("quota_")) {
|
|
1483
|
+
return new QuotaError(full, {
|
|
1484
|
+
...options,
|
|
1485
|
+
retryAfterMs: QUOTA_RETRY_MS[errorType] ?? 6e4
|
|
1486
|
+
});
|
|
1487
|
+
}
|
|
1488
|
+
if (status === 401 || status === 403 || AUTH_TYPES.has(errorType)) {
|
|
1489
|
+
return new AuthError(full, options);
|
|
1490
|
+
}
|
|
1491
|
+
if (status === 404 || errorType === "not_found") return new NotFoundError(full, options);
|
|
1492
|
+
if (status >= 500 || SERVER_TYPES.has(errorType)) return new ServerError(full, options);
|
|
1493
|
+
return new InvalidRequestError(full, options);
|
|
1494
|
+
}
|
|
1495
|
+
function isRetryable(error) {
|
|
1496
|
+
return error instanceof QuotaError || error instanceof ServerError;
|
|
1497
|
+
}
|
|
1498
|
+
|
|
1499
|
+
// src/client/rateLimit.ts
|
|
1500
|
+
var SECOND = 1e3;
|
|
1501
|
+
var FIVE_MINUTES = 5 * 60 * 1e3;
|
|
1502
|
+
var defaultSleep = (ms) => new Promise((resolve) => {
|
|
1503
|
+
setTimeout(resolve, ms);
|
|
1504
|
+
});
|
|
1505
|
+
function gmtDay(timestamp) {
|
|
1506
|
+
return Math.floor(timestamp / 864e5);
|
|
1507
|
+
}
|
|
1508
|
+
function prune(timestamps, now, windowMs) {
|
|
1509
|
+
const cutoff = now - windowMs;
|
|
1510
|
+
let drop = 0;
|
|
1511
|
+
while (drop < timestamps.length && timestamps[drop] <= cutoff) drop += 1;
|
|
1512
|
+
if (drop > 0) timestamps.splice(0, drop);
|
|
1513
|
+
}
|
|
1514
|
+
var RateLimiter = class {
|
|
1515
|
+
maxConcurrent;
|
|
1516
|
+
perSecond;
|
|
1517
|
+
reportsPer5Min;
|
|
1518
|
+
perDay;
|
|
1519
|
+
now;
|
|
1520
|
+
sleep;
|
|
1521
|
+
inFlight = 0;
|
|
1522
|
+
secondWindow = [];
|
|
1523
|
+
reportWindow = [];
|
|
1524
|
+
dayKey = -1;
|
|
1525
|
+
dayCount = 0;
|
|
1526
|
+
/** Очередь ожидающих: разбуженные проверяют условия заново. */
|
|
1527
|
+
waiters = [];
|
|
1528
|
+
constructor(options = {}) {
|
|
1529
|
+
this.maxConcurrent = options.maxConcurrent ?? 3;
|
|
1530
|
+
this.perSecond = options.perSecond ?? 30;
|
|
1531
|
+
this.reportsPer5Min = options.reportsPer5Min ?? 200;
|
|
1532
|
+
this.perDay = options.perDay ?? 5e3;
|
|
1533
|
+
this.now = options.now ?? Date.now;
|
|
1534
|
+
this.sleep = options.sleep ?? defaultSleep;
|
|
1535
|
+
}
|
|
1536
|
+
/** Выполняет `fn`, не нарушая квот. Возвращает результат `fn`. */
|
|
1537
|
+
async schedule(scope, fn) {
|
|
1538
|
+
await this.acquire(scope);
|
|
1539
|
+
try {
|
|
1540
|
+
return await fn();
|
|
1541
|
+
} finally {
|
|
1542
|
+
this.release();
|
|
1543
|
+
}
|
|
1544
|
+
}
|
|
1545
|
+
/** Сколько запросов уже израсходовано в текущих окнах — для диагностики. */
|
|
1546
|
+
usage() {
|
|
1547
|
+
const now = this.now();
|
|
1548
|
+
prune(this.secondWindow, now, SECOND);
|
|
1549
|
+
prune(this.reportWindow, now, FIVE_MINUTES);
|
|
1550
|
+
this.rollDay(now);
|
|
1551
|
+
return {
|
|
1552
|
+
inFlight: this.inFlight,
|
|
1553
|
+
lastSecond: this.secondWindow.length,
|
|
1554
|
+
reportsLast5Min: this.reportWindow.length,
|
|
1555
|
+
today: this.dayCount
|
|
1556
|
+
};
|
|
1557
|
+
}
|
|
1558
|
+
rollDay(now) {
|
|
1559
|
+
const key = gmtDay(now);
|
|
1560
|
+
if (key !== this.dayKey) {
|
|
1561
|
+
this.dayKey = key;
|
|
1562
|
+
this.dayCount = 0;
|
|
1563
|
+
}
|
|
1564
|
+
}
|
|
1565
|
+
async acquire(scope) {
|
|
1566
|
+
for (; ; ) {
|
|
1567
|
+
const now = this.now();
|
|
1568
|
+
prune(this.secondWindow, now, SECOND);
|
|
1569
|
+
prune(this.reportWindow, now, FIVE_MINUTES);
|
|
1570
|
+
this.rollDay(now);
|
|
1571
|
+
const wait = this.waitMs(scope, now);
|
|
1572
|
+
if (wait === 0) {
|
|
1573
|
+
this.inFlight += 1;
|
|
1574
|
+
this.secondWindow.push(now);
|
|
1575
|
+
this.dayCount += 1;
|
|
1576
|
+
if (scope === "report") this.reportWindow.push(now);
|
|
1577
|
+
return;
|
|
1578
|
+
}
|
|
1579
|
+
if (this.inFlight > 0 && wait === Number.POSITIVE_INFINITY) {
|
|
1580
|
+
await new Promise((resolve) => this.waiters.push(resolve));
|
|
1581
|
+
continue;
|
|
1582
|
+
}
|
|
1583
|
+
await this.sleep(Math.min(wait, FIVE_MINUTES));
|
|
1584
|
+
}
|
|
1585
|
+
}
|
|
1586
|
+
/** 0 — можно выполнять; Infinity — ждать освобождения слота параллелизма. */
|
|
1587
|
+
waitMs(scope, now) {
|
|
1588
|
+
if (this.dayCount >= this.perDay) {
|
|
1589
|
+
const nextDayStart = (gmtDay(now) + 1) * 864e5;
|
|
1590
|
+
return nextDayStart - now;
|
|
1591
|
+
}
|
|
1592
|
+
if (this.secondWindow.length >= this.perSecond) {
|
|
1593
|
+
return this.secondWindow[0] + SECOND - now;
|
|
1594
|
+
}
|
|
1595
|
+
if (scope === "report" && this.reportWindow.length >= this.reportsPer5Min) {
|
|
1596
|
+
return this.reportWindow[0] + FIVE_MINUTES - now;
|
|
1597
|
+
}
|
|
1598
|
+
if (this.inFlight >= this.maxConcurrent) return Number.POSITIVE_INFINITY;
|
|
1599
|
+
return 0;
|
|
1600
|
+
}
|
|
1601
|
+
release() {
|
|
1602
|
+
this.inFlight -= 1;
|
|
1603
|
+
this.waiters.shift()?.();
|
|
1604
|
+
}
|
|
1605
|
+
};
|
|
1606
|
+
|
|
1607
|
+
// src/client/warnings.ts
|
|
1608
|
+
var consoleWarningHandler = (warning) => {
|
|
1609
|
+
console.warn(`[yandex-metric-parser-lib] ${warning.code}: ${warning.message}`);
|
|
1610
|
+
};
|
|
1611
|
+
|
|
1612
|
+
// src/client/http.ts
|
|
1613
|
+
var DEFAULT_BASE_URL = "https://api-metrika.yandex.net";
|
|
1614
|
+
var sleep = (ms) => new Promise((resolve) => {
|
|
1615
|
+
setTimeout(resolve, ms);
|
|
1616
|
+
});
|
|
1617
|
+
function combineSignals(signals) {
|
|
1618
|
+
const controller = new AbortController();
|
|
1619
|
+
const detach = [];
|
|
1620
|
+
for (const source of signals) {
|
|
1621
|
+
if (source.aborted) {
|
|
1622
|
+
controller.abort(source.reason);
|
|
1623
|
+
break;
|
|
1624
|
+
}
|
|
1625
|
+
const onAbort = () => controller.abort(source.reason);
|
|
1626
|
+
source.addEventListener("abort", onAbort, { once: true });
|
|
1627
|
+
detach.push(() => source.removeEventListener("abort", onAbort));
|
|
1628
|
+
}
|
|
1629
|
+
return {
|
|
1630
|
+
signal: controller.signal,
|
|
1631
|
+
release: () => {
|
|
1632
|
+
for (const off of detach) off();
|
|
1633
|
+
}
|
|
1634
|
+
};
|
|
1635
|
+
}
|
|
1636
|
+
function serialize(value) {
|
|
1637
|
+
return Array.isArray(value) ? value.join(",") : String(value);
|
|
1638
|
+
}
|
|
1639
|
+
function buildUrl(baseUrl, path, query = {}) {
|
|
1640
|
+
const url = new URL(path, baseUrl);
|
|
1641
|
+
for (const [key, value] of Object.entries(query)) {
|
|
1642
|
+
if (value === void 0) continue;
|
|
1643
|
+
url.searchParams.set(key, serialize(value));
|
|
1644
|
+
}
|
|
1645
|
+
return url.toString();
|
|
1646
|
+
}
|
|
1647
|
+
var MetrikaHttpClient = class {
|
|
1648
|
+
lang;
|
|
1649
|
+
warn;
|
|
1650
|
+
limiter;
|
|
1651
|
+
token;
|
|
1652
|
+
baseUrl;
|
|
1653
|
+
fetchImpl;
|
|
1654
|
+
maxRetries;
|
|
1655
|
+
maxRetryDelayMs;
|
|
1656
|
+
timeoutMs;
|
|
1657
|
+
constructor(options) {
|
|
1658
|
+
if (!options.token) throw new Error("\u041D\u0435 \u043F\u0435\u0440\u0435\u0434\u0430\u043D OAuth-\u0442\u043E\u043A\u0435\u043D \u042F\u043D\u0434\u0435\u043A\u0441 \u041C\u0435\u0442\u0440\u0438\u043A\u0438");
|
|
1659
|
+
this.token = options.token;
|
|
1660
|
+
this.baseUrl = options.baseUrl ?? DEFAULT_BASE_URL;
|
|
1661
|
+
this.fetchImpl = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
1662
|
+
this.maxRetries = options.maxRetries ?? 3;
|
|
1663
|
+
this.maxRetryDelayMs = options.maxRetryDelayMs ?? 3e4;
|
|
1664
|
+
this.timeoutMs = options.timeoutMs ?? 6e4;
|
|
1665
|
+
this.lang = options.lang ?? "ru";
|
|
1666
|
+
this.warn = options.onWarning ?? consoleWarningHandler;
|
|
1667
|
+
this.limiter = options.rateLimit instanceof RateLimiter ? options.rateLimit : new RateLimiter(options.rateLimit);
|
|
1668
|
+
}
|
|
1669
|
+
/** Выполняет GET-запрос и разбирает JSON-ответ. */
|
|
1670
|
+
async get(options) {
|
|
1671
|
+
const url = buildUrl(this.baseUrl, options.path, options.query);
|
|
1672
|
+
let lastError;
|
|
1673
|
+
for (let attempt = 0; attempt <= this.maxRetries; attempt += 1) {
|
|
1674
|
+
try {
|
|
1675
|
+
return await this.limiter.schedule(options.scope, () => this.send(url, options.signal));
|
|
1676
|
+
} catch (error) {
|
|
1677
|
+
lastError = error;
|
|
1678
|
+
if (!isRetryable(error) || attempt === this.maxRetries) throw error;
|
|
1679
|
+
const delay = this.retryDelay(error, attempt);
|
|
1680
|
+
if (delay === void 0) throw error;
|
|
1681
|
+
await sleep(delay);
|
|
1682
|
+
}
|
|
1683
|
+
}
|
|
1684
|
+
throw lastError;
|
|
1685
|
+
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Пауза перед повтором. `undefined` — ждать пришлось бы дольше `maxRetryDelayMs`,
|
|
1688
|
+
* повтор бессмыслен и ошибку надо отдать вызывающему коду.
|
|
1689
|
+
*/
|
|
1690
|
+
retryDelay(error, attempt) {
|
|
1691
|
+
const required = error.retryAfterMs;
|
|
1692
|
+
const backoff = Math.min(1e3 * 2 ** attempt, this.maxRetryDelayMs);
|
|
1693
|
+
const delay = required ?? backoff;
|
|
1694
|
+
return delay > this.maxRetryDelayMs ? void 0 : delay;
|
|
1695
|
+
}
|
|
1696
|
+
async send(url, signal) {
|
|
1697
|
+
const timeout = AbortSignal.timeout(this.timeoutMs);
|
|
1698
|
+
const combined = combineSignals(signal ? [signal, timeout] : [timeout]);
|
|
1699
|
+
let response;
|
|
1700
|
+
try {
|
|
1701
|
+
response = await this.fetchImpl(url, {
|
|
1702
|
+
method: "GET",
|
|
1703
|
+
headers: {
|
|
1704
|
+
Authorization: `OAuth ${this.token}`,
|
|
1705
|
+
Accept: "application/json",
|
|
1706
|
+
"User-Agent": `yandex-metric-parser-lib (contract ${contractVersion})`
|
|
1707
|
+
},
|
|
1708
|
+
signal: combined.signal
|
|
1709
|
+
});
|
|
1710
|
+
} finally {
|
|
1711
|
+
combined.release();
|
|
1712
|
+
}
|
|
1713
|
+
const text2 = await response.text();
|
|
1714
|
+
const body = text2 ? safeJson(text2) : void 0;
|
|
1715
|
+
if (!response.ok) {
|
|
1716
|
+
throw toMetrikaError(response.status, body, url);
|
|
1717
|
+
}
|
|
1718
|
+
return body;
|
|
1719
|
+
}
|
|
1720
|
+
};
|
|
1721
|
+
function safeJson(text2) {
|
|
1722
|
+
try {
|
|
1723
|
+
return JSON.parse(text2);
|
|
1724
|
+
} catch {
|
|
1725
|
+
return { message: text2.slice(0, 500) };
|
|
1726
|
+
}
|
|
1727
|
+
}
|
|
1728
|
+
|
|
1729
|
+
// src/management/api.ts
|
|
1730
|
+
var CounterLookupError = class extends Error {
|
|
1731
|
+
candidates;
|
|
1732
|
+
constructor(message, candidates) {
|
|
1733
|
+
super(message);
|
|
1734
|
+
this.name = "CounterLookupError";
|
|
1735
|
+
this.candidates = candidates;
|
|
1736
|
+
}
|
|
1737
|
+
};
|
|
1738
|
+
var ManagementApi = class {
|
|
1739
|
+
constructor(http) {
|
|
1740
|
+
this.http = http;
|
|
1741
|
+
}
|
|
1742
|
+
http;
|
|
1743
|
+
/** Счётчики, доступные владельцу токена. */
|
|
1744
|
+
async getCounters(options = {}) {
|
|
1745
|
+
const response = await this.http.get({
|
|
1746
|
+
path: "/management/v1/counters",
|
|
1747
|
+
query: {
|
|
1748
|
+
search_string: options.searchString,
|
|
1749
|
+
permission: options.permission?.length ? options.permission : void 0,
|
|
1750
|
+
per_page: options.perPage,
|
|
1751
|
+
offset: options.offset,
|
|
1752
|
+
// Адрес сайта и зеркала приходят и без field, но просим явно.
|
|
1753
|
+
field: "mirrors"
|
|
1754
|
+
},
|
|
1755
|
+
scope: "management",
|
|
1756
|
+
signal: options.signal
|
|
1757
|
+
});
|
|
1758
|
+
return (response.counters ?? []).map(toCounterBrief);
|
|
1759
|
+
}
|
|
1760
|
+
/**
|
|
1761
|
+
* Находит единственный счётчик по адресу сайта.
|
|
1762
|
+
* Бросает `CounterLookupError` со списком кандидатов, если совпадений нет или их несколько:
|
|
1763
|
+
* запускать выгрузку по наугад выбранному счётчику хуже, чем остановиться.
|
|
1764
|
+
*/
|
|
1765
|
+
async findCounterBySite(site, signal) {
|
|
1766
|
+
const needle = normalizeHost(site);
|
|
1767
|
+
const counters = await this.getCounters({
|
|
1768
|
+
searchString: needle,
|
|
1769
|
+
...signal ? { signal } : {}
|
|
1770
|
+
});
|
|
1771
|
+
const exact = counters.filter(
|
|
1772
|
+
(counter) => normalizeHost(counter.site) === needle || counter.mirrors.some((mirror) => normalizeHost(mirror) === needle)
|
|
1773
|
+
);
|
|
1774
|
+
const matches = exact.length > 0 ? exact : counters;
|
|
1775
|
+
if (matches.length === 1) return matches[0];
|
|
1776
|
+
if (matches.length === 0) {
|
|
1777
|
+
throw new CounterLookupError(
|
|
1778
|
+
`\u0421\u0447\u0451\u0442\u0447\u0438\u043A \u0434\u043B\u044F \u0441\u0430\u0439\u0442\u0430 "${site}" \u043D\u0435 \u043D\u0430\u0439\u0434\u0435\u043D. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435, \u0447\u0442\u043E \u0443 \u0430\u043A\u043A\u0430\u0443\u043D\u0442\u0430, \u043D\u0430 \u043A\u043E\u0442\u043E\u0440\u044B\u0439 \u0432\u044B\u0434\u0430\u043D \u0442\u043E\u043A\u0435\u043D, \u0435\u0441\u0442\u044C \u0434\u043E\u0441\u0442\u0443\u043F \u043A \u044D\u0442\u043E\u043C\u0443 \u0441\u0447\u0451\u0442\u0447\u0438\u043A\u0443.`,
|
|
1779
|
+
[]
|
|
1780
|
+
);
|
|
1781
|
+
}
|
|
1782
|
+
throw new CounterLookupError(
|
|
1783
|
+
`\u0421\u0430\u0439\u0442\u0443 "${site}" \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u043D\u0435\u0441\u043A\u043E\u043B\u044C\u043A\u043E \u0441\u0447\u0451\u0442\u0447\u0438\u043A\u043E\u0432: ${matches.map((counter) => `${counter.id} (${counter.site})`).join(", ")}. \u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u0434\u0435\u043D\u0442\u0438\u0444\u0438\u043A\u0430\u0442\u043E\u0440 \u044F\u0432\u043D\u043E.`,
|
|
1784
|
+
matches
|
|
1785
|
+
);
|
|
1786
|
+
}
|
|
1787
|
+
/** Клиенты Директа, доступные указанным счётчикам. */
|
|
1788
|
+
async getDirectClients(counterIds, signal) {
|
|
1789
|
+
const counters = Array.isArray(counterIds) ? counterIds : [counterIds];
|
|
1790
|
+
const response = await this.http.get({
|
|
1791
|
+
path: "/management/v1/clients",
|
|
1792
|
+
query: { counters },
|
|
1793
|
+
scope: "management",
|
|
1794
|
+
signal
|
|
1795
|
+
});
|
|
1796
|
+
return response.clients ?? [];
|
|
1797
|
+
}
|
|
1798
|
+
/** Логины для параметра `direct_client_logins`. */
|
|
1799
|
+
async getDirectClientLogins(counterIds, signal) {
|
|
1800
|
+
const clients = await this.getDirectClients(counterIds, signal);
|
|
1801
|
+
return [...new Set(clients.map((client) => client.chief_login).filter(Boolean))];
|
|
1802
|
+
}
|
|
1803
|
+
};
|
|
1804
|
+
function toCounterBrief(raw) {
|
|
1805
|
+
return {
|
|
1806
|
+
id: raw.id,
|
|
1807
|
+
name: raw.name ?? "",
|
|
1808
|
+
site: raw.site2?.site ?? "",
|
|
1809
|
+
mirrors: (raw.mirrors2 ?? []).map((mirror) => typeof mirror === "string" ? mirror : mirror?.site).filter((site) => Boolean(site)),
|
|
1810
|
+
...raw.status ? { status: raw.status } : {},
|
|
1811
|
+
...raw.permission ? { permission: raw.permission } : {},
|
|
1812
|
+
...raw.owner_login ? { ownerLogin: raw.owner_login } : {}
|
|
1813
|
+
};
|
|
1814
|
+
}
|
|
1815
|
+
function normalizeHost(site) {
|
|
1816
|
+
return site.trim().toLowerCase().replace(/^https?:\/\//, "").replace(/^www\./, "").replace(/\/+$/, "");
|
|
1817
|
+
}
|
|
1818
|
+
|
|
1819
|
+
// src/reports/dates.ts
|
|
1820
|
+
var SETTLED_LAG_DAYS = 3;
|
|
1821
|
+
function settledRange(days = 30, lagDays = SETTLED_LAG_DAYS) {
|
|
1822
|
+
if (days < 1) throw new RangeError("\u041F\u0435\u0440\u0438\u043E\u0434 \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u043D\u0435 \u043C\u0435\u043D\u044C\u0448\u0435 \u043E\u0434\u043D\u043E\u0433\u043E \u0434\u043D\u044F");
|
|
1823
|
+
return {
|
|
1824
|
+
date1: `${lagDays + days - 1}daysAgo`,
|
|
1825
|
+
date2: `${lagDays}daysAgo`
|
|
1826
|
+
};
|
|
1827
|
+
}
|
|
1828
|
+
|
|
1829
|
+
// src/reports/validate.ts
|
|
1830
|
+
var LIMITS = {
|
|
1831
|
+
maxDimensions: 10,
|
|
1832
|
+
maxMetrics: 20,
|
|
1833
|
+
maxRowsPerRequest: 1e5,
|
|
1834
|
+
maxFilterLength: 1e4,
|
|
1835
|
+
maxFilterValues: 100
|
|
1836
|
+
};
|
|
1837
|
+
function namespaces(ids) {
|
|
1838
|
+
const result = /* @__PURE__ */ new Set();
|
|
1839
|
+
for (const id2 of ids) {
|
|
1840
|
+
const ns = namespaceOf(id2);
|
|
1841
|
+
if (ns) result.add(ns);
|
|
1842
|
+
}
|
|
1843
|
+
return result;
|
|
1844
|
+
}
|
|
1845
|
+
var ATTRIBUTION_PREFIXES = [
|
|
1846
|
+
"crossDeviceLastSignificant",
|
|
1847
|
+
"crossDeviceFirst",
|
|
1848
|
+
"lastYandexDirectClick",
|
|
1849
|
+
"lastSignificant",
|
|
1850
|
+
"automatic",
|
|
1851
|
+
"first",
|
|
1852
|
+
"last"
|
|
1853
|
+
];
|
|
1854
|
+
function toContractForm(id2) {
|
|
1855
|
+
const match = /^(ym:[a-z]{1,3}:)(.*)$/.exec(id2);
|
|
1856
|
+
if (!match) return id2;
|
|
1857
|
+
const [, prefix, rest] = match;
|
|
1858
|
+
let tail = rest;
|
|
1859
|
+
for (const attribution of ATTRIBUTION_PREFIXES) {
|
|
1860
|
+
if (tail.startsWith(attribution) && /^[A-Z]/.test(tail.slice(attribution.length))) {
|
|
1861
|
+
tail = `<attribution>${tail.slice(attribution.length)}`;
|
|
1862
|
+
break;
|
|
1863
|
+
}
|
|
1864
|
+
}
|
|
1865
|
+
tail = tail.replace(/\b(RUB|USD|EUR|YND)/g, "<currency>").replace(/goal\d+/g, "goal<goal_id>").replace(/experimentAB\d+/g, "experimentAB<experiment_ab>").replace(/datePeriod(day|week|month|quarter|year)/g, "datePeriod<group>");
|
|
1866
|
+
return `${prefix}${tail}`;
|
|
1867
|
+
}
|
|
1868
|
+
function validateQuery(query, options = {}) {
|
|
1869
|
+
const warnings = [];
|
|
1870
|
+
const dimensions = query.dimensions ?? [];
|
|
1871
|
+
const metrics = query.metrics ?? [];
|
|
1872
|
+
if (!query.preset && metrics.length === 0) {
|
|
1873
|
+
throw new RequestValidationError(
|
|
1874
|
+
"\u041D\u0443\u0436\u043D\u043E \u0443\u043A\u0430\u0437\u0430\u0442\u044C \u0445\u043E\u0442\u044F \u0431\u044B \u043E\u0434\u043D\u0443 \u043C\u0435\u0442\u0440\u0438\u043A\u0443 (metrics) \u0438\u043B\u0438 \u0448\u0430\u0431\u043B\u043E\u043D \u043E\u0442\u0447\u0451\u0442\u0430 (preset)"
|
|
1875
|
+
);
|
|
1876
|
+
}
|
|
1877
|
+
if (dimensions.length > LIMITS.maxDimensions) {
|
|
1878
|
+
throw new RequestValidationError(
|
|
1879
|
+
`\u0413\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u043E\u043A \u0432 \u0437\u0430\u043F\u0440\u043E\u0441\u0435: ${dimensions.length}, \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C ${LIMITS.maxDimensions}`
|
|
1880
|
+
);
|
|
1881
|
+
}
|
|
1882
|
+
if (metrics.length > LIMITS.maxMetrics) {
|
|
1883
|
+
throw new RequestValidationError(
|
|
1884
|
+
`\u041C\u0435\u0442\u0440\u0438\u043A \u0432 \u0437\u0430\u043F\u0440\u043E\u0441\u0435: ${metrics.length}, \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C ${LIMITS.maxMetrics}`
|
|
1885
|
+
);
|
|
1886
|
+
}
|
|
1887
|
+
if (query.limit !== void 0 && (query.limit < 1 || query.limit > LIMITS.maxRowsPerRequest)) {
|
|
1888
|
+
throw new RequestValidationError(
|
|
1889
|
+
`limit \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0432 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0435 1\u2026${LIMITS.maxRowsPerRequest}, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${query.limit}`
|
|
1890
|
+
);
|
|
1891
|
+
}
|
|
1892
|
+
if (query.offset !== void 0 && query.offset < 1) {
|
|
1893
|
+
throw new RequestValidationError(`offset \u043D\u0430\u0447\u0438\u043D\u0430\u0435\u0442\u0441\u044F \u0441 1, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${query.offset}`);
|
|
1894
|
+
}
|
|
1895
|
+
if (query.filters && query.filters.length > LIMITS.maxFilterLength) {
|
|
1896
|
+
throw new RequestValidationError(
|
|
1897
|
+
`\u0414\u043B\u0438\u043D\u0430 filters ${query.filters.length} \u0441\u0438\u043C\u0432\u043E\u043B\u043E\u0432, \u043C\u0430\u043A\u0441\u0438\u043C\u0443\u043C ${LIMITS.maxFilterLength}`
|
|
1898
|
+
);
|
|
1899
|
+
}
|
|
1900
|
+
const used = namespaces([...dimensions, ...metrics]);
|
|
1901
|
+
if (used.size > 1) {
|
|
1902
|
+
throw new RequestValidationError(
|
|
1903
|
+
`\u041D\u0435\u043B\u044C\u0437\u044F \u0441\u043C\u0435\u0448\u0438\u0432\u0430\u0442\u044C \u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u0441\u0442\u0432\u0430 \u0438\u043C\u0451\u043D \u0432 \u043E\u0434\u043D\u043E\u043C \u0437\u0430\u043F\u0440\u043E\u0441\u0435: ${[...used].map((ns) => `ym:${ns}:`).join(", ")}. \u0420\u0430\u0437\u0434\u0435\u043B\u0438\u0442\u0435 \u043D\u0430 \u0434\u0432\u0430 \u0437\u0430\u043F\u0440\u043E\u0441\u0430 (\u0441\u043C\u0435\u0448\u0438\u0432\u0430\u0442\u044C \u043C\u043E\u0436\u043D\u043E \u0442\u043E\u043B\u044C\u043A\u043E \u0432 filters).`
|
|
1904
|
+
);
|
|
1905
|
+
}
|
|
1906
|
+
if (used.has("ad") && !query.directClientLogins?.length) {
|
|
1907
|
+
throw new RequestValidationError(
|
|
1908
|
+
"\u0414\u043B\u044F \u043E\u0442\u0447\u0451\u0442\u043E\u0432 ym:ad: \u043E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u0435\u043D \u043F\u0430\u0440\u0430\u043C\u0435\u0442\u0440 directClientLogins. \u041B\u043E\u0433\u0438\u043D\u044B \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u0432: GET /management/v1/clients?counters=<id>"
|
|
1909
|
+
);
|
|
1910
|
+
}
|
|
1911
|
+
if (query.preset && !hasPreset(query.preset)) {
|
|
1912
|
+
reportUnknown(`\u0448\u0430\u0431\u043B\u043E\u043D "${query.preset}"`, options, warnings, { preset: query.preset });
|
|
1913
|
+
}
|
|
1914
|
+
for (const id2 of dimensions) {
|
|
1915
|
+
if (!hasDimension(toContractForm(id2))) {
|
|
1916
|
+
reportUnknown(`\u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u043A\u0430 "${id2}"`, options, warnings, { dimension: id2 });
|
|
1917
|
+
}
|
|
1918
|
+
}
|
|
1919
|
+
for (const id2 of metrics) {
|
|
1920
|
+
if (!hasMetric(toContractForm(id2))) {
|
|
1921
|
+
reportUnknown(`\u043C\u0435\u0442\u0440\u0438\u043A\u0430 "${id2}"`, options, warnings, { metric: id2 });
|
|
1922
|
+
}
|
|
1923
|
+
}
|
|
1924
|
+
if (query.attribution && query.attribution in DEPRECATED_ATTRIBUTIONS) {
|
|
1925
|
+
const replacement = DEPRECATED_ATTRIBUTIONS[query.attribution];
|
|
1926
|
+
warnings.push({
|
|
1927
|
+
code: "deprecated_attribution",
|
|
1928
|
+
message: `\u041C\u043E\u0434\u0435\u043B\u044C \u0430\u0442\u0440\u0438\u0431\u0443\u0446\u0438\u0438 "${query.attribution}" \u0443\u0441\u0442\u0430\u0440\u0435\u043B\u0430: \u0441 25 \u0438\u044E\u043D\u044F 2026 \u0433\u043E\u0434\u0430 API \u0431\u0443\u0434\u0435\u0442 \u0432\u043E\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044C \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u044F \u043F\u043E \u043C\u043E\u0434\u0435\u043B\u0438 "${replacement}". \u041F\u0435\u0440\u0435\u0439\u0434\u0438\u0442\u0435 \u043D\u0430 \u043D\u0435\u0451 \u0437\u0430\u0440\u0430\u043D\u0435\u0435.`,
|
|
1929
|
+
details: { requested: query.attribution, replacement }
|
|
1930
|
+
});
|
|
1931
|
+
}
|
|
1932
|
+
return { warnings };
|
|
1933
|
+
}
|
|
1934
|
+
function reportUnknown(what, options, warnings, details) {
|
|
1935
|
+
const message = `\u041D\u0435\u0438\u0437\u0432\u0435\u0441\u0442\u043D\u0430\u044F ${what} \u2014 \u0435\u0451 \u043D\u0435\u0442 \u0432 \u0441\u043D\u0430\u043F\u0448\u043E\u0442\u0435 \u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442\u0430. \u041F\u0440\u043E\u0432\u0435\u0440\u044C\u0442\u0435 \u043D\u0430\u043F\u0438\u0441\u0430\u043D\u0438\u0435 \u0438\u043B\u0438 \u043E\u0431\u043D\u043E\u0432\u0438\u0442\u0435 \u0441\u043D\u0430\u043F\u0448\u043E\u0442: npm run fetch-docs && npm run parse-contract`;
|
|
1936
|
+
if (options.allowUnknownFields) {
|
|
1937
|
+
warnings.push({ code: "unknown_field", message, details });
|
|
1938
|
+
return;
|
|
1939
|
+
}
|
|
1940
|
+
throw new RequestValidationError(message);
|
|
1941
|
+
}
|
|
1942
|
+
|
|
1943
|
+
// src/reports/data.ts
|
|
1944
|
+
var DEFAULT_PAGE_SIZE = LIMITS.maxRowsPerRequest;
|
|
1945
|
+
function toQueryParams(query, lang) {
|
|
1946
|
+
const range = { date1: query.date1, date2: query.date2 };
|
|
1947
|
+
return {
|
|
1948
|
+
ids: Array.isArray(query.ids) ? query.ids : [query.ids],
|
|
1949
|
+
metrics: query.metrics.length ? query.metrics : void 0,
|
|
1950
|
+
dimensions: query.dimensions?.length ? query.dimensions : void 0,
|
|
1951
|
+
preset: query.preset,
|
|
1952
|
+
date1: range.date1,
|
|
1953
|
+
date2: range.date2,
|
|
1954
|
+
filters: query.filters,
|
|
1955
|
+
sort: query.sort?.length ? query.sort : void 0,
|
|
1956
|
+
// Без full редкие фразы выпадают из выборки — именно они и составляют длинный хвост.
|
|
1957
|
+
accuracy: query.accuracy ?? "full",
|
|
1958
|
+
proposed_accuracy: query.proposedAccuracy,
|
|
1959
|
+
limit: query.limit,
|
|
1960
|
+
offset: query.offset,
|
|
1961
|
+
attribution: query.attribution,
|
|
1962
|
+
currency: query.currency,
|
|
1963
|
+
goal_id: query.goalId,
|
|
1964
|
+
direct_client_logins: query.directClientLogins?.length ? query.directClientLogins : void 0,
|
|
1965
|
+
include_undefined: query.includeUndefined,
|
|
1966
|
+
timezone: query.timezone,
|
|
1967
|
+
lang: query.lang ?? lang
|
|
1968
|
+
};
|
|
1969
|
+
}
|
|
1970
|
+
function inspectResponse(response) {
|
|
1971
|
+
const warnings = [];
|
|
1972
|
+
if (response.sampled) {
|
|
1973
|
+
warnings.push({
|
|
1974
|
+
code: "sampling",
|
|
1975
|
+
message: `\u041E\u0442\u0447\u0451\u0442 \u043F\u043E\u0441\u0442\u0440\u043E\u0435\u043D \u043F\u043E \u0432\u044B\u0431\u043E\u0440\u043A\u0435 ${formatShare(response.sample_share)} \u0434\u0430\u043D\u043D\u044B\u0445 (${response.sample_size ?? "?"} \u0438\u0437 ${response.sample_space ?? "?"} \u0441\u0442\u0440\u043E\u043A). \u0420\u0435\u0434\u043A\u0438\u0435 \u0444\u0440\u0430\u0437\u044B \u043C\u043E\u0433\u043B\u0438 \u043D\u0435 \u043F\u043E\u043F\u0430\u0441\u0442\u044C \u0432 \u0440\u0435\u0437\u0443\u043B\u044C\u0442\u0430\u0442.`,
|
|
1976
|
+
details: {
|
|
1977
|
+
sampleShare: response.sample_share,
|
|
1978
|
+
sampleSize: response.sample_size,
|
|
1979
|
+
sampleSpace: response.sample_space
|
|
1980
|
+
}
|
|
1981
|
+
});
|
|
1982
|
+
}
|
|
1983
|
+
if (response.contains_sensitive_data) {
|
|
1984
|
+
warnings.push({
|
|
1985
|
+
code: "sensitive_data_hidden",
|
|
1986
|
+
message: "\u0412 \u043E\u0442\u0432\u0435\u0442\u0435 \u043C\u043E\u0433\u0443\u0442 \u043E\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u043E\u0432\u0430\u0442\u044C \u0441\u0442\u0440\u043E\u043A\u0438, \u043F\u043E \u043A\u043E\u0442\u043E\u0440\u044B\u043C \u0432\u044B\u0431\u043E\u0440\u043A\u0430 \u043C\u0435\u043D\u044C\u0448\u0435 10 \u043F\u043E\u0441\u0435\u0442\u0438\u0442\u0435\u043B\u0435\u0439: \u043F\u043E\u0438\u0441\u043A\u043E\u0432\u044B\u0435 \u0444\u0440\u0430\u0437\u044B \u043E\u0442\u043D\u043E\u0441\u044F\u0442\u0441\u044F \u043A \u043A\u043E\u043D\u0444\u0438\u0434\u0435\u043D\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u043C \u0434\u0430\u043D\u043D\u044B\u043C. \u042D\u0442\u043E \u0440\u0435\u0436\u0435\u0442 \u0434\u043B\u0438\u043D\u043D\u044B\u0439 \u0445\u0432\u043E\u0441\u0442 \u0437\u0430\u043F\u0440\u043E\u0441\u043E\u0432."
|
|
1987
|
+
});
|
|
1988
|
+
}
|
|
1989
|
+
if (response.data_lag && response.data_lag > 0) {
|
|
1990
|
+
warnings.push({
|
|
1991
|
+
code: "data_lag",
|
|
1992
|
+
message: `\u0417\u0430\u0434\u0435\u0440\u0436\u043A\u0430 \u0434\u0430\u043D\u043D\u044B\u0445 ${Math.round(response.data_lag / 60)} \u043C\u0438\u043D \u2014 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 \u0434\u043D\u0438 \u043F\u0435\u0440\u0438\u043E\u0434\u0430 \u043C\u043E\u0433\u0443\u0442 \u0431\u044B\u0442\u044C \u043D\u0435\u043F\u043E\u043B\u043D\u044B\u043C\u0438.`,
|
|
1993
|
+
details: { dataLagSeconds: response.data_lag }
|
|
1994
|
+
});
|
|
1995
|
+
}
|
|
1996
|
+
for (const id2 of response.query?.dimensions ?? []) {
|
|
1997
|
+
if (!hasDimension(toContractForm(id2))) {
|
|
1998
|
+
warnings.push({
|
|
1999
|
+
code: "unknown_field",
|
|
2000
|
+
message: `API \u0432\u0435\u0440\u043D\u0443\u043B \u0433\u0440\u0443\u043F\u043F\u0438\u0440\u043E\u0432\u043A\u0443 "${id2}", \u043A\u043E\u0442\u043E\u0440\u043E\u0439 \u043D\u0435\u0442 \u0432 \u0441\u043D\u0430\u043F\u0448\u043E\u0442\u0435 \u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442\u0430 ${contractVersion}.`,
|
|
2001
|
+
details: { dimension: id2 }
|
|
2002
|
+
});
|
|
2003
|
+
}
|
|
2004
|
+
}
|
|
2005
|
+
for (const id2 of response.query?.metrics ?? []) {
|
|
2006
|
+
if (!hasMetric(toContractForm(id2))) {
|
|
2007
|
+
warnings.push({
|
|
2008
|
+
code: "unknown_field",
|
|
2009
|
+
message: `API \u0432\u0435\u0440\u043D\u0443\u043B \u043C\u0435\u0442\u0440\u0438\u043A\u0443 "${id2}", \u043A\u043E\u0442\u043E\u0440\u043E\u0439 \u043D\u0435\u0442 \u0432 \u0441\u043D\u0430\u043F\u0448\u043E\u0442\u0435 \u043A\u043E\u043D\u0442\u0440\u0430\u043A\u0442\u0430 ${contractVersion}.`,
|
|
2010
|
+
details: { metric: id2 }
|
|
2011
|
+
});
|
|
2012
|
+
}
|
|
2013
|
+
}
|
|
2014
|
+
return warnings;
|
|
2015
|
+
}
|
|
2016
|
+
function formatShare(share) {
|
|
2017
|
+
return share === void 0 ? "?" : `${Math.round(share * 100)}%`;
|
|
2018
|
+
}
|
|
2019
|
+
var ReportsApi = class {
|
|
2020
|
+
constructor(http, options = {}) {
|
|
2021
|
+
this.http = http;
|
|
2022
|
+
this.options = options;
|
|
2023
|
+
}
|
|
2024
|
+
http;
|
|
2025
|
+
options;
|
|
2026
|
+
/** Одна страница отчёта. Сырой ответ API без постобработки. */
|
|
2027
|
+
async fetchPage(query, signal) {
|
|
2028
|
+
const { warnings } = validateQuery(query, this.options);
|
|
2029
|
+
warnings.forEach(this.http.warn);
|
|
2030
|
+
return this.http.get({
|
|
2031
|
+
path: "/stat/v1/data",
|
|
2032
|
+
query: toQueryParams(query, this.http.lang),
|
|
2033
|
+
scope: "report",
|
|
2034
|
+
signal
|
|
2035
|
+
});
|
|
2036
|
+
}
|
|
2037
|
+
/**
|
|
2038
|
+
* Выгружает отчёт целиком, постранично по `total_rows`.
|
|
2039
|
+
* Период по умолчанию — 30 дней, заканчивающихся на T-3 (данные визитов дозаполняются ~3 дня).
|
|
2040
|
+
*/
|
|
2041
|
+
async fetchAll(query, options = {}) {
|
|
2042
|
+
const pageSize = Math.min(options.pageSize ?? DEFAULT_PAGE_SIZE, LIMITS.maxRowsPerRequest);
|
|
2043
|
+
const defaults = settledRange(30);
|
|
2044
|
+
const base = {
|
|
2045
|
+
...query,
|
|
2046
|
+
date1: query.date1 ?? defaults.date1,
|
|
2047
|
+
date2: query.date2 ?? defaults.date2
|
|
2048
|
+
};
|
|
2049
|
+
const { warnings: queryWarnings } = validateQuery(base, this.options);
|
|
2050
|
+
const warnings = [...queryWarnings];
|
|
2051
|
+
warnings.forEach(this.http.warn);
|
|
2052
|
+
const rows = [];
|
|
2053
|
+
let offset = base.offset ?? 1;
|
|
2054
|
+
let requests = 0;
|
|
2055
|
+
let totalRows = 0;
|
|
2056
|
+
let meta;
|
|
2057
|
+
for (; ; ) {
|
|
2058
|
+
const remaining = options.maxRows === void 0 ? pageSize : options.maxRows - rows.length;
|
|
2059
|
+
if (remaining <= 0) break;
|
|
2060
|
+
const page = await this.http.get({
|
|
2061
|
+
path: "/stat/v1/data",
|
|
2062
|
+
query: toQueryParams(
|
|
2063
|
+
{ ...base, limit: Math.min(pageSize, remaining), offset },
|
|
2064
|
+
this.http.lang
|
|
2065
|
+
),
|
|
2066
|
+
scope: "report",
|
|
2067
|
+
signal: options.signal
|
|
2068
|
+
});
|
|
2069
|
+
requests += 1;
|
|
2070
|
+
meta ??= page;
|
|
2071
|
+
totalRows = page.total_rows;
|
|
2072
|
+
if (requests === 1) {
|
|
2073
|
+
for (const warning of inspectResponse(page)) {
|
|
2074
|
+
warnings.push(warning);
|
|
2075
|
+
this.http.warn(warning);
|
|
2076
|
+
}
|
|
2077
|
+
}
|
|
2078
|
+
rows.push(...page.data);
|
|
2079
|
+
offset += page.data.length;
|
|
2080
|
+
if (page.data.length === 0 || offset > totalRows) break;
|
|
2081
|
+
}
|
|
2082
|
+
if (options.maxRows !== void 0 && totalRows > rows.length) {
|
|
2083
|
+
const warning = {
|
|
2084
|
+
code: "truncated",
|
|
2085
|
+
message: `\u0412\u044B\u0433\u0440\u0443\u0436\u0435\u043D\u043E ${rows.length} \u0441\u0442\u0440\u043E\u043A \u0438\u0437 ${totalRows}: \u0441\u0440\u0430\u0431\u043E\u0442\u0430\u043B \u043B\u0438\u043C\u0438\u0442 maxRows.`,
|
|
2086
|
+
details: { fetched: rows.length, totalRows }
|
|
2087
|
+
};
|
|
2088
|
+
warnings.push(warning);
|
|
2089
|
+
this.http.warn(warning);
|
|
2090
|
+
}
|
|
2091
|
+
return { rows, meta: buildMeta(meta, rows.length, requests, warnings) };
|
|
2092
|
+
}
|
|
2093
|
+
/** Ленивая постраничная выгрузка — когда весь отчёт не нужно держать в памяти. */
|
|
2094
|
+
async *stream(query, options = {}) {
|
|
2095
|
+
const pageSize = Math.min(options.pageSize ?? DEFAULT_PAGE_SIZE, LIMITS.maxRowsPerRequest);
|
|
2096
|
+
const defaults = settledRange(30);
|
|
2097
|
+
const base = {
|
|
2098
|
+
...query,
|
|
2099
|
+
date1: query.date1 ?? defaults.date1,
|
|
2100
|
+
date2: query.date2 ?? defaults.date2
|
|
2101
|
+
};
|
|
2102
|
+
validateQuery(base, this.options).warnings.forEach(this.http.warn);
|
|
2103
|
+
let offset = base.offset ?? 1;
|
|
2104
|
+
let emitted = 0;
|
|
2105
|
+
let first = true;
|
|
2106
|
+
for (; ; ) {
|
|
2107
|
+
const remaining = options.maxRows === void 0 ? pageSize : options.maxRows - emitted;
|
|
2108
|
+
if (remaining <= 0) return;
|
|
2109
|
+
const page = await this.http.get({
|
|
2110
|
+
path: "/stat/v1/data",
|
|
2111
|
+
query: toQueryParams(
|
|
2112
|
+
{ ...base, limit: Math.min(pageSize, remaining), offset },
|
|
2113
|
+
this.http.lang
|
|
2114
|
+
),
|
|
2115
|
+
scope: "report",
|
|
2116
|
+
signal: options.signal
|
|
2117
|
+
});
|
|
2118
|
+
if (first) {
|
|
2119
|
+
inspectResponse(page).forEach(this.http.warn);
|
|
2120
|
+
first = false;
|
|
2121
|
+
}
|
|
2122
|
+
for (const row of page.data) {
|
|
2123
|
+
yield row;
|
|
2124
|
+
emitted += 1;
|
|
2125
|
+
}
|
|
2126
|
+
offset += page.data.length;
|
|
2127
|
+
if (page.data.length === 0 || offset > page.total_rows) return;
|
|
2128
|
+
}
|
|
2129
|
+
}
|
|
2130
|
+
/** Отчёт с разбивкой по времени — для динамики фраз. */
|
|
2131
|
+
async bytime(query, signal) {
|
|
2132
|
+
if (query.topKeys !== void 0 && (query.topKeys < 1 || query.topKeys > 30)) {
|
|
2133
|
+
throw new RangeError(`topKeys \u0434\u043E\u043B\u0436\u0435\u043D \u0431\u044B\u0442\u044C \u0432 \u0434\u0438\u0430\u043F\u0430\u0437\u043E\u043D\u0435 1\u202630, \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u043E ${query.topKeys}`);
|
|
2134
|
+
}
|
|
2135
|
+
const defaults = settledRange(30);
|
|
2136
|
+
const base = {
|
|
2137
|
+
...query,
|
|
2138
|
+
date1: query.date1 ?? defaults.date1,
|
|
2139
|
+
date2: query.date2 ?? defaults.date2
|
|
2140
|
+
};
|
|
2141
|
+
validateQuery(base, this.options).warnings.forEach(this.http.warn);
|
|
2142
|
+
return this.http.get({
|
|
2143
|
+
path: "/stat/v1/data/bytime",
|
|
2144
|
+
query: {
|
|
2145
|
+
...toQueryParams(base, this.http.lang),
|
|
2146
|
+
group: base.group ?? "day",
|
|
2147
|
+
top_keys: base.topKeys,
|
|
2148
|
+
row_ids: base.rowIds ? JSON.stringify(base.rowIds) : void 0
|
|
2149
|
+
},
|
|
2150
|
+
scope: "report",
|
|
2151
|
+
signal
|
|
2152
|
+
});
|
|
2153
|
+
}
|
|
2154
|
+
};
|
|
2155
|
+
function buildMeta(response, fetchedRows, requests, warnings) {
|
|
2156
|
+
return {
|
|
2157
|
+
contractVersion,
|
|
2158
|
+
sampled: response?.sampled ?? false,
|
|
2159
|
+
sampleShare: response?.sample_share,
|
|
2160
|
+
sampleSize: response?.sample_size,
|
|
2161
|
+
sampleSpace: response?.sample_space,
|
|
2162
|
+
containsSensitiveData: response?.contains_sensitive_data ?? false,
|
|
2163
|
+
dataLagSeconds: response?.data_lag,
|
|
2164
|
+
totalRows: response?.total_rows ?? fetchedRows,
|
|
2165
|
+
fetchedRows,
|
|
2166
|
+
requests,
|
|
2167
|
+
warnings
|
|
2168
|
+
};
|
|
2169
|
+
}
|
|
2170
|
+
|
|
2171
|
+
// src/keywords/shared.ts
|
|
2172
|
+
var DIM = {
|
|
2173
|
+
searchPhrase: "ym:s:<attribution>SearchPhrase",
|
|
2174
|
+
searchEngineRoot: "ym:s:<attribution>SearchEngineRoot",
|
|
2175
|
+
trafficSource: "ym:s:<attribution>TrafficSource",
|
|
2176
|
+
isRobot: "ym:s:isRobot",
|
|
2177
|
+
startUrl: "ym:s:startURL",
|
|
2178
|
+
visitDirectSearchPhrase: "ym:s:<attribution>DirectSearchPhrase",
|
|
2179
|
+
visitDirectPhraseOrCond: "ym:s:<attribution>DirectPhraseOrCond",
|
|
2180
|
+
adDirectSearchPhrase: "ym:ad:<attribution>DirectSearchPhrase",
|
|
2181
|
+
adDirectPhraseOrCond: "ym:ad:<attribution>DirectPhraseOrCond",
|
|
2182
|
+
adDirectOrder: "ym:ad:<attribution>DirectOrder",
|
|
2183
|
+
adDirectConditionType: "ym:ad:<attribution>DirectConditionType"
|
|
2184
|
+
};
|
|
2185
|
+
var METRIC = {
|
|
2186
|
+
visits: "ym:s:visits",
|
|
2187
|
+
users: "ym:s:users",
|
|
2188
|
+
bounceRate: "ym:s:bounceRate",
|
|
2189
|
+
pageDepth: "ym:s:pageDepth",
|
|
2190
|
+
avgVisitDuration: "ym:s:avgVisitDurationSeconds",
|
|
2191
|
+
anyGoalConversionRate: "ym:s:anyGoalConversionRate",
|
|
2192
|
+
adClicks: "ym:ad:clicks",
|
|
2193
|
+
adVisits: "ym:ad:visits",
|
|
2194
|
+
adUsers: "ym:ad:users",
|
|
2195
|
+
adBounceRate: "ym:ad:bounceRate",
|
|
2196
|
+
adCost: "ym:ad:<currency>ConvertedAdCost",
|
|
2197
|
+
adCostPerVisit: "ym:ad:<currency>ConvertedAdCostPerVisit"
|
|
2198
|
+
};
|
|
2199
|
+
function andFilters(...parts) {
|
|
2200
|
+
const clauses = parts.filter((part) => Boolean(part?.trim()));
|
|
2201
|
+
if (clauses.length === 0) return void 0;
|
|
2202
|
+
return clauses.map((clause) => clauses.length > 1 ? `(${clause})` : clause).join(" AND ");
|
|
2203
|
+
}
|
|
2204
|
+
function text(value) {
|
|
2205
|
+
return value?.name ?? value?.id ?? "";
|
|
2206
|
+
}
|
|
2207
|
+
function id(value) {
|
|
2208
|
+
return value?.id ?? void 0;
|
|
2209
|
+
}
|
|
2210
|
+
function num(row, index) {
|
|
2211
|
+
const value = row.metrics[index];
|
|
2212
|
+
return typeof value === "number" && Number.isFinite(value) ? value : 0;
|
|
2213
|
+
}
|
|
2214
|
+
function normalizePhrase(phrase) {
|
|
2215
|
+
return phrase.trim().replace(/\s+/g, " ").toLowerCase().replace(/ё/g, "\u0435");
|
|
2216
|
+
}
|
|
2217
|
+
|
|
2218
|
+
// src/keywords/directCost.ts
|
|
2219
|
+
var METRICS = [
|
|
2220
|
+
METRIC.adClicks,
|
|
2221
|
+
METRIC.adVisits,
|
|
2222
|
+
METRIC.adUsers,
|
|
2223
|
+
METRIC.adCost,
|
|
2224
|
+
METRIC.adCostPerVisit,
|
|
2225
|
+
METRIC.adBounceRate
|
|
2226
|
+
];
|
|
2227
|
+
async function getDirectSearchPhraseCost(reports, options) {
|
|
2228
|
+
const report = await reports.fetchAll(
|
|
2229
|
+
{
|
|
2230
|
+
ids: options.counterId,
|
|
2231
|
+
dimensions: [
|
|
2232
|
+
DIM.adDirectSearchPhrase,
|
|
2233
|
+
DIM.adDirectPhraseOrCond,
|
|
2234
|
+
DIM.adDirectConditionType,
|
|
2235
|
+
DIM.adDirectOrder
|
|
2236
|
+
],
|
|
2237
|
+
metrics: METRICS,
|
|
2238
|
+
filters: andFilters(
|
|
2239
|
+
options.conditionTypes?.length ? `${DIM.adDirectConditionType}=.(${options.conditionTypes.map((type) => `'${type}'`).join(",")})` : void 0,
|
|
2240
|
+
options.filters
|
|
2241
|
+
),
|
|
2242
|
+
attribution: options.attribution ?? "last",
|
|
2243
|
+
currency: options.currency,
|
|
2244
|
+
directClientLogins: options.directClientLogins,
|
|
2245
|
+
date1: options.date1,
|
|
2246
|
+
date2: options.date2,
|
|
2247
|
+
sort: [`-${METRIC.adClicks}`]
|
|
2248
|
+
},
|
|
2249
|
+
{ maxRows: options.maxRows, signal: options.signal }
|
|
2250
|
+
);
|
|
2251
|
+
return { rows: report.rows.map(toDirectCostRow), meta: report.meta };
|
|
2252
|
+
}
|
|
2253
|
+
function toDirectCostRow(row) {
|
|
2254
|
+
const conditionType = text(row.dimensions[2]);
|
|
2255
|
+
const campaignId = id(row.dimensions[3]);
|
|
2256
|
+
return {
|
|
2257
|
+
query: text(row.dimensions[0]),
|
|
2258
|
+
keyword: text(row.dimensions[1]),
|
|
2259
|
+
...conditionType ? { conditionType } : {},
|
|
2260
|
+
...campaignId ? { campaignId } : {},
|
|
2261
|
+
campaignName: text(row.dimensions[3]),
|
|
2262
|
+
clicks: num(row, 0),
|
|
2263
|
+
visits: num(row, 1),
|
|
2264
|
+
users: num(row, 2),
|
|
2265
|
+
cost: num(row, 3),
|
|
2266
|
+
costPerVisit: num(row, 4),
|
|
2267
|
+
bounceRate: num(row, 5)
|
|
2268
|
+
};
|
|
2269
|
+
}
|
|
2270
|
+
|
|
2271
|
+
// src/keywords/directVisits.ts
|
|
2272
|
+
var METRICS2 = [METRIC.visits, METRIC.users, METRIC.bounceRate, METRIC.anyGoalConversionRate];
|
|
2273
|
+
async function getDirectKeywordsByVisits(reports, options) {
|
|
2274
|
+
const report = await reports.fetchAll(
|
|
2275
|
+
{
|
|
2276
|
+
ids: options.counterId,
|
|
2277
|
+
dimensions: [DIM.visitDirectPhraseOrCond, DIM.visitDirectSearchPhrase],
|
|
2278
|
+
metrics: METRICS2,
|
|
2279
|
+
filters: andFilters(
|
|
2280
|
+
options.excludeRobots === false ? void 0 : `${DIM.isRobot}=='No'`,
|
|
2281
|
+
options.filters
|
|
2282
|
+
),
|
|
2283
|
+
attribution: options.attribution ?? "last",
|
|
2284
|
+
date1: options.date1,
|
|
2285
|
+
date2: options.date2,
|
|
2286
|
+
sort: [`-${METRIC.visits}`]
|
|
2287
|
+
},
|
|
2288
|
+
{ maxRows: options.maxRows, signal: options.signal }
|
|
2289
|
+
);
|
|
2290
|
+
return { rows: report.rows.map(toDirectVisitRow), meta: report.meta };
|
|
2291
|
+
}
|
|
2292
|
+
function toDirectVisitRow(row) {
|
|
2293
|
+
return {
|
|
2294
|
+
keyword: text(row.dimensions[0]),
|
|
2295
|
+
query: text(row.dimensions[1]),
|
|
2296
|
+
visits: num(row, 0),
|
|
2297
|
+
users: num(row, 1),
|
|
2298
|
+
bounceRate: num(row, 2),
|
|
2299
|
+
anyGoalConversionRate: num(row, 3)
|
|
2300
|
+
};
|
|
2301
|
+
}
|
|
2302
|
+
|
|
2303
|
+
// src/keywords/organic.ts
|
|
2304
|
+
function organicFilters(options) {
|
|
2305
|
+
const engines = options.searchEngines?.length ? `${DIM.searchEngineRoot}=.(${options.searchEngines.map((e) => `'${e}'`).join(",")})` : void 0;
|
|
2306
|
+
return andFilters(
|
|
2307
|
+
`${DIM.trafficSource}=='organic'`,
|
|
2308
|
+
options.excludeRobots === false ? void 0 : `${DIM.isRobot}=='No'`,
|
|
2309
|
+
engines,
|
|
2310
|
+
options.filters
|
|
2311
|
+
);
|
|
2312
|
+
}
|
|
2313
|
+
var METRICS3 = [
|
|
2314
|
+
METRIC.visits,
|
|
2315
|
+
METRIC.users,
|
|
2316
|
+
METRIC.bounceRate,
|
|
2317
|
+
METRIC.pageDepth,
|
|
2318
|
+
METRIC.avgVisitDuration
|
|
2319
|
+
];
|
|
2320
|
+
async function getOrganicSearchPhrases(reports, options) {
|
|
2321
|
+
const report = await reports.fetchAll(
|
|
2322
|
+
{
|
|
2323
|
+
ids: options.counterId,
|
|
2324
|
+
dimensions: [DIM.searchPhrase, DIM.searchEngineRoot],
|
|
2325
|
+
metrics: METRICS3,
|
|
2326
|
+
filters: organicFilters(options),
|
|
2327
|
+
attribution: options.attribution ?? "last",
|
|
2328
|
+
date1: options.date1,
|
|
2329
|
+
date2: options.date2,
|
|
2330
|
+
sort: [`-${METRIC.visits}`]
|
|
2331
|
+
},
|
|
2332
|
+
{ maxRows: options.maxRows, signal: options.signal }
|
|
2333
|
+
);
|
|
2334
|
+
return { rows: report.rows.map(toOrganicRow), meta: report.meta };
|
|
2335
|
+
}
|
|
2336
|
+
function toOrganicRow(row) {
|
|
2337
|
+
const engineId = id(row.dimensions[1]);
|
|
2338
|
+
return {
|
|
2339
|
+
phrase: text(row.dimensions[0]),
|
|
2340
|
+
searchEngine: text(row.dimensions[1]),
|
|
2341
|
+
...engineId ? { searchEngineId: engineId } : {},
|
|
2342
|
+
visits: num(row, 0),
|
|
2343
|
+
users: num(row, 1),
|
|
2344
|
+
bounceRate: num(row, 2),
|
|
2345
|
+
pageDepth: num(row, 3),
|
|
2346
|
+
avgVisitDurationSeconds: num(row, 4)
|
|
2347
|
+
};
|
|
2348
|
+
}
|
|
2349
|
+
|
|
2350
|
+
// src/keywords/landing.ts
|
|
2351
|
+
var METRICS4 = [METRIC.visits, METRIC.users, METRIC.bounceRate, METRIC.avgVisitDuration];
|
|
2352
|
+
async function getPhraseLandingMap(reports, options) {
|
|
2353
|
+
const report = await reports.fetchAll(
|
|
2354
|
+
{
|
|
2355
|
+
ids: options.counterId,
|
|
2356
|
+
dimensions: [DIM.searchPhrase, DIM.startUrl],
|
|
2357
|
+
metrics: METRICS4,
|
|
2358
|
+
filters: organicFilters(options),
|
|
2359
|
+
attribution: options.attribution ?? "last",
|
|
2360
|
+
date1: options.date1,
|
|
2361
|
+
date2: options.date2,
|
|
2362
|
+
sort: [`-${METRIC.visits}`]
|
|
2363
|
+
},
|
|
2364
|
+
{ maxRows: options.maxRows, signal: options.signal }
|
|
2365
|
+
);
|
|
2366
|
+
return { rows: report.rows.map(toLandingRow), meta: report.meta };
|
|
2367
|
+
}
|
|
2368
|
+
function toLandingRow(row) {
|
|
2369
|
+
return {
|
|
2370
|
+
phrase: text(row.dimensions[0]),
|
|
2371
|
+
url: text(row.dimensions[1]),
|
|
2372
|
+
visits: num(row, 0),
|
|
2373
|
+
users: num(row, 1),
|
|
2374
|
+
bounceRate: num(row, 2),
|
|
2375
|
+
avgVisitDurationSeconds: num(row, 3)
|
|
2376
|
+
};
|
|
2377
|
+
}
|
|
2378
|
+
|
|
2379
|
+
// src/keywords/timeline.ts
|
|
2380
|
+
var MAX_TIMELINE_ROWS = 30;
|
|
2381
|
+
async function getPhraseTimeline(reports, options) {
|
|
2382
|
+
const topPhrases = Math.min(options.topPhrases ?? 10, MAX_TIMELINE_ROWS);
|
|
2383
|
+
const response = await reports.bytime(
|
|
2384
|
+
{
|
|
2385
|
+
ids: options.counterId,
|
|
2386
|
+
dimensions: [DIM.searchPhrase],
|
|
2387
|
+
metrics: [METRIC.visits],
|
|
2388
|
+
filters: organicFilters(options),
|
|
2389
|
+
attribution: options.attribution ?? "last",
|
|
2390
|
+
date1: options.date1,
|
|
2391
|
+
date2: options.date2,
|
|
2392
|
+
group: options.group ?? "day",
|
|
2393
|
+
...options.phrases?.length ? { rowIds: options.phrases.map((phrase) => [phrase]) } : { topKeys: topPhrases }
|
|
2394
|
+
},
|
|
2395
|
+
options.signal
|
|
2396
|
+
);
|
|
2397
|
+
const intervals = response.time_intervals ?? [];
|
|
2398
|
+
return response.data.map((row) => toTimeline(row, intervals));
|
|
2399
|
+
}
|
|
2400
|
+
function toTimeline(row, intervals) {
|
|
2401
|
+
const series = row.metrics[0] ?? [];
|
|
2402
|
+
const points = series.map((value, index) => ({
|
|
2403
|
+
from: intervals[index]?.[0] ?? "",
|
|
2404
|
+
to: intervals[index]?.[1] ?? "",
|
|
2405
|
+
visits: typeof value === "number" && Number.isFinite(value) ? value : 0
|
|
2406
|
+
}));
|
|
2407
|
+
return {
|
|
2408
|
+
phrase: text(row.dimensions[0]),
|
|
2409
|
+
points,
|
|
2410
|
+
totalVisits: points.reduce((sum, point) => sum + point.visits, 0),
|
|
2411
|
+
trend: computeTrend(points)
|
|
2412
|
+
};
|
|
2413
|
+
}
|
|
2414
|
+
function computeTrend(points) {
|
|
2415
|
+
if (points.length < 2) return null;
|
|
2416
|
+
const middle = Math.floor(points.length / 2);
|
|
2417
|
+
const sum = (slice) => slice.reduce((total, point) => total + point.visits, 0);
|
|
2418
|
+
const first = sum(points.slice(0, middle));
|
|
2419
|
+
if (first === 0) return null;
|
|
2420
|
+
return sum(points.slice(middle)) / first;
|
|
2421
|
+
}
|
|
2422
|
+
|
|
2423
|
+
// src/keywords/quality.ts
|
|
2424
|
+
var PRIVACY_THRESHOLD_USERS = 10;
|
|
2425
|
+
function qualityOf(meta) {
|
|
2426
|
+
return {
|
|
2427
|
+
sampled: meta.sampled,
|
|
2428
|
+
sensitiveDataHidden: meta.containsSensitiveData,
|
|
2429
|
+
belowPrivacyThreshold: false
|
|
2430
|
+
};
|
|
2431
|
+
}
|
|
2432
|
+
function isBelowPrivacyThreshold(users) {
|
|
2433
|
+
return users > 0 && users < PRIVACY_THRESHOLD_USERS;
|
|
2434
|
+
}
|
|
2435
|
+
function mergeQuality(a, b) {
|
|
2436
|
+
return {
|
|
2437
|
+
sampled: a.sampled || b.sampled,
|
|
2438
|
+
sensitiveDataHidden: a.sensitiveDataHidden || b.sensitiveDataHidden,
|
|
2439
|
+
belowPrivacyThreshold: a.belowPrivacyThreshold || b.belowPrivacyThreshold
|
|
2440
|
+
};
|
|
2441
|
+
}
|
|
2442
|
+
function mergeMeta(entries, belowPrivacyThreshold) {
|
|
2443
|
+
const shares = entries.map(({ meta }) => meta.sampleShare).filter((share) => typeof share === "number");
|
|
2444
|
+
return {
|
|
2445
|
+
contractVersion: entries[0]?.meta.contractVersion ?? "",
|
|
2446
|
+
sampled: entries.some(({ meta }) => meta.sampled),
|
|
2447
|
+
...shares.length ? { minSampleShare: Math.min(...shares) } : {},
|
|
2448
|
+
containsSensitiveData: entries.some(({ meta }) => meta.containsSensitiveData),
|
|
2449
|
+
belowPrivacyThreshold,
|
|
2450
|
+
requests: entries.reduce((sum, { meta }) => sum + meta.requests, 0),
|
|
2451
|
+
warnings: entries.flatMap(({ meta }) => meta.warnings),
|
|
2452
|
+
sources: entries.map(({ source }) => source)
|
|
2453
|
+
};
|
|
2454
|
+
}
|
|
2455
|
+
|
|
2456
|
+
// src/keywords/merge.ts
|
|
2457
|
+
function mergeKeywords(input) {
|
|
2458
|
+
const index = /* @__PURE__ */ new Map();
|
|
2459
|
+
const metas = [];
|
|
2460
|
+
if (input.organic) {
|
|
2461
|
+
metas.push({ source: "organic", meta: input.organic.meta });
|
|
2462
|
+
for (const row of input.organic.rows) {
|
|
2463
|
+
if (!row.phrase) continue;
|
|
2464
|
+
const entry = ensure(index, row.phrase, input.organic.meta);
|
|
2465
|
+
addSource(entry, "organic");
|
|
2466
|
+
const stats = entry.organic ??= emptyOrganic();
|
|
2467
|
+
stats.visits += row.visits;
|
|
2468
|
+
stats.users += row.users;
|
|
2469
|
+
stats.bounceRate += row.bounceRate * row.visits;
|
|
2470
|
+
stats.pageDepth += row.pageDepth * row.visits;
|
|
2471
|
+
stats.avgVisitDurationSeconds += row.avgVisitDurationSeconds * row.visits;
|
|
2472
|
+
if (row.searchEngine && !stats.searchEngines.includes(row.searchEngine)) {
|
|
2473
|
+
stats.searchEngines.push(row.searchEngine);
|
|
2474
|
+
}
|
|
2475
|
+
}
|
|
2476
|
+
}
|
|
2477
|
+
if (input.directCost) {
|
|
2478
|
+
metas.push({ source: "directCost", meta: input.directCost.meta });
|
|
2479
|
+
for (const row of input.directCost.rows) {
|
|
2480
|
+
if (!row.query) continue;
|
|
2481
|
+
const entry = ensure(index, row.query, input.directCost.meta);
|
|
2482
|
+
addSource(entry, "direct_query");
|
|
2483
|
+
const stats = entry.direct ??= emptyDirect();
|
|
2484
|
+
stats.clicks += row.clicks;
|
|
2485
|
+
stats.visits += row.visits;
|
|
2486
|
+
stats.users += row.users;
|
|
2487
|
+
stats.cost += row.cost;
|
|
2488
|
+
stats.bounceRate += row.bounceRate * row.visits;
|
|
2489
|
+
pushUnique(stats.keywords, row.keyword);
|
|
2490
|
+
pushUnique(stats.campaigns, row.campaignName);
|
|
2491
|
+
}
|
|
2492
|
+
}
|
|
2493
|
+
if (input.directVisits) {
|
|
2494
|
+
metas.push({ source: "directVisits", meta: input.directVisits.meta });
|
|
2495
|
+
for (const row of input.directVisits.rows) {
|
|
2496
|
+
if (!row.query) continue;
|
|
2497
|
+
const entry = ensure(index, row.query, input.directVisits.meta);
|
|
2498
|
+
addSource(entry, "direct_query");
|
|
2499
|
+
const stats = entry.direct ??= emptyDirect();
|
|
2500
|
+
if (stats.visits === 0) {
|
|
2501
|
+
stats.visits = row.visits;
|
|
2502
|
+
stats.users = row.users;
|
|
2503
|
+
stats.bounceRate = row.bounceRate * row.visits;
|
|
2504
|
+
}
|
|
2505
|
+
stats.anyGoalConversionRate = row.anyGoalConversionRate;
|
|
2506
|
+
pushUnique(stats.keywords, row.keyword);
|
|
2507
|
+
}
|
|
2508
|
+
}
|
|
2509
|
+
if (input.landings) {
|
|
2510
|
+
metas.push({ source: "landings", meta: input.landings.meta });
|
|
2511
|
+
for (const row of input.landings.rows) {
|
|
2512
|
+
if (!row.phrase || !row.url) continue;
|
|
2513
|
+
const entry = ensure(index, row.phrase, input.landings.meta);
|
|
2514
|
+
const existing = entry.landings.find((landing) => landing.url === row.url);
|
|
2515
|
+
if (existing) existing.visits += row.visits;
|
|
2516
|
+
else entry.landings.push({ url: row.url, visits: row.visits });
|
|
2517
|
+
}
|
|
2518
|
+
}
|
|
2519
|
+
const keywords = [...index.values()];
|
|
2520
|
+
for (const keyword of keywords) finalize(keyword);
|
|
2521
|
+
keywords.sort((a, b) => b.totalVisits - a.totalVisits || a.phrase.localeCompare(b.phrase));
|
|
2522
|
+
const belowThreshold = keywords.filter((k) => k.quality.belowPrivacyThreshold).length;
|
|
2523
|
+
return { keywords, meta: mergeMeta(metas, belowThreshold) };
|
|
2524
|
+
}
|
|
2525
|
+
function aggregateDirectKeywords(report) {
|
|
2526
|
+
const index = /* @__PURE__ */ new Map();
|
|
2527
|
+
for (const row of report.rows) {
|
|
2528
|
+
if (!row.keyword) continue;
|
|
2529
|
+
const key = normalizePhrase(row.keyword);
|
|
2530
|
+
let entry = index.get(key);
|
|
2531
|
+
if (!entry) {
|
|
2532
|
+
entry = {
|
|
2533
|
+
keyword: row.keyword,
|
|
2534
|
+
clicks: 0,
|
|
2535
|
+
visits: 0,
|
|
2536
|
+
users: 0,
|
|
2537
|
+
cost: 0,
|
|
2538
|
+
queries: [],
|
|
2539
|
+
campaigns: []
|
|
2540
|
+
};
|
|
2541
|
+
index.set(key, entry);
|
|
2542
|
+
}
|
|
2543
|
+
entry.clicks += row.clicks;
|
|
2544
|
+
entry.visits += row.visits;
|
|
2545
|
+
entry.users += row.users;
|
|
2546
|
+
entry.cost += row.cost;
|
|
2547
|
+
pushUnique(entry.queries, row.query);
|
|
2548
|
+
pushUnique(entry.campaigns, row.campaignName);
|
|
2549
|
+
}
|
|
2550
|
+
return [...index.values()].sort((a, b) => b.clicks - a.clicks);
|
|
2551
|
+
}
|
|
2552
|
+
function ensure(index, displayPhrase, meta) {
|
|
2553
|
+
const phrase = normalizePhrase(displayPhrase);
|
|
2554
|
+
let entry = index.get(phrase);
|
|
2555
|
+
if (!entry) {
|
|
2556
|
+
entry = {
|
|
2557
|
+
phrase,
|
|
2558
|
+
displayPhrase,
|
|
2559
|
+
sources: [],
|
|
2560
|
+
landings: [],
|
|
2561
|
+
totalVisits: 0,
|
|
2562
|
+
totalUsers: 0,
|
|
2563
|
+
quality: qualityOf(meta)
|
|
2564
|
+
};
|
|
2565
|
+
index.set(phrase, entry);
|
|
2566
|
+
return entry;
|
|
2567
|
+
}
|
|
2568
|
+
entry.quality = mergeQuality(entry.quality, qualityOf(meta));
|
|
2569
|
+
return entry;
|
|
2570
|
+
}
|
|
2571
|
+
function addSource(entry, source) {
|
|
2572
|
+
if (!entry.sources.includes(source)) entry.sources.push(source);
|
|
2573
|
+
}
|
|
2574
|
+
function pushUnique(list, value) {
|
|
2575
|
+
if (value && !list.includes(value)) list.push(value);
|
|
2576
|
+
}
|
|
2577
|
+
function emptyOrganic() {
|
|
2578
|
+
return {
|
|
2579
|
+
visits: 0,
|
|
2580
|
+
users: 0,
|
|
2581
|
+
bounceRate: 0,
|
|
2582
|
+
pageDepth: 0,
|
|
2583
|
+
avgVisitDurationSeconds: 0,
|
|
2584
|
+
searchEngines: []
|
|
2585
|
+
};
|
|
2586
|
+
}
|
|
2587
|
+
function emptyDirect() {
|
|
2588
|
+
return {
|
|
2589
|
+
clicks: 0,
|
|
2590
|
+
visits: 0,
|
|
2591
|
+
users: 0,
|
|
2592
|
+
cost: 0,
|
|
2593
|
+
costPerVisit: 0,
|
|
2594
|
+
bounceRate: 0,
|
|
2595
|
+
keywords: [],
|
|
2596
|
+
campaigns: []
|
|
2597
|
+
};
|
|
2598
|
+
}
|
|
2599
|
+
function finalize(keyword) {
|
|
2600
|
+
if (keyword.organic && keyword.organic.visits > 0) {
|
|
2601
|
+
const { visits } = keyword.organic;
|
|
2602
|
+
keyword.organic.bounceRate = round(keyword.organic.bounceRate / visits);
|
|
2603
|
+
keyword.organic.pageDepth = round(keyword.organic.pageDepth / visits);
|
|
2604
|
+
keyword.organic.avgVisitDurationSeconds = round(
|
|
2605
|
+
keyword.organic.avgVisitDurationSeconds / visits
|
|
2606
|
+
);
|
|
2607
|
+
}
|
|
2608
|
+
if (keyword.direct) {
|
|
2609
|
+
if (keyword.direct.visits > 0) {
|
|
2610
|
+
keyword.direct.bounceRate = round(keyword.direct.bounceRate / keyword.direct.visits);
|
|
2611
|
+
keyword.direct.costPerVisit = round(keyword.direct.cost / keyword.direct.visits);
|
|
2612
|
+
}
|
|
2613
|
+
keyword.direct.cost = round(keyword.direct.cost);
|
|
2614
|
+
}
|
|
2615
|
+
keyword.landings.sort((a, b) => b.visits - a.visits);
|
|
2616
|
+
keyword.totalVisits = (keyword.organic?.visits ?? 0) + (keyword.direct?.visits ?? 0);
|
|
2617
|
+
keyword.totalUsers = (keyword.organic?.users ?? 0) + (keyword.direct?.users ?? 0);
|
|
2618
|
+
keyword.quality.belowPrivacyThreshold = isBelowPrivacyThreshold(keyword.totalUsers);
|
|
2619
|
+
}
|
|
2620
|
+
function round(value) {
|
|
2621
|
+
return Math.round(value * 100) / 100;
|
|
2622
|
+
}
|
|
2623
|
+
|
|
2624
|
+
// src/metrika.ts
|
|
2625
|
+
var YandexMetrika = class {
|
|
2626
|
+
http;
|
|
2627
|
+
reports;
|
|
2628
|
+
management;
|
|
2629
|
+
constructor(options) {
|
|
2630
|
+
this.http = new MetrikaHttpClient(options);
|
|
2631
|
+
this.reports = new ReportsApi(this.http, {
|
|
2632
|
+
allowUnknownFields: options.allowUnknownFields ?? false
|
|
2633
|
+
});
|
|
2634
|
+
this.management = new ManagementApi(this.http);
|
|
2635
|
+
}
|
|
2636
|
+
/** Версия контракта, по которой собрана библиотека. */
|
|
2637
|
+
contract() {
|
|
2638
|
+
return { version: contractVersion, sourceSha256: contractSourceSha256, parsedAt: contractParsedAt };
|
|
2639
|
+
}
|
|
2640
|
+
/** Рецепт A: поисковые фразы органики. */
|
|
2641
|
+
getOrganicSearchPhrases(options) {
|
|
2642
|
+
return getOrganicSearchPhrases(this.reports, options);
|
|
2643
|
+
}
|
|
2644
|
+
/** Рецепт B: фраза × посадочная страница. */
|
|
2645
|
+
getPhraseLandingMap(options) {
|
|
2646
|
+
return getPhraseLandingMap(this.reports, options);
|
|
2647
|
+
}
|
|
2648
|
+
/**
|
|
2649
|
+
* Рецепт C: запросы Директа с кликами и расходами.
|
|
2650
|
+
* Если `directClientLogins` не передан, логины запрашиваются автоматически.
|
|
2651
|
+
*/
|
|
2652
|
+
async getDirectSearchPhraseCost(options) {
|
|
2653
|
+
const logins = options.directClientLogins ?? await this.management.getDirectClientLogins(options.counterId, options.signal);
|
|
2654
|
+
return getDirectSearchPhraseCost(this.reports, { ...options, directClientLogins: logins });
|
|
2655
|
+
}
|
|
2656
|
+
/** Рецепт D: ключевые слова Директа по визитам, без доступа к кампаниям. */
|
|
2657
|
+
getDirectKeywordsByVisits(options) {
|
|
2658
|
+
return getDirectKeywordsByVisits(this.reports, options);
|
|
2659
|
+
}
|
|
2660
|
+
/** Рецепт E: динамика фраз во времени. */
|
|
2661
|
+
getPhraseTimeline(options) {
|
|
2662
|
+
return getPhraseTimeline(this.reports, options);
|
|
2663
|
+
}
|
|
2664
|
+
/**
|
|
2665
|
+
* Сквозной сценарий: выгружает органику, посадочные страницы и Директ,
|
|
2666
|
+
* склеивает в единый реестр ключевых слов.
|
|
2667
|
+
*/
|
|
2668
|
+
async buildKeywordRegistry(options) {
|
|
2669
|
+
const organic = await this.getOrganicSearchPhrases(options);
|
|
2670
|
+
const landings = options.withLandings === false ? void 0 : await this.getPhraseLandingMap(options);
|
|
2671
|
+
let directCost;
|
|
2672
|
+
let directVisits;
|
|
2673
|
+
if (options.withDirect !== false) {
|
|
2674
|
+
const logins = options.directClientLogins ?? await this.management.getDirectClientLogins(options.counterId, options.signal).catch(() => []);
|
|
2675
|
+
if (logins.length > 0) {
|
|
2676
|
+
directCost = await getDirectSearchPhraseCost(this.reports, {
|
|
2677
|
+
...options,
|
|
2678
|
+
directClientLogins: logins
|
|
2679
|
+
});
|
|
2680
|
+
} else {
|
|
2681
|
+
this.http.warn({
|
|
2682
|
+
code: "direct_access_missing",
|
|
2683
|
+
message: "\u041D\u0435\u0442 \u0434\u043E\u0441\u0442\u0443\u043F\u043D\u044B\u0445 \u043B\u043E\u0433\u0438\u043D\u043E\u0432 \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u0432 \u0414\u0438\u0440\u0435\u043A\u0442\u0430 \u2014 \u043A\u043B\u0438\u043A\u0438 \u0438 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u043F\u0440\u043E\u043F\u0443\u0449\u0435\u043D\u044B. \u041A\u043B\u044E\u0447\u0435\u0432\u044B\u0435 \u0441\u043B\u043E\u0432\u0430 \u0414\u0438\u0440\u0435\u043A\u0442\u0430 \u0432\u044B\u0433\u0440\u0443\u0436\u0435\u043D\u044B \u043F\u043E \u0432\u0438\u0437\u0438\u0442\u0430\u043C (\u0431\u0435\u0437 \u043A\u043B\u0438\u043A\u043E\u0432 \u0438 \u0434\u0435\u043D\u0435\u0433)."
|
|
2684
|
+
});
|
|
2685
|
+
directVisits = await this.getDirectKeywordsByVisits(options);
|
|
2686
|
+
}
|
|
2687
|
+
}
|
|
2688
|
+
return mergeKeywords({
|
|
2689
|
+
organic,
|
|
2690
|
+
...landings ? { landings } : {},
|
|
2691
|
+
...directCost ? { directCost } : {},
|
|
2692
|
+
...directVisits ? { directVisits } : {}
|
|
2693
|
+
});
|
|
2694
|
+
}
|
|
2695
|
+
};
|
|
2696
|
+
|
|
2697
|
+
// src/contract/used.ts
|
|
2698
|
+
var USED_DIMENSIONS = {
|
|
2699
|
+
"ym:s:<attribution>SearchPhrase": "organic: \u043F\u043E\u0438\u0441\u043A\u043E\u0432\u0430\u044F \u0444\u0440\u0430\u0437\u0430",
|
|
2700
|
+
"ym:s:<attribution>SearchEngineRoot": "organic: \u043F\u043E\u0438\u0441\u043A\u043E\u0432\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430",
|
|
2701
|
+
"ym:s:<attribution>TrafficSource": "organic: \u0444\u0438\u043B\u044C\u0442\u0440 \u043F\u043E \u0438\u0441\u0442\u043E\u0447\u043D\u0438\u043A\u0443 \u0442\u0440\u0430\u0444\u0438\u043A\u0430",
|
|
2702
|
+
"ym:s:isRobot": "organic: \u043E\u0442\u0441\u0435\u0447\u043A\u0430 \u0440\u043E\u0431\u043E\u0442\u043E\u0432",
|
|
2703
|
+
"ym:s:startURL": "landing: \u043F\u043E\u0441\u0430\u0434\u043E\u0447\u043D\u0430\u044F \u0441\u0442\u0440\u0430\u043D\u0438\u0446\u0430",
|
|
2704
|
+
"ym:s:<attribution>DirectSearchPhrase": "directVisits: \u0440\u0435\u0430\u043B\u044C\u043D\u044B\u0439 \u0437\u0430\u043F\u0440\u043E\u0441 \u0414\u0438\u0440\u0435\u043A\u0442\u0430",
|
|
2705
|
+
"ym:s:<attribution>DirectPhraseOrCond": "directVisits: \u0443\u0441\u043B\u043E\u0432\u0438\u0435 \u043F\u043E\u043A\u0430\u0437\u0430",
|
|
2706
|
+
"ym:ad:<attribution>DirectSearchPhrase": "directCost: \u0440\u0435\u0430\u043B\u044C\u043D\u044B\u0439 \u0437\u0430\u043F\u0440\u043E\u0441 \u0414\u0438\u0440\u0435\u043A\u0442\u0430",
|
|
2707
|
+
"ym:ad:<attribution>DirectPhraseOrCond": "directCost: \u0443\u0441\u043B\u043E\u0432\u0438\u0435 \u043F\u043E\u043A\u0430\u0437\u0430",
|
|
2708
|
+
"ym:ad:<attribution>DirectOrder": "directCost: \u043A\u0430\u043C\u043F\u0430\u043D\u0438\u044F",
|
|
2709
|
+
"ym:ad:<attribution>DirectConditionType": "directCost: \u0442\u0438\u043F \u0443\u0441\u043B\u043E\u0432\u0438\u044F \u043F\u043E\u043A\u0430\u0437\u0430"
|
|
2710
|
+
};
|
|
2711
|
+
var USED_METRICS = {
|
|
2712
|
+
"ym:s:visits": "organic, directVisits",
|
|
2713
|
+
"ym:s:users": "organic, directVisits",
|
|
2714
|
+
"ym:s:bounceRate": "organic, directVisits",
|
|
2715
|
+
"ym:s:pageDepth": "organic",
|
|
2716
|
+
"ym:s:avgVisitDurationSeconds": "organic, landing",
|
|
2717
|
+
"ym:s:anyGoalConversionRate": "directVisits",
|
|
2718
|
+
"ym:ad:clicks": "directCost: \u043A\u043B\u0438\u043A\u0438 \u043F\u043E \u0440\u0435\u043A\u043B\u0430\u043C\u0435",
|
|
2719
|
+
"ym:ad:visits": "directCost",
|
|
2720
|
+
"ym:ad:users": "directCost",
|
|
2721
|
+
"ym:ad:bounceRate": "directCost",
|
|
2722
|
+
"ym:ad:<currency>ConvertedAdCost": "directCost: \u0440\u0430\u0441\u0445\u043E\u0434\u044B",
|
|
2723
|
+
"ym:ad:<currency>ConvertedAdCostPerVisit": "directCost: \u0441\u0442\u043E\u0438\u043C\u043E\u0441\u0442\u044C \u0432\u0438\u0437\u0438\u0442\u0430"
|
|
2724
|
+
};
|
|
2725
|
+
var USED_PRESETS = {
|
|
2726
|
+
sources_search_phrases: "\u044D\u043A\u0432\u0438\u0432\u0430\u043B\u0435\u043D\u0442 \u0440\u0435\u0446\u0435\u043F\u0442\u0430 organic \u0431\u0435\u0437 \u043E\u0442\u0441\u0435\u0447\u043A\u0438 \u0440\u043E\u0431\u043E\u0442\u043E\u0432",
|
|
2727
|
+
sources_direct_summary: "\u044D\u043A\u0432\u0438\u0432\u0430\u043B\u0435\u043D\u0442 \u0440\u0435\u0446\u0435\u043F\u0442\u0430 directVisits",
|
|
2728
|
+
sources_direct_clicks: "\u044D\u043A\u0432\u0438\u0432\u0430\u043B\u0435\u043D\u0442 \u0440\u0435\u0446\u0435\u043F\u0442\u0430 directCost"
|
|
2729
|
+
};
|
|
2730
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
2731
|
+
0 && (module.exports = {
|
|
2732
|
+
AuthError,
|
|
2733
|
+
CounterLookupError,
|
|
2734
|
+
DEFAULT_BASE_URL,
|
|
2735
|
+
DEPRECATED_ATTRIBUTIONS,
|
|
2736
|
+
DIM,
|
|
2737
|
+
DIMENSION_IDS,
|
|
2738
|
+
InvalidRequestError,
|
|
2739
|
+
LIMITS,
|
|
2740
|
+
MAX_TIMELINE_ROWS,
|
|
2741
|
+
METRIC,
|
|
2742
|
+
METRIC_IDS,
|
|
2743
|
+
ManagementApi,
|
|
2744
|
+
MetrikaError,
|
|
2745
|
+
MetrikaHttpClient,
|
|
2746
|
+
NotFoundError,
|
|
2747
|
+
PRESET_IDS,
|
|
2748
|
+
PRIVACY_THRESHOLD_USERS,
|
|
2749
|
+
QuotaError,
|
|
2750
|
+
RateLimiter,
|
|
2751
|
+
ReportsApi,
|
|
2752
|
+
RequestValidationError,
|
|
2753
|
+
SETTLED_LAG_DAYS,
|
|
2754
|
+
ServerError,
|
|
2755
|
+
USED_DIMENSIONS,
|
|
2756
|
+
USED_METRICS,
|
|
2757
|
+
USED_PRESETS,
|
|
2758
|
+
YandexMetrika,
|
|
2759
|
+
aggregateDirectKeywords,
|
|
2760
|
+
andFilters,
|
|
2761
|
+
buildUrl,
|
|
2762
|
+
consoleWarningHandler,
|
|
2763
|
+
contractParsedAt,
|
|
2764
|
+
contractSourceSha256,
|
|
2765
|
+
contractVersion,
|
|
2766
|
+
getDirectKeywordsByVisits,
|
|
2767
|
+
getDirectSearchPhraseCost,
|
|
2768
|
+
getOrganicSearchPhrases,
|
|
2769
|
+
getPhraseLandingMap,
|
|
2770
|
+
getPhraseTimeline,
|
|
2771
|
+
hasDimension,
|
|
2772
|
+
hasMetric,
|
|
2773
|
+
hasPreset,
|
|
2774
|
+
inspectResponse,
|
|
2775
|
+
isBelowPrivacyThreshold,
|
|
2776
|
+
isRetryable,
|
|
2777
|
+
mergeKeywords,
|
|
2778
|
+
mergeMeta,
|
|
2779
|
+
mergeQuality,
|
|
2780
|
+
namespaceOf,
|
|
2781
|
+
normalizePhrase,
|
|
2782
|
+
organicFilters,
|
|
2783
|
+
qualityOf,
|
|
2784
|
+
settledRange,
|
|
2785
|
+
toContractForm,
|
|
2786
|
+
toMetrikaError,
|
|
2787
|
+
toQueryParams,
|
|
2788
|
+
validateQuery
|
|
2789
|
+
});
|
|
2790
|
+
//# sourceMappingURL=index.cjs.map
|